-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnectivityRestrictor.cpp
37 lines (36 loc) · 1.21 KB
/
ConnectivityRestrictor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "ConnectivityRestrictor.h"
bool ConnectivityRestrictor::IsFlipMoveAllowed(const Edge * const edge) {
Vertex * otherVertex = edge->getAdjacent()->getOpposite();
if( edge->getOpposite() == otherVertex )
{
if( restriction_ == NO_SELF_LOOPS || restriction_ == NO_DOUBLE_EDGES )
{
return false;
}else if( cohomologybasis_->getOmega(edge->getNext()) == cohomologybasis_->getOmega(edge->getAdjacent()->getPrevious()->getAdjacent()) )
{
return false;
}
}
if( restriction_ == NO_DOUBLE_EDGES || restriction_ == NO_CONTRACTIBLE_DOUBLE_EDGES )
{
Vertex * otherVertex = edge->getAdjacent()->getOpposite();
Edge * startEdge = edge->getPrevious();
Edge * curEdge = startEdge;
do {
if( curEdge->getPrevious()->getOpposite() == otherVertex )
{
if( restriction_ == NO_DOUBLE_EDGES )
{
return false;
}
IntForm2D integral = AddForms(cohomologybasis_->getOmega(edge->getNext()),cohomologybasis_->getOmega(edge->getAdjacent()->getPrevious()));
if( FormIsZero(AddForms(integral,cohomologybasis_->getOmega(curEdge))) )
{
return false;
}
}
curEdge = curEdge->getPrevious()->getAdjacent();
} while(curEdge != startEdge);
}
return true;
}