+// Check if a point is already on the shape.
+// if faceShape is defined, we use it
+// else we use the sub-shape of the mesh
+bool _doVertexAlreadyExists(const TopoDS_Face& faceShape,
+ const gp_Pnt& aPnt)
+{
+ // If the point is already on the shape, no need to add it
+ TopExp_Explorer ex;
+ TopoDS_Shape shapeToCheckVertices(faceShape);
+ bool alreadyExists(false);
+ if (faceShape.IsNull())
+ shapeToCheckVertices = theHelper->GetSubShape();
+ for (ex.Init(shapeToCheckVertices, TopAbs_VERTEX); ex.More(); ex.Next())
+ {
+ TopoDS_Vertex vertex = TopoDS::Vertex(ex.Current());
+ double tol = BRep_Tool::Tolerance( vertex );
+ gp_Pnt p = BRep_Tool::Pnt(vertex);
+ if ( p.IsEqual( aPnt, tol))
+ {
+ MESSAGE("The enforced vertex is already on the shape => No need to add it.");
+ alreadyExists = true;
+ break;
+ }
+ }
+ return alreadyExists;
+}
+