1 // Created on: 1993-09-22
2 // Created by: Didier PIFFAULT
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <Standard_Stream.hxx>
21 #include <MeshTest.ixx>
23 #include <MeshTest_DrawableMesh.hxx>
24 #include <TopAbs_ShapeEnum.hxx>
26 #include <TopoDS_Edge.hxx>
27 #include <TopoDS_Face.hxx>
28 #include <TopoDS_Shape.hxx>
29 #include <TopoDS_Compound.hxx>
30 #include <TopExp_Explorer.hxx>
31 #include <TopTools_ListIteratorOfListOfShape.hxx>
33 #include <BRepTest.hxx>
34 #include <GeometryTest.hxx>
35 #include <BRep_Tool.hxx>
36 #include <BRep_Builder.hxx>
37 #include <Draw_MarkerShape.hxx>
38 #include <Draw_Appli.hxx>
40 #include <DrawTrSurf.hxx>
41 #include <BRepMesh_Triangle.hxx>
42 #include <BRepMesh_DataStructureOfDelaun.hxx>
43 #include <BRepMesh_Delaun.hxx>
44 #include <BRepMesh_FastDiscret.hxx>
45 #include <BRepMesh_Vertex.hxx>
46 #include <BRepMesh_Edge.hxx>
47 #include <BRepMesh_IncrementalMesh.hxx>
48 #include <TColStd_ListIteratorOfListOfInteger.hxx>
49 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
50 #include <Bnd_Box.hxx>
51 #include <Precision.hxx>
52 #include <Draw_Interpretor.hxx>
53 #include <Geom_Plane.hxx>
54 #include <Geom_Surface.hxx>
55 #include <Draw_Marker3D.hxx>
56 #include <Draw_Segment2D.hxx>
58 #include <GCPnts_UniformAbscissa.hxx>
59 #include <GeomAdaptor_Curve.hxx>
60 #include <Geom_Curve.hxx>
61 #include <Extrema_LocateExtPC.hxx>
63 #include <TopLoc_Location.hxx>
64 #include <gp_Trsf.hxx>
65 #include <Poly_Triangulation.hxx>
66 #include <Poly_Connect.hxx>
67 #include <TColgp_Array1OfPnt2d.hxx>
68 #include <TColStd_HArray1OfInteger.hxx>
69 #include <TopExp_Explorer.hxx>
73 #include <AppCont_ContMatrices.hxx>
74 #include <math_Vector.hxx>
75 #include <math_Matrix.hxx>
78 #include <CSLib_DerivativeStatus.hxx>
80 #include <BRepAdaptor_Surface.hxx>
81 #include <Bnd_Box.hxx>
82 #include <BRepBndLib.hxx>
85 //epa Memory leaks test
86 #include <BRepBuilderAPI_MakePolygon.hxx>
87 #include <TopoDS_Wire.hxx>
88 #include <BRepBuilderAPI_MakeFace.hxx>
89 #include <BRepTools.hxx>
92 #include <BRepBuilderAPI_MakeVertex.hxx>
93 #include <Poly_PolygonOnTriangulation.hxx>
94 #include <TopTools_MapIteratorOfMapOfShape.hxx>
97 Standard_IMPORT Draw_Viewer dout;
100 #define MAX2(X, Y) ( Abs(X) > Abs(Y)? Abs(X) : Abs(Y) )
101 #define MAX3(X, Y, Z) ( MAX2 ( MAX2(X,Y) , Z) )
105 #define ONETHIRD 0.333333333333333333333333333333333333333333333333333333333333
106 #define TWOTHIRD 0.666666666666666666666666666666666666666666666666666666666666
108 #ifdef OCCT_DEBUG_MESH_CHRONO
109 #include <OSD_Chronometer.hxx>
110 Standard_Integer D0Control, D0Internal, D0Unif, D0Edges, NbControls;
111 OSD_Chronometer chTotal, chInternal, chControl, chUnif, chAddPoint;
112 OSD_Chronometer chEdges, chMaillEdges, chEtuInter, chLastControl, chStock;
113 OSD_Chronometer chAdd11, chAdd12, chAdd2, chUpdate, chPointValid;
114 OSD_Chronometer chIsos, chPointsOnIsos;
117 //=======================================================================
118 //function : incrementalmesh
120 //=======================================================================
122 static Standard_Integer incrementalmesh(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
125 di << " use incmesh shape deflection [inParallel (0/1) : 0 by default]\n";
129 TopoDS_Shape aShape = DBRep::Get(argv[1]);
130 if (aShape.IsNull()) {
131 di << " null shapes is not allowed here\n";
134 Standard_Real aDeflection = Draw::Atof(argv[2]);
136 Standard_Boolean isInParallel = Standard_False;
138 isInParallel = Draw::Atoi(argv[3]) == 1;
140 di << "Incremental Mesh, multi-threading "
141 << (isInParallel ? "ON\n" : "OFF\n");
143 BRepMesh_IncrementalMesh MESH(aShape, aDeflection, Standard_False, 0.5, isInParallel);
144 Standard_Integer statusFlags = MESH.GetStatusFlags();
146 di << "Meshing statuses: ";
155 for( i = 0; i < 4; i++ )
157 if( (statusFlags >> i) & (Standard_Integer)1 )
165 di << "SelfIntersectingWire ";
181 //=======================================================================
182 //function : MemLeakTest
184 //=======================================================================
186 static Standard_Integer MemLeakTest(Draw_Interpretor&, Standard_Integer /*nbarg*/, const char** /*argv*/)
188 for(int i=0;i<10000;i++)
190 BRepBuilderAPI_MakePolygon w(gp_Pnt(0,0,0),gp_Pnt(0,100,0),gp_Pnt(20,100,0),gp_Pnt(20,0,0));
192 TopoDS_Wire wireShape( w.Wire());
193 BRepBuilderAPI_MakeFace faceBuilder(wireShape);
194 TopoDS_Face f( faceBuilder.Face());
195 BRepMesh_IncrementalMesh im(f,1);
201 //=======================================================================
202 //function : fastdiscret
204 //=======================================================================
206 static Standard_Integer fastdiscret(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
208 if (nbarg < 3) return 1;
210 TopoDS_Shape S = DBRep::Get(argv[1]);
211 if (S.IsNull()) return 1;
213 const Standard_Real d = Draw::Atof(argv[2]);
215 Standard_Boolean WithShare = Standard_True;
216 if (nbarg > 3) WithShare = Draw::Atoi(argv[3]);
219 BRepBndLib::Add(S,B);
220 BRepMesh_FastDiscret MESH(d,0.5,B,WithShare,Standard_True,Standard_False,Standard_True);
222 //Standard_Integer NbIterations = MESH.NbIterations();
223 //if (nbarg > 4) NbIterations = Draw::Atoi(argv[4]);
224 //MESH.NbIterations() = NbIterations;
226 di<<"Starting FastDiscret with :"<<"\n";
227 di<<" Deflection="<<d<<"\n";
228 di<<" Angle="<<0.5<<"\n";
229 di<<" SharedMode="<< (Standard_Integer) WithShare<<"\n";
230 //di<<" NbIterations="<<NbIterations<<"\n";
232 Handle(Poly_Triangulation) T;
233 BRep_Builder aBuilder;
236 // Clear existing triangulations
237 for (ex.Init(S, TopAbs_FACE); ex.More(); ex.Next())
238 aBuilder.UpdateFace(TopoDS::Face(ex.Current()),T);
242 TopoDS_Compound aCompGood, aCompFailed, aCompViolating;
245 Standard_Integer nbtriangles = 0, nbnodes = 0, nbfailed = 0, nbviolating = 0;
246 Standard_Real maxdef = 0.0;
247 for (ex.Init(S, TopAbs_FACE); ex.More(); ex.Next())
249 T = BRep_Tool::Triangulation(TopoDS::Face(ex.Current()),L);
253 if (aCompFailed.IsNull())
254 aBuilder.MakeCompound(aCompFailed);
255 aBuilder.Add(aCompFailed,ex.Current());
259 nbtriangles += T->NbTriangles();
260 nbnodes += T->NbNodes();
261 if (T->Deflection() > maxdef) maxdef = T->Deflection();
262 if (T->Deflection() > d)
265 if (aCompViolating.IsNull())
266 aBuilder.MakeCompound(aCompViolating);
267 aBuilder.Add(aCompViolating,ex.Current());
271 if (aCompGood.IsNull())
272 aBuilder.MakeCompound(aCompGood);
273 aBuilder.Add(aCompGood,ex.Current());
278 if (!aCompGood.IsNull())
281 strcpy(name,argv[1]);
282 strcat(name,"_good");
283 DBRep::Set(name,aCompGood);
285 if (!aCompFailed.IsNull())
288 strcpy(name,argv[1]);
289 strcat(name,"_failed");
290 DBRep::Set(name,aCompFailed);
292 if (!aCompViolating.IsNull())
295 strcpy(name,argv[1]);
296 strcat(name,"_violating");
297 DBRep::Set(name,aCompViolating);
300 di<<"FastDiscret completed with :"<<"\n";
301 di<<" MaxDeflection="<<maxdef<<"\n";
302 di<<" NbNodes="<<nbnodes<<"\n";
303 di<<" NbTriangles="<<nbtriangles<<"\n";
304 di<<" NbFailed="<<nbfailed<<"\n";
305 di<<" NbViolating="<<nbviolating<<"\n";
311 //=======================================================================
312 //function : triangule
314 //=======================================================================
317 class BRepMesh_Couple
320 BRepMesh_Couple() { myI1 = myI2 = 0; }
321 BRepMesh_Couple(const Standard_Integer I1,
322 const Standard_Integer I2)
323 { myI1 = I1; myI2 = I2; }
325 Standard_Integer myI1;
326 Standard_Integer myI2;
329 inline Standard_Boolean IsEqual(const BRepMesh_Couple& one,
330 const BRepMesh_Couple& other)
332 if (one.myI1 == other.myI1 &&
333 one.myI2 == other.myI2) return Standard_True;
334 else return Standard_False;
337 inline Standard_Integer HashCode(const BRepMesh_Couple& one,
338 const Standard_Integer Upper)
340 return ::HashCode((one.myI1+one.myI2), Upper);
343 typedef NCollection_Map<BRepMesh_Couple> BRepMesh_MapOfCouple;
346 static void AddLink(BRepMesh_MapOfCouple& aMap,
350 Standard_Integer i1 = v1;
351 Standard_Integer i2 = v2;
356 aMap.Add(BRepMesh_Couple(i1,i2));
359 static void MeshStats(const TopoDS_Shape& theSape,
360 Standard_Integer& theNbTri,
361 Standard_Integer& theNbEdges,
362 Standard_Integer& theNbNodes)
368 Handle(Poly_Triangulation) T;
371 for ( TopExp_Explorer ex(theSape, TopAbs_FACE); ex.More(); ex.Next()) {
372 TopoDS_Face F = TopoDS::Face(ex.Current());
373 T = BRep_Tool::Triangulation(F, L);
375 theNbTri += T->NbTriangles();
376 theNbNodes += T->NbNodes();
378 BRepMesh_MapOfCouple aMap;
379 //count number of links
380 Poly_Array1OfTriangle& Trian = T->ChangeTriangles();
381 for(Standard_Integer i = 1; i<=Trian.Length();i++) {
382 Standard_Integer v1, v2, v3;
383 Trian(i).Get(v1,v2,v3);
385 AddLink(aMap, v1, v2);
386 AddLink(aMap, v2, v3);
387 AddLink(aMap, v3, v1);
390 theNbEdges+=aMap.Extent();
395 static Standard_Integer triangule(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
400 const char *id1 = argv[2];
401 TopoDS_Shape aShape = DBRep::Get(id1);
405 di << argv[1] << " ";
407 Standard_Real aDeflection = Draw::Atof(argv[3]);
408 if (aDeflection <= 0.)
410 di << " Incorrect value of deflection!" << "\n";
414 Handle(MeshTest_DrawableMesh) aDMesh =
415 new MeshTest_DrawableMesh(aShape, aDeflection);
417 Draw::Set(argv[1], aDMesh);
419 Standard_Integer nbn, nbl, nbe;
420 MeshStats(aShape, nbe, nbl, nbn);
422 di<<"(Resultat ("<<nbe<<" mailles) ("<<nbl<<" aretes) ("<<nbn<<" sommets))"<<"\n";
424 // passe de verification du maillage.
425 /*Standard_Integer nbc;
426 for (Standard_Integer iLi=1; iLi<= DM->Mesh()->NbEdges(); iLi++) {
427 const BRepMesh_Edge& ed=DM->Mesh()->Edge(iLi);
428 if (ed.Movability()!=BRepMesh_Deleted) {
429 nbc=struc->ElemConnectedTo(iLi).Extent();
430 if (nbc != 1 && nbc != 2) di <<"ERROR MAILLAGE Edge no "<< iLi<<"\n";
437 TopExp_Explorer aFaceIt(aShape, TopAbs_FACE);
438 for (; aFaceIt.More(); aFaceIt.Next())
440 const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
442 TopLoc_Location aLoc = aFace.Location();
443 Handle(Poly_Triangulation) aTriangulation =
444 BRep_Tool::Triangulation(aFace, aLoc);
446 if (!aTriangulation.IsNull())
448 const Standard_Integer aLength = aTriangulation->NbNodes();
449 const TColgp_Array1OfPnt& aNodes = aTriangulation->Nodes();
450 for (Standard_Integer i = 1; i <= aLength; ++i)
455 Standard_Real aDelta = 0.;
458 Standard_Real x, y, z, X, Y, Z;
459 aBox.Get(x, y, z, X, Y, Z);
461 aDelta = Max(X - x, Max(Y - y, Z - z));
463 aDelta = aDeflection / aDelta;
466 di << " Ratio between deflection and total shape size is " << aDelta << "\n";
471 //=======================================================================
472 //function : addshape
474 //=======================================================================
476 Standard_Integer addshape(Draw_Interpretor&, Standard_Integer n, const char** a)
479 Handle(MeshTest_DrawableMesh) D =
480 Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
481 if (D.IsNull()) return 1;
482 TopoDS_Shape S = DBRep::Get(a[2]);
483 if (S.IsNull()) return 1;
492 //=======================================================================
495 //=======================================================================
497 /*Standard_Integer smooth(Draw_Interpretor&, Standard_Integer n, const char** a)
500 Handle(MeshTest_DrawableMesh) D =
501 Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
502 if (D.IsNull()) return 1;
503 Handle(BRepMesh_DataStructureOfDelaun) struc=
505 BRepMesh_Array1OfVertexOfDelaun toto(1,1);
506 BRepMesh_Delaun trial(struc,
509 trial.SmoothMesh(0.1);
515 //=======================================================================
518 //=======================================================================
520 /*static Standard_Integer edges (Draw_Interpretor&, Standard_Integer n, const char** a)
524 Handle(MeshTest_DrawableMesh) D =
525 Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
526 if (D.IsNull()) return 1;
527 TopoDS_Shape S = DBRep::Get(a[2]);
528 if (S.IsNull()) return 1;
531 TColStd_SequenceOfInteger& eseq = D->Edges();
532 Handle(BRepMesh_FastDiscret) M = D->Mesh();
533 Handle(BRepMesh_DataStructureOfDelaun) DS = M->Result();
534 Standard_Integer e1, e2, e3, iTri;
535 Standard_Boolean o1, o2, o3;
538 for (ex.Init(S,TopAbs_FACE);ex.More();ex.Next()) {
539 const BRepMesh_MapOfInteger& elems = DS->ElemOfDomain();
540 BRepMesh_MapOfInteger::Iterator it;
541 for (it.Initialize(elems); it.More(); it.Next()) {
543 const BRepMesh_Triangle& triang = M->Triangle(iTri);
544 if (triang.Movability()!=BRepMesh_Deleted) {
545 triang.Edges(e1, e2, e3, o1, o2, o3);
554 //for (ex.Init(S,TopAbs_EDGE,TopAbs_FACE);ex.More();ex.Next()) {
562 //=======================================================================
563 //function : vertices
565 //=======================================================================
566 static Standard_Integer vertices(
567 Draw_Interpretor& /*di*/,
568 Standard_Integer /*argc*/,
569 const char** /*argv*/)
573 // TODO: OAN re-implement this command according changes in BRepMesh
577 //Handle(MeshTest_DrawableMesh) aDrawableMesh =
578 // Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(argv[1]));
579 //if (aDrawableMesh.IsNull())
582 //TopoDS_Shape aShape = DBRep::Get(argv[2]);
583 //if (aShape.IsNull())
586 //TColStd_SequenceOfInteger& aVertexSeq = aDrawableMesh->Vertices();
587 //Handle(BRepMesh_FastDiscret) aMesh = aDrawableMesh->Mesh();
589 //TopExp_Explorer aFaceIt(aShape, TopAbs_FACE);
590 //for (; aFaceIt.More(); aFaceIt.Next())
592 // const TopoDS_Face& aFace = TopoDS::Face(aFaceIt.Current());
594 // Handle(BRepMesh_FaceAttribute) aAttribute;
595 // if (aMesh->GetFaceAttribute(aFace, aAttribute))
597 // Handle(BRepMesh_DataStructureOfDelaun) aStructure = aAttribute->EditStructure();
599 // // Recuperate from the map of edges.
600 // const BRepMeshCol::MapOfInteger& aEdgeMap = aStructure->LinksOfDomain();
602 // // Iterator on edges.
603 // BRepMeshCol::MapOfInteger aVertices;
604 // BRepMeshCol::MapOfInteger::Iterator aEdgeIt(aEdgeMap);
605 // for (; aEdgeIt.More(); aEdgeIt.Next())
607 // const BRepMesh_Edge& aEdge = aStructure->GetLink(aEdgeIt.Key());
608 // aVertices.Add(aEdge.FirstNode());
609 // aVertices.Add(aEdge.LastNode());
612 // BRepMeshCol::MapOfInteger::Iterator anIt(vtx);
613 // for ( ; anIt.More(); anIt.Next() )
614 // aVertexSeq.Append(anIt.Key());
622 //=======================================================================
625 //=======================================================================
627 static Standard_Integer medge (Draw_Interpretor&, Standard_Integer n, const char** a)
631 Handle(MeshTest_DrawableMesh) D =
632 Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
633 if (D.IsNull()) return 1;
635 Standard_Integer i,j,e;
636 TColStd_SequenceOfInteger& eseq = D->Edges();
637 for (i = 2; i < n; i++) {
638 e = Draw::Atoi(a[i]);
644 while (j <= eseq.Length()) {
660 //=======================================================================
663 //=======================================================================
665 static Standard_Integer mvertex (Draw_Interpretor&, Standard_Integer n, const char** a)
669 Handle(MeshTest_DrawableMesh) D =
670 Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
671 if (D.IsNull()) return 1;
673 Standard_Integer i,j,v;
674 TColStd_SequenceOfInteger& vseq = D->Vertices();
675 for (i = 2; i < n; i++) {
676 v = Draw::Atoi(a[i]);
682 while (j <= vseq.Length()) {
697 //=======================================================================
698 //function : triangle
700 //=======================================================================
702 static Standard_Integer triangle (Draw_Interpretor&, Standard_Integer n, const char** a)
706 Handle(MeshTest_DrawableMesh) D =
707 Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(a[1]));
708 if (D.IsNull()) return 1;
710 Standard_Integer i,j,v;
711 TColStd_SequenceOfInteger& tseq = D->Triangles();
712 for (i = 2; i < n; i++) {
713 v = Draw::Atoi(a[i]);
719 while (j <= tseq.Length()) {
733 //=======================================================================
734 //function : dumpvertex
736 //=======================================================================
739 Standard_Integer dumpvertex(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
741 if (argc < 2) return 1;
743 Handle(MeshTest_DrawableMesh) D =
744 Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(argv[1]));
745 if (D.IsNull()) return 1;
747 Handle(BRepMesh_DataStructureOfDelaun) struc = D->Mesh()->Result();
749 Standard_Integer in=1;
751 in=Draw::Atoi(argv[2]);
754 Standard_Integer nbn=in;
756 nbn=Draw::Atoi(argv[3]);
757 nbn=Min(nbn,struc->NbNodes());
760 for (; in<=nbn; in++) {
761 BRepMesh_Vertex nod=struc->GetNode(in);
762 di<<"(node "<<in<<" (uv "<<nod.Coord().X()
763 <<" "<<nod.Coord().Y()<<") (3d "
764 <<nod.Location3d()<<") ";
765 printdegree(nod.Movability(), di);
767 BRepMesh_ListOfInteger::Iterator tati(struc->LinkNeighboursOf(in));
768 for (; tati.More(); tati.Next()) di<<" "<<tati.Value();
775 //=======================================================================
776 //function : dumpedge
778 //=======================================================================
780 Standard_Integer dumpedge(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
782 if (argc < 2) return 1;
784 Handle(MeshTest_DrawableMesh) D =
785 Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(argv[1]));
786 if (D.IsNull()) return 1;
788 Handle(BRepMesh_DataStructureOfDelaun) struc=D->Mesh()->Result();
789 Standard_Integer il=1;
791 il=Draw::Atoi(argv[2]);
794 Standard_Integer nbl=il;
796 nbl=Draw::Atoi(argv[3]);
797 nbl=Min(nbl, struc->NbLinks());
800 for (; il<=nbl; il++) {
801 BRepMesh_Edge edg=struc->GetLink(il);
802 di << "(edge "<<il<<" ("<<edg.FirstNode()<<" "<<edg.LastNode()
804 printdegree(edg.Movability(), di);
806 const BRepMesh_PairOfIndex& pair = struc->ElemConnectedTo(il);
807 for (Standard_Integer j = 1, jn = pair.Extent(); j <= jn; j++)
808 di<<" "<<pair.Index(j);
815 //=======================================================================
816 //function : dumptriangle
818 //=======================================================================
820 Standard_Integer dumptriangle(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
822 if (argc < 2) return 1;
824 Handle(MeshTest_DrawableMesh) D =
825 Handle(MeshTest_DrawableMesh)::DownCast(Draw::Get(argv[1]));
826 if (D.IsNull()) return 1;
828 Handle(BRepMesh_DataStructureOfDelaun) struc=D->Mesh()->Result();
829 Standard_Integer ie=1;
831 ie=Draw::Atoi(argv[2]);
834 Standard_Integer nbe=ie;
836 nbe=Draw::Atoi(argv[3]);
837 nbe=Min(nbe, struc->NbElements());
840 Standard_Integer e1, e2, e3;
841 Standard_Boolean o1, o2, o3;
843 for (; ie<=nbe; ie++) {
844 BRepMesh_Triangle tri=struc->GetElement(ie);
845 tri.Edges(e1, e2, e3, o1, o2, o3);
849 di<<" (maille "<<ie<<" (links "<<e1<<" "
851 printdegree(tri.Movability(), di);
859 //=======================================================================
860 //function : trianglesinfo
862 //=======================================================================
863 static Standard_Integer trianglesinfo(Draw_Interpretor& di, Standard_Integer n, const char** a)
865 if (n != 2) return 1;
866 TopoDS_Shape S = DBRep::Get(a[1]);
867 if (S.IsNull()) return 1;
869 Handle(Poly_Triangulation) T;
872 Standard_Real MaxDeflection = 0.0;
873 Standard_Integer nbtriangles = 0, nbnodes = 0;
874 for (ex.Init(S, TopAbs_FACE); ex.More(); ex.Next()) {
875 TopoDS_Face F = TopoDS::Face(ex.Current());
876 T = BRep_Tool::Triangulation(F, L);
878 nbtriangles += T->NbTriangles();
879 nbnodes += T->NbNodes();
880 if (T->Deflection() > MaxDeflection)
881 MaxDeflection = T->Deflection();
886 di<<"This shape contains " <<nbtriangles<<" triangles."<<"\n";
887 di<<" " <<nbnodes <<" nodes."<<"\n";
888 di<<"Maximal deflection " <<MaxDeflection<<"\n";
890 #ifdef OCCT_DEBUG_MESH_CHRONO
891 Standard_Real tot, addp, unif, contr, inter;
892 Standard_Real edges, mailledges, etuinter, lastcontrol, stock;
893 Standard_Real add11, add12, add2, upda, pointvalid;
894 Standard_Real isos, pointsisos;
895 chTotal.Show(tot); chAddPoint.Show(addp); chUnif.Show(unif);
896 chControl.Show(contr); chInternal.Show(inter);
897 chEdges.Show(edges); chMaillEdges.Show(mailledges);
898 chEtuInter.Show(etuinter); chLastControl.Show(lastcontrol);
900 chAdd11.Show(add11); chAdd12.Show(add12); chAdd2.Show(add2); chUpdate.Show(upda);
901 chPointValid.Show(pointvalid); chIsos.Show(isos); chPointsOnIsos.Show(pointsisos);
904 di <<"temps total de maillage: "<<tot <<" seconds"<< "\n";
905 di <<"dont: "<< "\n";
906 di <<"discretisation des edges: "<<edges <<" seconds---> "<< 100*edges/tot <<" %"<<"\n";
907 di <<"maillage des edges: "<<mailledges <<" seconds---> "<< 100*mailledges/tot <<" %"<<"\n";
908 di <<"controle et points internes: "<<etuinter <<" seconds---> "<< 100*etuinter/tot <<" %"<<"\n";
909 di <<"derniers controles: "<<lastcontrol<<" seconds---> "<< 100*lastcontrol/tot<<" %"<<"\n";
910 di <<"stockage dans la S.D. "<<stock <<" seconds---> "<< 100*stock/tot <<" %"<<"\n";
912 di <<"et plus precisement: "<<"\n";
913 di <<"Add 11ere partie : "<<add11 <<" seconds---> "<<100*add11/tot <<" %"<<"\n";
914 di <<"Add 12ere partie : "<<add12 <<" seconds---> "<<100*add12/tot <<" %"<<"\n";
915 di <<"Add 2eme partie : "<<add2 <<" seconds---> "<<100*add2/tot <<" %"<<"\n";
916 di <<"Update : "<<upda <<" seconds---> "<<100*upda/tot <<" %"<<"\n";
917 di <<"AddPoint : "<<addp <<" seconds---> "<<100*addp/tot <<" %"<<"\n";
918 di <<"UniformDeflection "<<unif <<" seconds---> "<<100*unif/tot <<" %"<<"\n";
919 di <<"Controle : "<<contr <<" seconds---> "<<100*contr/tot <<" %"<<"\n";
920 di <<"Points Internes: "<<inter <<" seconds---> "<<100*inter/tot <<" %"<<"\n";
921 di <<"calcul des isos et du, dv: "<<isos <<" seconds---> "<<100*isos/tot <<" %"<<"\n";
922 di <<"calcul des points sur isos: "<<pointsisos<<" seconds---> "<<100*pointsisos/tot <<" %"<<"\n";
923 di <<"IsPointValid: "<<pointvalid<<" seconds---> "<<100*pointvalid/tot <<" %"<<"\n";
927 di <<"nombre d'appels de controle apres points internes : "<< NbControls << "\n";
928 di <<"nombre de points sur restrictions : "<< D0Edges << "\n";
929 di <<"nombre de points calcules par UniformDeflection : "<< D0Unif << "\n";
930 di <<"nombre de points calcules dans InternalVertices : "<< D0Internal << "\n";
931 di <<"nombre de points calcules dans Control : "<< D0Control << "\n";
932 if (nbnodes-D0Edges != 0) {
933 Standard_Real ratio = (Standard_Real)(D0Internal+D0Control)/ (Standard_Real)(nbnodes-D0Edges);
934 di <<"---> Ratio: (D0Internal+D0Control) / (nbNodes-nbOnEdges) : "<< ratio << "\n";
939 chTotal.Reset(); chAddPoint.Reset(); chUnif.Reset();
940 chControl.Reset(); chInternal.Reset();
941 chEdges.Reset(); chMaillEdges.Reset();
942 chEtuInter.Reset(); chLastControl.Reset();
944 chAdd11.Reset(); chAdd12.Reset(); chAdd2.Reset(); chUpdate.Reset();
945 chPointValid.Reset(); chIsos.Reset(); chPointsOnIsos.Reset();
952 //=======================================================================
953 //function : veriftriangles
955 //=======================================================================
957 static Standard_Integer veriftriangles(Draw_Interpretor& di, Standard_Integer n, const char** a)
960 Standard_Boolean quiet = 1;
961 if (n == 3) quiet = 0;
962 TopoDS_Shape Sh = DBRep::Get(a[1]);
963 if (Sh.IsNull()) return 1;
965 Handle(Poly_Triangulation) T;
967 Standard_Integer i, n1, n2, n3;
968 gp_Pnt2d mitri, v1, v2, v3, mi2d1, mi2d2, mi2d3;
969 gp_XYZ vecEd1, vecEd2, vecEd3;
970 // Standard_Real dipo, dm, dv, d1, d2, d3, defle;
971 Standard_Real dipo, dv, d1, d2, d3, defle;
972 Handle(Geom_Surface) S;
973 Standard_Integer nbface = 0;
976 for (ex.Init(Sh, TopAbs_FACE); ex.More(); ex.Next()) {
977 TopoDS_Face F = TopoDS::Face(ex.Current());
979 T = BRep_Tool::Triangulation(F, L);
980 Standard_Real deflemax = 0, deflemin = 1.e100;
982 Standard_Real defstock = T->Deflection();
983 const Poly_Array1OfTriangle& triangles = T->Triangles();
984 const TColgp_Array1OfPnt2d& Nodes2d = T->UVNodes();
985 const TColgp_Array1OfPnt& Nodes = T->Nodes();
987 S = BRep_Tool::Surface(F, L);
989 for(i = 1; i <= triangles.Length(); i++) {
990 if (F.Orientation() == TopAbs_REVERSED)
991 triangles(i).Get(n1,n3,n2);
993 triangles(i).Get(n1,n2,n3);
995 const gp_XY& xy1 = Nodes2d(n1).XY();
996 const gp_XY& xy2 = Nodes2d(n2).XY();
997 const gp_XY& xy3 = Nodes2d(n3).XY();
999 mi2d1.SetCoord((xy2.X()+xy3.X())*0.5,
1000 (xy2.Y()+xy3.Y())*0.5);
1001 mi2d2.SetCoord((xy1.X()+xy3.X())*0.5,
1002 (xy1.Y()+xy3.Y())*0.5);
1003 mi2d3.SetCoord((xy1.X()+xy2.X())*0.5,
1004 (xy1.Y()+xy2.Y())*0.5);
1006 gp_XYZ p1 = Nodes(n1).Transformed(L.Transformation()).XYZ();
1007 gp_XYZ p2 = Nodes(n2).Transformed(L.Transformation()).XYZ();
1008 gp_XYZ p3 = Nodes(n3).Transformed(L.Transformation()).XYZ();
1013 d1=vecEd1.SquareModulus();
1014 d2=vecEd2.SquareModulus();
1015 d3=vecEd3.SquareModulus();
1017 if (d1!=0. && d2!=0. && d3!=0.) {
1018 gp_XYZ equa(vecEd1^vecEd2);
1021 equa.SetCoord(equa.X()/dv, equa.Y()/dv, equa.Z()/dv);
1025 mitri.SetCoord(ONETHIRD*(xy1.X()+xy2.X()+xy3.X()),
1026 ONETHIRD*(xy1.Y()+xy2.Y()+xy3.Y()));
1027 v1.SetCoord(ONETHIRD*mi2d1.X()+TWOTHIRD*xy1.X(),
1028 ONETHIRD*mi2d1.Y()+TWOTHIRD*xy1.Y());
1029 v2.SetCoord(ONETHIRD*mi2d2.X()+TWOTHIRD*xy2.X(),
1030 ONETHIRD*mi2d2.Y()+TWOTHIRD*xy2.Y());
1031 v3.SetCoord(ONETHIRD*mi2d3.X()+TWOTHIRD*xy3.X(),
1032 ONETHIRD*mi2d3.Y()+TWOTHIRD*xy3.Y());
1034 S->D0(mi2d1.X(), mi2d1.Y(), PP);
1035 PP = PP.Transformed(L.Transformation());
1036 defle = Abs((equa*PP.XYZ())-dipo);
1037 deflemax = Max(deflemax, defle);
1038 deflemin = Min(deflemin, defle);
1040 S->D0(mi2d2.X(), mi2d2.Y(), PP);
1041 PP = PP.Transformed(L.Transformation());
1042 defle = Abs((equa*PP.XYZ())-dipo);
1043 deflemax = Max(deflemax, defle);
1044 deflemin = Min(deflemin, defle);
1046 S->D0(mi2d3.X(), mi2d3.Y(), PP);
1047 PP = PP.Transformed(L.Transformation());
1048 defle = Abs((equa*PP.XYZ())-dipo);
1049 deflemax = Max(deflemax, defle);
1050 deflemin = Min(deflemin, defle);
1052 S->D0(v1.X(), v1.Y(), PP);
1053 PP = PP.Transformed(L.Transformation());
1054 defle = Abs((equa*PP.XYZ())-dipo);
1055 deflemax = Max(deflemax, defle);
1056 deflemin = Min(deflemin, defle);
1058 S->D0(v2.X(), v2.Y(), PP);
1059 PP = PP.Transformed(L.Transformation());
1060 defle = Abs((equa*PP.XYZ())-dipo);
1061 deflemax = Max(deflemax, defle);
1062 deflemin = Min(deflemin, defle);
1064 S->D0(v3.X(), v3.Y(), PP);
1065 PP = PP.Transformed(L.Transformation());
1066 defle = Abs((equa*PP.XYZ())-dipo);
1067 deflemax = Max(deflemax, defle);
1068 deflemin = Min(deflemin, defle);
1070 S->D0(mitri.X(), mitri.Y(), PP);
1071 PP = PP.Transformed(L.Transformation());
1072 defle = Abs((equa*PP.XYZ())-dipo);
1073 deflemax = Max(deflemax, defle);
1074 deflemin = Min(deflemin, defle);
1076 if (defle > defstock) {
1077 di <<"face "<< nbface <<" deflection = " << defle <<" pour "<<defstock <<" stockee."<<"\n";
1083 di <<"face "<< nbface<<", deflemin = "<< deflemin<<", deflemax = "<<deflemax<<"\n";
1096 //=======================================================================
1099 //=======================================================================
1101 Standard_Integer tri2d(Draw_Interpretor&, Standard_Integer n, const char** a)
1104 if (n != 2) return 1;
1105 TopoDS_Shape aLocalShape = DBRep::Get(a[1]);
1106 TopoDS_Face F = TopoDS::Face(aLocalShape);
1107 // TopoDS_Face F = TopoDS::Face(DBRep::Get(a[1]));
1108 if (F.IsNull()) return 1;
1109 Handle(Poly_Triangulation) T;
1112 T = BRep_Tool::Triangulation(F, L);
1114 // Build the connect tool
1117 Standard_Integer i,j, nFree, nInternal, nbTriangles = T->NbTriangles();
1118 Standard_Integer t[3];
1120 // count the free edges
1122 for (i = 1; i <= nbTriangles; i++) {
1123 pc.Triangles(i,t[0],t[1],t[2]);
1124 for (j = 0; j < 3; j++)
1125 if (t[j] == 0) nFree++;
1128 // allocate the arrays
1129 TColStd_Array1OfInteger Free(1,2*nFree);
1130 nInternal = (3*nbTriangles - nFree) / 2;
1131 TColStd_Array1OfInteger Internal(0,2*nInternal);
1133 Standard_Integer fr = 1, in = 1;
1134 const Poly_Array1OfTriangle& triangles = T->Triangles();
1135 Standard_Integer nodes[3];
1136 for (i = 1; i <= nbTriangles; i++) {
1137 pc.Triangles(i,t[0],t[1],t[2]);
1138 triangles(i).Get(nodes[0],nodes[1],nodes[2]);
1139 for (j = 0; j < 3; j++) {
1140 Standard_Integer k = (j+1) % 3;
1142 Free(fr) = nodes[j];
1143 Free(fr+1) = nodes[k];
1146 // internal edge if this triangle has a lower index than the adjacent
1147 else if (i < t[j]) {
1148 Internal(in) = nodes[j];
1149 Internal(in+1) = nodes[k];
1155 // Display the edges
1156 if (T->HasUVNodes()) {
1157 const TColgp_Array1OfPnt2d& Nodes2d = T->UVNodes();
1159 Handle(Draw_Segment2D) Seg;
1162 Standard_Integer nn;
1163 nn = Free.Length() / 2;
1164 for (i = 1; i <= nn; i++) {
1165 Seg = new Draw_Segment2D(Nodes2d(Free(2*i-1)),
1174 for (i = 1; i <= nn; i++) {
1175 Seg = new Draw_Segment2D(Nodes2d(Internal(2*i-1)),
1176 Nodes2d(Internal(2*i)),
1190 //=======================================================================
1191 //function : wavefront
1193 //=======================================================================
1195 static Standard_Integer wavefront(Draw_Interpretor&, Standard_Integer nbarg, const char** argv)
1197 if (nbarg < 2) return 1;
1199 TopoDS_Shape S = DBRep::Get(argv[1]);
1200 if (S.IsNull()) return 1;
1202 // creation du maillage s'il n'existe pas.
1205 Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
1206 BRepBndLib::Add(S, B);
1207 B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
1208 Standard_Real aDeflection =
1209 MAX3( aXmax-aXmin , aYmax-aYmin , aZmax-aZmin) * 0.004;
1211 BRepMesh_IncrementalMesh aMesh (S, aDeflection);
1217 Standard_Integer i, nbface = 0;
1218 Standard_Boolean OK = Standard_True;
1220 gp_Vec D2U,D2V,D2UV;
1224 CSLib_DerivativeStatus Status;
1225 CSLib_NormalStatus NStat;
1226 Standard_Real x, y, z;
1227 Standard_Integer n1, n2, n3;
1228 Standard_Integer k1, k2, k3;
1233 strcpy(ffile, argv[2]);
1234 strcat(ffile, ".obj");
1236 else strcpy(ffile, "wave.obj");
1237 FILE* outfile = fopen(ffile, "w");
1240 fprintf(outfile, "%s %s\n%s %s\n\n", "# CASCADE ","MATRA DATAVISION", "#", ffile);
1242 Standard_Integer nbNodes, totalnodes = 0, nbpolygons = 0;
1243 for (ex.Init(S, TopAbs_FACE); ex.More(); ex.Next()) {
1245 TopoDS_Face F = TopoDS::Face(ex.Current());
1246 Handle(Poly_Triangulation) Tr = BRep_Tool::Triangulation(F, L);
1249 nbNodes = Tr->NbNodes();
1250 const TColgp_Array1OfPnt& Nodes = Tr->Nodes();
1253 for (i = 1; i <= nbNodes; i++) {
1254 gp_Pnt Pnt = Nodes(i).Transformed(L.Transformation());
1258 fprintf(outfile, "%s %f %f %f\n", "v", x, y, z);
1261 fprintf(outfile, "\n%s %d\n\n", "# number of vertex", nbNodes);
1266 if (Tr->HasUVNodes()) {
1267 const TColgp_Array1OfPnt2d& UVNodes = Tr->UVNodes();
1268 BRepAdaptor_Surface BS(F, Standard_False);
1270 for (i = 1; i <= nbNodes; i++) {
1274 BS.D1(U,V,P,D1U,D1V);
1275 CSLib::Normal(D1U,D1V,Precision::Angular(),Status,Nor);
1276 if (Status != CSLib_Done) {
1277 BS.D2(U,V,P,D1U,D1V,D2U,D2V,D2UV);
1278 CSLib::Normal(D1U,D1V,D2U,D2V,D2UV,Precision::Angular(),OK,NStat,Nor);
1280 if (F.Orientation() == TopAbs_REVERSED) Nor.Reverse();
1282 fprintf(outfile, "%s %f %f %f\n", "vn", Nor.X(), Nor.Y(), Nor.Z());
1285 fprintf(outfile, "\n%s %d\n\n", "# number of vertex normals", nbNodes);
1288 fprintf(outfile, "%s %d\n", "s", nbface);
1291 Standard_Integer nbTriangles = Tr->NbTriangles();
1292 const Poly_Array1OfTriangle& triangles = Tr->Triangles();
1295 for (i = 1; i <= nbTriangles; i++) {
1296 if (F.Orientation() == TopAbs_REVERSED)
1297 triangles(i).Get(n1, n3, n2);
1299 triangles(i).Get(n1, n2, n3);
1303 fprintf(outfile, "%s %d%s%d %d%s%d %d%s%d\n", "fo", k1,"//", k1, k2,"//", k2, k3,"//", k3);
1305 nbpolygons += nbTriangles;
1306 totalnodes += nbNodes;
1308 fprintf(outfile, "\n%s %d\n", "# number of smooth groups", nbface);
1309 fprintf(outfile, "\n%s %d\n", "# number of polygons", nbpolygons);
1320 //=======================================================================
1321 //function : onetriangulation
1323 //=======================================================================
1325 Standard_Integer onetriangulation(Draw_Interpretor&, Standard_Integer /*nbarg*/, const char** /*argv*/)
1330 if (nbarg < 2) return 1;
1332 TopoDS_Shape S = DBRep::Get(argv[1]);
1333 if (S.IsNull()) return 1;
1335 Handle(Poly_Triangulation) TFinale;
1337 Standard_Integer nbshell = 0;
1339 TopExp_Explorer ex, exs, ex2;
1341 for (ex.Init(S, TopAbs_SHELL); ex.More(); ex.Next()) {
1343 TopoDS_Shell Sh = TopoDS::Shell(ex.Current());
1345 for (exs.Init(Sh, TopAbs_Face); exs.More(); exs.Next()) {
1346 TopoDS_Face F = TopoDS::Face(exs.Current());
1347 Handle(Poly_Triangulation) T = BRep_Tool::Triangulation(F, L);
1349 for (ex2.Init(F, TopAbs_EDGE); ex2.More(); ex2.Next()) {
1350 TopoDS_Edge edge = TopoDS::Edge(ex2.Current());
1351 const TColgp_Array1OfPnt& Nodes = T->Nodes();
1352 const Poly_Array1OfTriangle& triangles = T->Triangles();
1354 if (mapedges.IsBound(edge)) {
1355 const TColStd_ListOfTransient& L = edges.Find(edge);
1356 const Handle(Poly_PolygonOnTriangulation)& P =
1357 *(Handle(Poly_PolygonOnTriangulation)*)&(L.First());
1358 const TColStd_Array1OfInteger& NOD = P->Nodes();
1364 Sprintf(name, "%s_%i", "tr", nbshell);
1365 DrawTrSurf::Set(name, TFinale);
1376 //=======================================================================
1379 //=======================================================================
1381 Standard_Integer vb(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
1383 Standard_Integer NbPoints = 1, Deg = 1;
1385 for (Deg = 1; Deg <= 25; Deg++) {
1386 for (NbPoints = 1; NbPoints <= 24; NbPoints++) {
1388 math_Vector GaussP(1, NbPoints), GaussW(1, NbPoints);
1389 math_Vector TheWeights(1, NbPoints), VBParam(1, NbPoints);
1390 math_Matrix VB(1, Deg+1, 1, NbPoints);
1392 math::GaussPoints(NbPoints, GaussP);
1394 Standard_Integer i, j, classe = Deg+1, cl1 = Deg;
1396 // calcul et mise en ordre des parametres et des poids:
1397 for (i = 1; i <= NbPoints; i++) {
1398 if (i <= (NbPoints+1)/2) {
1399 VBParam(NbPoints-i+1) = 0.5*(1 + GaussP(i));
1402 VBParam(i-(NbPoints+1)/2) = 0.5*(1 + GaussP(i));
1407 // Calcul du VB (Valeur des fonctions de Bernstein):
1408 for (i = 1; i <= classe; i++) {
1409 for (j = 1; j <= NbPoints; j++) {
1410 VB(i,j)=PLib::Binomial(cl1,i-1)*Pow((1-VBParam(j)),classe-i)*Pow(VBParam(j),i-1);
1415 for (i = 1; i <= classe; i++) {
1416 for (j = 1; j <= NbPoints; j++) {
1417 di<< VB(i, j) << ", ";
1425 //=======================================================================
1426 //function : extrema
1428 //=======================================================================
1430 Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
1434 Handle(Geom_Curve) C = DrawTrSurf::GetCurve(argv[1]);
1436 Standard_Real X, Y, Z, U0;
1437 X = Draw::Atof(argv[2]);
1438 Y = Draw::Atof(argv[3]);
1439 Z = Draw::Atof(argv[4]);
1440 U0 = Draw::Atof(argv[5]);
1443 GeomAdaptor_Curve GC(C);
1444 Standard_Real tol = 1.e-09;
1445 Extrema_LocateExtPC ext(P, GC, U0, tol);
1448 gp_Pnt P1 = ext.Point().Value();
1449 di <<"distance = "<<ext.Value() << "\n";
1450 di <<"point = "<<P1.X()<<" "<<P1.Y()<<" "<< P1.Z()<< "\n";
1451 di <<"parametre = "<<ext.Point().Parameter()<<"\n";
1460 //=======================================================================
1461 //function : triedgepoints
1463 //=======================================================================
1465 Standard_Integer triedgepoints(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
1470 for( Standard_Integer i = 1; i < nbarg; i++ )
1472 TopoDS_Shape aShape = DBRep::Get(argv[i]);
1473 if ( aShape.IsNull() )
1476 Handle(Poly_PolygonOnTriangulation) aPoly;
1477 Handle(Poly_Triangulation) aT;
1478 TopLoc_Location aLoc;
1479 TopTools_MapOfShape anEdgeMap;
1480 TopTools_MapIteratorOfMapOfShape it;
1482 if( aShape.ShapeType() == TopAbs_EDGE )
1484 anEdgeMap.Add( aShape );
1488 TopExp_Explorer ex(aShape, TopAbs_EDGE);
1489 for(; ex.More(); ex.Next() )
1490 anEdgeMap.Add( ex.Current() );
1493 if ( anEdgeMap.Extent() == 0 )
1497 strcpy(newname,argv[i]);
1499 while (*p != '\0') p++;
1503 Standard_Integer nbEdge = 1;
1504 for(it.Initialize(anEdgeMap); it.More(); it.Next())
1506 BRep_Tool::PolygonOnTriangulation(TopoDS::Edge(it.Key()), aPoly, aT, aLoc);
1507 if ( aT.IsNull() || aPoly.IsNull() )
1510 const TColgp_Array1OfPnt& Nodes = aT->Nodes();
1511 const TColStd_Array1OfInteger& Indices = aPoly->Nodes();
1512 const Standard_Integer nbnodes = Indices.Length();
1514 for( Standard_Integer j = 1; j <= nbnodes; j++ )
1516 gp_Pnt P3d = Nodes(Indices(j));
1517 if( !aLoc.IsIdentity() )
1518 P3d.Transform(aLoc.Transformation());
1520 if( anEdgeMap.Extent() > 1 )
1521 Sprintf(p,"%d_%d",nbEdge,j);
1524 DBRep::Set( newname, BRepBuilderAPI_MakeVertex(P3d) );
1525 di.AppendElement(newname);
1533 //=======================================================================
1534 void MeshTest::Commands(Draw_Interpretor& theCommands)
1535 //=======================================================================
1537 Draw::Commands(theCommands);
1538 BRepTest::AllCommands(theCommands);
1539 GeometryTest::AllCommands(theCommands);
1540 MeshTest::PluginCommands(theCommands);
1543 g = "Mesh Commands";
1545 theCommands.Add("incmesh","incmesh shape deflection [inParallel (0/1) : 0 by default]",__FILE__, incrementalmesh, g);
1546 theCommands.Add("MemLeakTest","MemLeakTest",__FILE__, MemLeakTest, g);
1547 theCommands.Add("fastdiscret","fastdiscret shape deflection [shared [nbiter]]",__FILE__, fastdiscret, g);
1548 theCommands.Add("mesh","mesh result Shape deflection",__FILE__, triangule, g);
1549 theCommands.Add("addshape","addshape meshname Shape [deflection]",__FILE__, addshape, g);
1550 //theCommands.Add("smooth","smooth meshname",__FILE__, smooth, g);
1551 //theCommands.Add("edges","edges mesh shape, highlight the edges",__FILE__,edges, g);
1552 theCommands.Add("vertices","vertices mesh shape, highlight the vertices",__FILE__,vertices, g);
1553 theCommands.Add("medge","medge mesh [-]index (0 to clear all)",__FILE__,medge, g);
1554 theCommands.Add("mvertex","mvertex mesh [-]index (0 to clear all)",__FILE__,mvertex, g);
1555 theCommands.Add("triangle","triangle mesh [-]index (0 to clear all)",__FILE__,triangle, g);
1556 //theCommands.Add("dumpvertex","dumpvertex mesh [index]",__FILE__,dumpvertex, g);
1557 //theCommands.Add("dumpedge","dumpedge mesh [index]",__FILE__,dumpedge, g);
1558 //theCommands.Add("dumptriangle","dumptriangle mesh [index]",__FILE__,dumptriangle, g);
1560 theCommands.Add("tri2d", "tri2d facename",__FILE__, tri2d, g);
1561 theCommands.Add("trinfo","trinfo name, print triangles information on objects",__FILE__,trianglesinfo,g);
1562 theCommands.Add("veriftriangles","veriftriangles name, verif triangles",__FILE__,veriftriangles,g);
1563 theCommands.Add("wavefront","wavefront name",__FILE__, wavefront, g);
1564 theCommands.Add("onetriangulation","onetriangulation name",__FILE__, onetriangulation, g);
1565 theCommands.Add("triepoints", "triepoints shape1 [shape2 ...]",__FILE__, triedgepoints, g);
1568 theCommands.Add("extrema","extrema ",__FILE__, extrema, g);
1569 theCommands.Add("vb","vb ",__FILE__, vb, g);