How to make TopoDS_Face from gp_Pnts
OCCUtils provides Face::FromPoints() to linearly connect a set of gp_Pnt points and make a face from the resulting edges:
face_from_points.cpp
#include <occutils/Face.hxx>
using namespace OCCUtils;
gp_Pnt p1, p2, p3; // Your points!
TopoDS_Face face = Face::FromPoints({p1, p2, p3});Face::FromPoints() will automatically remove duplicate consecutive points and connect the last point to the first point.
Note that if there are not enough unique points (you need at least 3 unique points to make a valid face!), Face::FromPoints() will return a TopoDS_Face where .IsNull() is true.
Check out similar posts by category:
OpenCASCADE
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow