Hi,
Here is a sample geometry list.
std::vector<gp_Pnt> gpList;
gpList.push_back(gp_Pnt( 4.39116, -2.39117, 4.5));
gpList.push_back(gp_Pnt( 4.39116, -2.39117, 3));
gpList.push_back(gp_Pnt( 4.39116, -2.39117, 1.5));
gpList.push_back(gp_Pnt( 4.39116, -2.39117, 0));
gpList.push_back(gp_Pnt( 4.08748, -2.87967, 0));
gpList.push_back(gp_Pnt( 3.05391, -3.95899, 0));
gpList.push_back(gp_Pnt( 1.74755, -4.68466, 0));
gpList.push_back(gp_Pnt( 0.28509, -4.99187, 0));
gpList.push_back(gp_Pnt( -1.20284, -4.85316, 0));
gpList.push_back(gp_Pnt( -2.58332, -4.28094, 0));
gpList.push_back(gp_Pnt( -3.73305, -3.32631, 0));
gpList.push_back(gp_Pnt( -4.54931, -2.07456, 0));
gpList.push_back(gp_Pnt( -4.95919, -0.637487, 0));
gpList.push_back(gp_Pnt( -4.92609, 0.856528, 0));
gpList.push_back(gp_Pnt( -4.45295, 2.27403, 0));
gpList.push_back(gp_Pnt( -3.58205, 3.4884, 0));
gpList.push_back(gp_Pnt( -2.39117, 4.39116, 0));
gpList.push_back(gp_Pnt( -2.39117, 4.39116, 1.5));
gpList.push_back(gp_Pnt( -2.39117, 4.39116, 3));
gpList.push_back(gp_Pnt( -2.39117, 4.39116, 4.5));
gpList.push_back(gp_Pnt( -2.39117, 4.39116, 6));
gpList.push_back(gp_Pnt( -3.58205, 3.4884, 6));
gpList.push_back(gp_Pnt( -4.45295, 2.27403, 6));
gpList.push_back(gp_Pnt( -4.92609, 0.856528, 6));
gpList.push_back(gp_Pnt(-4.95919, -0.637487, 6));
gpList.push_back(gp_Pnt(-4.54931, -2.07456, 6));
gpList.push_back(gp_Pnt(-3.73305, -3.32631, 6));
gpList.push_back(gp_Pnt(-2.58332, -4.28094, 6));
gpList.push_back(gp_Pnt(-1.20284, -4.85316, 6));
gpList.push_back(gp_Pnt(0.28509, -4.99187, 6));
gpList.push_back(gp_Pnt(1.74755, -4.68466, 6));
gpList.push_back(gp_Pnt(3.05391, -3.95899, 6));
gpList.push_back(gp_Pnt(4.08748, -2.87967, 6));
gpList.push_back(gp_Pnt(4.39116, -2.39117, 6));
BRepBuilderAPI_MakePolygon aMakePolygon;
for(int j = 0; j < gpList.size(); j--)
{
aMakePolygon.Add(gpList[j]);
}
aMakePolygon.Close(); //to close the polygon
BRepBuilderAPI_MakeFace aMakeFace (aMakePolygon.Wire(), Standard_False /*CreateOnlyPlane*/);
TopoDS_Face aFace = aMakeFace.Face();
double const deflection = 0.001;
double const angulardeflection = 0.001;
BRepMesh_IncrementalMesh discr(aFace, deflection, false, angulardeflection);
discr.Perform();
const TopoDS_Face& meshFace = TopoDS::Face(discr.Shape());
TopLoc_Location loc;
Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation(meshFace, loc);
This polygon loop is basically a section of a side of the cylinder. What is wrong in this polygon? How do I check that polygon is valid structure or not? How do I make it correct oriented if at all it is wrong?
Thanks