// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <MeshTest.ixx>
-#include <Draw_Interpretor.hxx>
-#include <TColStd_MapOfAsciiString.hxx>
+
+#include <Bnd_Box.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepGProp.hxx>
#include <BRepMesh_DiscretFactory.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_MapIteratorOfMapOfAsciiString.hxx>
-#include <BRepMesh_FactoryError.hxx>
#include <BRepMesh_DiscretRoot.hxx>
+#include <BRepMesh_Edge.hxx>
+#include <BRepMesh_FactoryError.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
-#include <Bnd_Box.hxx>
-#include <BRepMesh_PDiscretRoot.hxx>
-#include <Draw.hxx>
#include <DBRep.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopExp.hxx>
-#include <Poly_Triangulation.hxx>
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+#include <DrawTrSurf.hxx>
#include <gp_Vec.hxx>
#include <GProp_GProps.hxx>
-#include <BRepGProp.hxx>
-#include <DrawTrSurf.hxx>
-#include <BRep_Tool.hxx>
-#include <TopoDS.hxx>
+#include <MeshTest.hxx>
#include <MeshTest_CheckTopology.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
-#include <Poly_Polygon3D.hxx>
+#include <NCollection_Map.hxx>
#include <Poly_Polygon2D.hxx>
+#include <Poly_Polygon3D.hxx>
+#include <Poly_PolygonOnTriangulation.hxx>
+#include <Poly_Triangulation.hxx>
#include <Standard.hxx>
-#include <TopExp_Explorer.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <TCollection_AsciiString.hxx>
#include <TColStd_Array1OfInteger.hxx>
-#include <Poly_PolygonOnTriangulation.hxx>
+#include <TColStd_MapIteratorOfMapOfAsciiString.hxx>
+#include <TColStd_MapOfAsciiString.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
-#include <BRepMesh_Edge.hxx>
-#include <NCollection_Map.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
static Standard_Integer mpnames (Draw_Interpretor& , Standard_Integer , const char** );
static Standard_Integer mpsetdefaultname (Draw_Interpretor& , Standard_Integer , const char** );
__FILE__, mpparallel, g);
theCommands.Add("triarea","shape [eps] (computes triangles and surface area)",__FILE__, triarea, g);
theCommands.Add("tricheck", "shape (checks triangulation of shape)", __FILE__, tricheck, g);
-
}
//=======================================================================
TopLoc_Location aLoc;
Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(aFace, aLoc);
const TColgp_Array1OfPnt& aPoints = aT->Nodes();
- const TColgp_Array1OfPnt2d& aPoints2d = aT->UVNodes();
const gp_Trsf& trsf = aLoc.Transformation();
TColgp_Array1OfPnt pnts(1,2);
DrawTrSurf::Set (name, poly);
DrawTrSurf::Set (name, pnts(1));
DrawTrSurf::Set (name, pnts(2));
- pnts2d(1) = aPoints2d(n1);
- pnts2d(2) = aPoints2d(n2);
- Handle(Poly_Polygon2D) poly2d = new Poly_Polygon2D (pnts2d);
- DrawTrSurf::Set (name, poly2d);
- DrawTrSurf::Set (name, pnts2d(1));
- DrawTrSurf::Set (name, pnts2d(2));
+ if (aT->HasUVNodes())
+ {
+ const TColgp_Array1OfPnt2d& aPoints2d = aT->UVNodes();
+ pnts2d(1) = aPoints2d(n1);
+ pnts2d(2) = aPoints2d(n2);
+ Handle(Poly_Polygon2D) poly2d = new Poly_Polygon2D (pnts2d);
+ DrawTrSurf::Set (name, poly2d);
+ DrawTrSurf::Set (name, pnts2d(1));
+ DrawTrSurf::Set (name, pnts2d(2));
+ }
}
di << "\n";
}
// dump info on cross face errors
Standard_Integer nbErr = aCheck.NbCrossFaceErrors();
if (nbErr > 0) {
- di << "cross face errors: {face1, node1, face2, node2, distance}" << "\n";
+ di << "cross face errors: {face1, node1, face2, node2, distance}\n";
for (i=1; i <= nbErr; i++) {
Standard_Integer iF1, n1, iF2, n2;
Standard_Real aVal;
// dump info on edges
Standard_Integer nbAsync = aCheck.NbAsyncEdges();
if (nbAsync > 0) {
- di << "async edges:" << "\n";
+ di << "async edges:\n";
for (i=1; i <= nbAsync; i++) {
Standard_Integer ie = aCheck.GetAsyncEdgeNum(i);
di << ie << " ";
// dump info on free nodes
Standard_Integer nbFreeNodes = aCheck.NbFreeNodes();
if (nbFreeNodes > 0) {
- di << "free nodes (in pairs: face / node): " << "\n";
+ di << "free nodes (in pairs: face / node): \n";
for (i=1; i <= nbFreeNodes; i++) {
Standard_Integer iface, inode;
aCheck.GetFreeNodeNum(i, iface, inode);
+
+ const TopoDS_Face& aFace = TopoDS::Face(aMapF.FindKey(iface));
+ TopLoc_Location aLoc;
+ Handle(Poly_Triangulation) aT = BRep_Tool::Triangulation(aFace, aLoc);
+ const TColgp_Array1OfPnt& aPoints = aT->Nodes();
+ const gp_Trsf& trsf = aLoc.Transformation();
+ DrawTrSurf::Set (name, aPoints(inode).Transformed(trsf));
+ if (aT->HasUVNodes())
+ {
+ DrawTrSurf::Set (name, aT->UVNodes()(inode));
+ }
+
di << "{" << iface << " " << inode << "} ";
}
di << "\n";
Standard_Integer anUpper = anIndices.Upper();
Standard_Integer aPrevNode = -1;
- for (Standard_Integer i = aLower; i <= anUpper; ++i)
+ for (Standard_Integer j = aLower; j <= anUpper; ++j)
{
- Standard_Integer aNodeIdx = anIndices.Value(i);
- if (i != aLower)
+ Standard_Integer aNodeIdx = anIndices.Value(j);
+ if (j != aLower)
{
BRepMesh_Edge aLink(aPrevNode, aNodeIdx, BRepMesh_Frontier);
aBoundaryEdgeMap.Add(aLink);
const Poly_Triangle& aTri = aTris(aTriIndx);
Standard_Integer aTriNodes[3] = { aTri.Value(1), aTri.Value(2), aTri.Value(3)};
- for (Standard_Integer i = 1; i <= 3; ++i)
+ for (Standard_Integer j = 1; j <= 3; ++j)
{
- Standard_Integer aLastId = aTriNodes[i % 3];
- Standard_Integer aFirstId = aTriNodes[i - 1];
+ Standard_Integer aLastId = aTriNodes[j % 3];
+ Standard_Integer aFirstId = aTriNodes[j - 1];
BRepMesh_Edge aLink(aFirstId, aLastId, BRepMesh_Free);
if (!aBoundaryEdgeMap.Contains(aLink))
if (aFreeEdgeMap.Size() != 0)
{
di << "Not connected mesh inside face " << aFaceId << "\n";
+
+ const TColgp_Array1OfPnt& aPoints = aT->Nodes();
+ const gp_Trsf& trsf = aLoc.Transformation();
+
+ TColgp_Array1OfPnt pnts(1,2);
+ TColgp_Array1OfPnt2d pnts2d(1,2);
+ NCollection_Map<BRepMesh_Edge>::Iterator aMapIt(aFreeEdgeMap);
+ for (; aMapIt.More(); aMapIt.Next())
+ {
+ const BRepMesh_Edge& aLink = aMapIt.Key();
+ di << "{" << aLink.FirstNode() << " " << aLink.LastNode() << "} ";
+ pnts(1) = aPoints(aLink.FirstNode()).Transformed(trsf);
+ pnts(2) = aPoints(aLink.LastNode()).Transformed(trsf);
+ Handle(Poly_Polygon3D) poly = new Poly_Polygon3D (pnts);
+ DrawTrSurf::Set (name, poly);
+ DrawTrSurf::Set (name, pnts(1));
+ DrawTrSurf::Set (name, pnts(2));
+ if (aT->HasUVNodes())
+ {
+ const TColgp_Array1OfPnt2d& aPoints2d = aT->UVNodes();
+ pnts2d(1) = aPoints2d(aLink.FirstNode());
+ pnts2d(2) = aPoints2d(aLink.LastNode());
+ Handle(Poly_Polygon2D) poly2d = new Poly_Polygon2D (pnts2d);
+ DrawTrSurf::Set (name, poly2d);
+ DrawTrSurf::Set (name, pnts2d(1));
+ DrawTrSurf::Set (name, pnts2d(2));
+ }
+ }
+ di << "\n";
}
}
return 0;