- void MeshShape(const TopoDS_Shape theShape,
- float& theDeflection,
- bool theForced ) {
-
- Standard_Real aDeflection = theDeflection <= 0 ? DEFAULT_DEFLECTION : theDeflection;
-
- //If deflection <= 0, than return default deflection
- if(theDeflection <= 0)
- theDeflection = aDeflection;
-
- // Is shape triangulated?
- Standard_Boolean alreadymeshed = Standard_True;
- TopExp_Explorer ex;
- TopLoc_Location aLoc;
- for (ex.Init(theShape, TopAbs_FACE); ex.More(); ex.Next()) {
- const TopoDS_Face& aFace = TopoDS::Face(ex.Current());
- Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc);
- if(aPoly.IsNull()) {
- alreadymeshed = Standard_False;
- break;
- }
- }
-
- if(!alreadymeshed || theForced) {
- Bnd_Box B;
- BRepBndLib::Add(theShape, B);
- if ( B.IsVoid() )
- return; // NPAL15983 (Bug when displaying empty groups)
- Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
- B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
-
- // This magic line comes from Prs3d_ShadedShape.gxx in OCCT
- aDeflection = MAX3(aXmax-aXmin, aYmax-aYmin, aZmax-aZmin) * aDeflection * 4;
-
- //Clean triangulation before compute incremental mesh
- BRepTools::Clean(theShape);
-
- //Compute triangulation
- BRepMesh_IncrementalMesh MESH(theShape,aDeflection);
- }
- }
-
- void SetShape(const TopoDS_Shape& theShape,
- const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
- bool theIsVector,
- GEOM_VertexSource* theStandaloneVertexSource,
- GEOM_EdgeSource* theIsolatedEdgeSource,
- GEOM_EdgeSource* theOneFaceEdgeSource,
- GEOM_EdgeSource* theSharedEdgeSource,
- GEOM_WireframeFace* theWireframeFaceSource,
- GEOM_ShadingFace* theShadingFaceSource)
+ void ShapeToVTK( const TopoDS_Shape& theShape,
+ const TopTools_IndexedDataMapOfShapeListOfShape& theEdgeMap,
+ bool theIsVector,
+ GEOM_VertexSource* theStandaloneVertexSource,
+ GEOM_EdgeSource* theIsolatedEdgeSource,
+ GEOM_EdgeSource* theOneFaceEdgeSource,
+ GEOM_EdgeSource* theSharedEdgeSource,
+ GEOM_WireframeFace* theWireframeFaceSource,
+ GEOM_ShadingFace* theShadingFaceSource )