Warning, file /include/opencascade/BRepBuilderAPI_FastSewing.hxx was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _BRepBuilderAPI_FastSewing_HeaderFile
0017 #define _BRepBuilderAPI_FastSewing_HeaderFile
0018
0019 #include <Standard_Transient.hxx>
0020 #include <BRep_Builder.hxx>
0021
0022 #include <NCollection_List.hxx>
0023 #include <NCollection_Sequence.hxx>
0024 #include <NCollection_Vector.hxx>
0025 #include <NCollection_CellFilter.hxx>
0026
0027 #include <TopoDS_Edge.hxx>
0028 #include <TopoDS_Face.hxx>
0029 #include <TopoDS_Vertex.hxx>
0030 #include <TopoDS_Wire.hxx>
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 class BRepBuilderAPI_FastSewing : public Standard_Transient
0047 {
0048 public:
0049 typedef unsigned int FS_VARStatuses;
0050
0051
0052
0053
0054 enum FS_Statuses
0055 {
0056 FS_OK = 0x00000000,
0057 FS_Degenerated = 0x00000001,
0058 FS_FindVertexError = 0x00000002,
0059 FS_FindEdgeError = 0x00000004,
0060 FS_FaceWithNullSurface = 0x00000008,
0061 FS_NotNaturalBoundsFace = 0x00000010,
0062 FS_InfiniteSurface = 0x00000020,
0063 FS_EmptyInput = 0x00000040,
0064 FS_Exception = 0x00000080
0065 };
0066
0067
0068
0069 Standard_EXPORT BRepBuilderAPI_FastSewing(const Standard_Real theTolerance = 1.0e-06);
0070
0071
0072 Standard_EXPORT Standard_Boolean Add(const TopoDS_Shape& theShape);
0073
0074
0075 Standard_EXPORT Standard_Boolean Add(const Handle(Geom_Surface)& theSurface);
0076
0077
0078 Standard_EXPORT void Perform (void) ;
0079
0080
0081 void SetTolerance (const Standard_Real theToler)
0082 {
0083 myTolerance = theToler;
0084 }
0085
0086
0087 Standard_Real GetTolerance() const
0088 {
0089 return myTolerance;
0090 }
0091
0092
0093 const TopoDS_Shape& GetResult() const
0094 {
0095 return myResShape;
0096 }
0097
0098
0099 Standard_EXPORT FS_VARStatuses GetStatuses(Standard_OStream* const theOS = 0);
0100
0101 DEFINE_STANDARD_RTTIEXT(BRepBuilderAPI_FastSewing,Standard_Transient)
0102
0103 protected:
0104 class NodeInspector;
0105
0106 Standard_EXPORT void FindVertexes(const Standard_Integer theSurfID,
0107 NCollection_CellFilter<NodeInspector>& theCells);
0108 Standard_EXPORT void FindEdges(const Standard_Integer theSurfID);
0109 Standard_EXPORT void UpdateEdgeInfo(const Standard_Integer theIDPrevVertex,
0110 const Standard_Integer theIDCurrVertex,
0111 const Standard_Integer theFaceID,
0112 const Standard_Integer theIDCurvOnFace);
0113 Standard_EXPORT void CreateNewEdge( const Standard_Integer theIDPrevVertex,
0114 const Standard_Integer theIDCurrVertex,
0115 const Standard_Integer theFaceID,
0116 const Standard_Integer theIDCurvOnFace);
0117
0118 Standard_EXPORT Standard_Real Compute3DRange();
0119
0120
0121 FS_VARStatuses SetStatus(FS_Statuses theStatus)
0122 {
0123 const FS_VARStatuses aStatusID = (FS_VARStatuses)(theStatus);
0124 myStatusList |= aStatusID;
0125 return aStatusID;
0126 }
0127
0128 class FS_Edge;
0129
0130
0131
0132
0133
0134 struct FS_Vertex
0135 {
0136 public:
0137 FS_Vertex(): myID(-1){};
0138
0139
0140 void CreateTopologicalVertex(const Standard_Real theToler)
0141 {
0142 BRep_Builder aBuilder;
0143 aBuilder.MakeVertex(myTopoVert, myPnt, theToler);
0144 }
0145
0146
0147 gp_Pnt myPnt;
0148 TopoDS_Vertex myTopoVert;
0149
0150
0151 NCollection_List<Standard_Integer> myFaces;
0152 NCollection_List<Standard_Integer> myEdges;
0153
0154
0155
0156 Standard_Integer myID;
0157 };
0158
0159
0160 struct FS_Face
0161 {
0162 FS_Face(): myID(-1)
0163 {
0164 for (Standard_Integer i = 0; i < 4; i++)
0165 {
0166 myVertices[i] = -1;
0167 myEdges[i] = -1;
0168 }
0169 };
0170
0171 void CreateTopologicalWire(const NCollection_Vector<FS_Edge>& theEdgeVec,
0172 const Standard_Real theToler);
0173 void CreateTopologicalFace();
0174
0175
0176 void SetVertex(const Standard_Integer thePlaceID, const Standard_Integer theVertID)
0177 {
0178 Standard_RangeError_Raise_if((thePlaceID < 0) || (thePlaceID > 3),
0179 "FS_Face::SetVertex(): OUT of Range");
0180
0181 myVertices[thePlaceID] = theVertID;
0182 }
0183
0184
0185 void SetEdge(const Standard_Integer thePlaceID, const Standard_Integer theEdgeID)
0186 {
0187 Standard_RangeError_Raise_if((thePlaceID < 0) || (thePlaceID > 3),
0188 "FS_Face::SetEdge(): OUT of Range");
0189
0190 myEdges[thePlaceID] = theEdgeID;
0191 }
0192
0193 TopoDS_Face mySrcFace;
0194 TopoDS_Wire myWire;
0195 TopoDS_Face myRetFace;
0196
0197
0198
0199
0200 Standard_Integer myEdges[4];
0201
0202 Standard_Integer myVertices[4];
0203
0204
0205
0206 Standard_Integer myID;
0207 };
0208
0209
0210 class FS_Edge
0211 {
0212 public:
0213 FS_Edge(): myID(-1)
0214 {
0215 myVertices[0] = -1;
0216 myVertices[1] = -1;
0217 }
0218
0219 FS_Edge(const Standard_Integer theIDVert1, const Standard_Integer theIDVert2): myID(-1)
0220 {
0221 myVertices[0] = theIDVert1;
0222 myVertices[1] = theIDVert2;
0223 };
0224
0225
0226 void CreateTopologicalEdge( const NCollection_Vector<FS_Vertex>& theVertexVec,
0227 const NCollection_Vector<FS_Face>& theFaceVec,
0228 const Standard_Real theTol);
0229
0230
0231 void SetVertex(const Standard_Integer thePlaceID, const Standard_Integer theVertID)
0232 {
0233 Standard_RangeError_Raise_if((thePlaceID < 0) || (thePlaceID > 1),
0234 "FS_Face::SetVertex(): OUT of Range");
0235
0236 myVertices[thePlaceID] = theVertID;
0237 }
0238
0239 Standard_Boolean IsDegenerated() const
0240 {
0241 return (myVertices[0] == myVertices[1]);
0242 }
0243
0244
0245
0246 NCollection_Sequence<Standard_Integer> myFaces;
0247
0248
0249
0250 Standard_Integer myID;
0251
0252 TopoDS_Edge myTopoEdge;
0253 private:
0254
0255 Standard_Integer myVertices[2];
0256 };
0257
0258
0259
0260 class NodeInspector: public NCollection_CellFilter_InspectorXYZ
0261 {
0262 public:
0263 typedef Standard_Integer Target;
0264
0265 NodeInspector(const NCollection_Vector<FS_Vertex>& theVec,
0266 const gp_Pnt& thePnt, const Standard_Real theTol);
0267
0268 Standard_EXPORT NCollection_CellFilter_Action Inspect (const Target theId);
0269
0270 Target GetResult()
0271 {
0272 return myResID;
0273 }
0274
0275 private:
0276 NodeInspector& operator = (const NodeInspector&);
0277 const NCollection_Vector<FS_Vertex>& myVecOfVertexes;
0278 gp_Pnt myPoint;
0279 Standard_Real mySQToler;
0280 Target myResID;
0281 Standard_Boolean myIsFindingEnable;
0282 };
0283 private:
0284 TopoDS_Shape myResShape;
0285
0286
0287
0288
0289 NCollection_Vector<FS_Face> myFaceVec;
0290
0291 NCollection_Vector<FS_Vertex> myVertexVec;
0292
0293 NCollection_Vector<FS_Edge> myEdgeVec;
0294
0295
0296 Standard_Real myTolerance;
0297
0298
0299 FS_VARStatuses myStatusList;
0300 };
0301
0302 DEFINE_STANDARD_HANDLE(BRepBuilderAPI_FastSewing, Standard_Transient)
0303
0304 #endif