vertex on face


How to create a vertex(hard point) on a face? sometimes we need mesh to have a point on certain location of a surface, a vertex is guaranteed to have a mesh point, that's why we want to have the ability to create a singular vertex on surface.

Thank you for any advices!


Jane Hu's picture

Hi, Good morning!

Since nobody answered it, I believe there's no structure in TopoDS_Face which can hold a free vertex, so in the upper level of code, between mesh application and Open cascade core code, I am going to add a single vertex into the surface structure. So when mesh looks into the code and sees the surfaces has a stand-along TopoDS_Vertex vertex, it'll know to put a mesh point there.

It's FYI.


Stephane Routelous's picture

by hacking the OpenCASCADE source code for the mesher, you can add extra points, but it's quite a hard task.


Bearloga's picture

Actually, OCC has means to add a single vertex into face. Use an instance of class BRep_Builder to add the vertex to the face and to set its parameters with the following methods:

//! Add the Shape C in the Shape S.
//! Exceptions
//! - TopoDS_FrozenShape if S is not free and cannot be modified.
//! - TopoDS__UnCompatibleShapes if S and C are not compatible.
void TopoDS_Builder::Add(TopoDS_Shape& S,const TopoDS_Shape& C) const;

//! Sets the parameters for the vertex on the face.
void BRep_Builder::UpdateVertex(const TopoDS_Vertex& Ve,const Standard_Real U,const Standard_Real V,const TopoDS_Face& F,const Standard_Real Tol) const;

Take care to unfreeze the face (TopoDS_Shape::Free) before adding a vertex into it!
You can later iterate subshapes of a face to know if it has internal vertices using TopoDS_Iterator, ask parameters of the point on surface with the method

//! Returns the parameters of the vertex on the face
gp_Pnt2d BRep_Tool::Parameters(const TopoDS_Vertex& V,const TopoDS_Face& F);

good luck

Divya's picture

can you tell me how to represent a vertex,edge and face in opencascade.I' unable to get started on this.