Skip to content

Commit 4563bbf

Browse files
Jérémie Dumasjdumas
authored andcommitted
Fix numerically negative areas leading to infinite loop in dynamic programming.
1 parent dd7ab66 commit 4563bbf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/Src/ConstrainedTriangulation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace MishaK
4242
Point< GeometryReal , 2 > d[] = { vertices[i1]-vertices[i0] , vertices[i2]-vertices[i0] };
4343
SquareMatrix< double , 2 > M;
4444
for( int i=0 ; i<2 ; i++ ) for( int j=0 ; j<2 ; j++ ) M(i,j) = Point< GeometryReal , 2 >::Dot( d[i] , d[j] );
45-
return M.determinant();
45+
return std::max< double >( 0. , M.determinant() );
4646
};
4747
MinimalAreaTriangulation::GetTriangulation( SquaredArea , static_cast< unsigned int >( vertices.size() ) , outputTriangles );
4848
}

0 commit comments

Comments
 (0)