#include <Poly_Triangle.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <Poly_Triangulation.hxx>
+#include <Poly_Polygon3D.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
aLP.Clear();
BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc);
if (aTRE.IsNull() || aPTE.IsNull()) {
- myErrorStatus=20; // no triangulation found
- return;
+ Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(aE, aLoc);
+ if (aPE.IsNull()) {
+ myErrorStatus=20; // no triangulation found
+ return;
+ }
+ const gp_Trsf& aTrsf=aLoc.Transformation();
+ const TColgp_Array1OfPnt& aNodes=aPE->Nodes();
+ //
+ aNbNodes=aPE->NbNodes();
+ Standard_Integer low = aNodes.Lower(), up = aNodes.Upper();
+ for (j=low+1; j<up; ++j) {
+ aP=aNodes(j).Transformed(aTrsf);
+ aLP.Append(aP);
+ }
}
- //
- const gp_Trsf& aTrsf=aLoc.Transformation();
- const TColgp_Array1OfPnt& aNodes=aTRE->Nodes();
- //
- aNbNodes=aPTE->NbNodes();
- const TColStd_Array1OfInteger& aInds=aPTE->Nodes();
- for (j=2; j<aNbNodes; ++j) {
- aIndex=aInds(j);
- aP=aNodes(aIndex).Transformed(aTrsf);
- aLP.Append(aP);
+ else {
+ const gp_Trsf& aTrsf=aLoc.Transformation();
+ const TColgp_Array1OfPnt& aNodes=aTRE->Nodes();
+ //
+ aNbNodes=aPTE->NbNodes();
+ const TColStd_Array1OfInteger& aInds=aPTE->Nodes();
+ for (j=2; j<aNbNodes; ++j) {
+ aIndex=aInds(j);
+ aP=aNodes(aIndex).Transformed(aTrsf);
+ aLP.Append(aP);
+ }
}
//
aNb=aLP.Extent();
// try to fill it yourself
InnerPoints(aE, myNbPntsMin, aLP);
aNb=aLP.Extent();
-
}
}
//=======================================================================
#include <Poly_Triangle.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <Poly_Triangulation.hxx>
+#include <Poly_Polygon3D.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
aLP.Clear();
BRep_Tool::PolygonOnTriangulation(aE, aPTE, aTRE, aLoc);
if (aTRE.IsNull() || aPTE.IsNull()) {
- myErrorStatus=20; // no triangulation found
- return;
+ Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(aE, aLoc);
+ if (aPE.IsNull()) {
+ myErrorStatus=20; // no triangulation found
+ return;
+ }
+ const gp_Trsf& aTrsf=aLoc.Transformation();
+ const TColgp_Array1OfPnt& aNodes=aPE->Nodes();
+ //
+ aNbNodes=aPE->NbNodes();
+ Standard_Integer low = aNodes.Lower(), up = aNodes.Upper();
+ for (j=low+1; j<up; ++j) {
+ aP=aNodes(j).Transformed(aTrsf);
+ aLP.Append(aP);
+ }
}
- //
- const gp_Trsf& aTrsf=aLoc.Transformation();
- const TColgp_Array1OfPnt& aNodes=aTRE->Nodes();
- //
- aNbNodes=aPTE->NbNodes();
- const TColStd_Array1OfInteger& aInds=aPTE->Nodes();
- for (j=2; j<aNbNodes; ++j) {
- aIndex=aInds(j);
- aP=aNodes(aIndex).Transformed(aTrsf);
- aLP.Append(aP);
+ else {
+ const gp_Trsf& aTrsf=aLoc.Transformation();
+ const TColgp_Array1OfPnt& aNodes=aTRE->Nodes();
+ //
+ aNbNodes=aPTE->NbNodes();
+ const TColStd_Array1OfInteger& aInds=aPTE->Nodes();
+ for (j=2; j<aNbNodes; ++j) {
+ aIndex=aInds(j);
+ aP=aNodes(aIndex).Transformed(aTrsf);
+ aLP.Append(aP);
+ }
}
//
aNb=aLP.Extent();
// try to fill it yourself
InnerPoints(aE, myNbPntsMin, aLP);
aNb=aLP.Extent();
-
}
}
//=======================================================================
// 30- can not obtain the line from the link
// 40- point can not be classified
// 41- invalid data for classifier
-
//=======================================================================
bool GEOMImpl_IShapesOperations::CheckTriangulation (const TopoDS_Shape& aShape)
{
+ bool isTriangulation = true;
+
TopExp_Explorer exp (aShape, TopAbs_FACE);
- if (!exp.More()) {
- return false;
+ if (exp.More())
+ {
+ TopLoc_Location aTopLoc;
+ Handle(Poly_Triangulation) aTRF;
+ aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
+ if (aTRF.IsNull()) {
+ isTriangulation = false;
+ }
+ }
+ else // no faces, try edges
+ {
+ TopExp_Explorer expe (aShape, TopAbs_EDGE);
+ if (!expe.More()) {
+ return false;
+ }
+ TopLoc_Location aLoc;
+ Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
+ if (aPE.IsNull()) {
+ isTriangulation = false;
+ }
}
- TopLoc_Location aTopLoc;
- Handle(Poly_Triangulation) aTRF;
- aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
- if (aTRF.IsNull()) {
+ if (!isTriangulation) {
// calculate deflection
Standard_Real aDeviationCoefficient = 0.001;