@@ -201,7 +201,9 @@ RealGradient TriangulatorInterface::Hole::areavec() const
201201 // the division by 2 and the norm for the end.
202202 //
203203 // Your hole points had best be coplanar, but this should work
204- // regardless of which plane they're in.
204+ // regardless of which plane they're in. If you're in the XY plane,
205+ // then the standard counter-clockwise hole point ordering gives you
206+ // a positive areavec(2);
205207
206208 RealGradient areavec = 0 ;
207209
@@ -210,7 +212,7 @@ RealGradient TriangulatorInterface::Hole::areavec() const
210212 const Point e_0im = this -> point (i - 1 ) - p0 ,
211213 e_0i = this -> point (i ) - p0 ;
212214
213- areavec += e_0im .cross (e_0i );
215+ areavec += e_0i .cross (e_0im );
214216 }
215217
216218 return areavec ;
@@ -648,13 +650,13 @@ TriangulatorInterface::MeshedHole::MeshedHole(const MeshBase & mesh,
648650 const Point e_0im = * hole_points [i - 1 ] - p0 ,
649651 e_0i = * hole_points [i ] - p0 ;
650652
651- twice_this_area += e_0im .cross (e_0i )(2 );
653+ twice_this_area += e_0i .cross (e_0im )(2 );
652654 }
653655
654656 auto abs_twice_this_area = std ::abs (twice_this_area );
655657
656- if (((abs_twice_this_area == twice_this_area ) && edge_type == 2 ) ||
657- ((abs_twice_this_area != twice_this_area ) && edge_type == 1 ))
658+ if (((twice_this_area > 0 ) && edge_type == 2 ) ||
659+ ((twice_this_area < 0 ) && edge_type == 1 ))
658660 ++ n_positive_areas ;
659661 else
660662 ++ n_negative_areas ;
@@ -700,7 +702,7 @@ TriangulatorInterface::MeshedHole::MeshedHole(const MeshBase & mesh,
700702#endif
701703
702704 if (((twice_outer_area > 0 ) && outer_edge_type == 2 ) ||
703- outer_edge_type == 1 )
705+ (( twice_outer_area < 0 ) && outer_edge_type == 1 ) )
704706 {
705707 if (n_positive_areas > 1 )
706708 {
0 commit comments