28 #ifndef StdMeshers_FaceSide_HeaderFile
29 #define StdMeshers_FaceSide_HeaderFile
35 #include <Geom2d_Curve.hxx>
36 #include <GeomAdaptor_Curve.hxx>
37 #include <TopoDS_Edge.hxx>
38 #include <TopoDS_Face.hxx>
39 #include <TopoDS_Vertex.hxx>
40 #include <gp_Pnt2d.hxx>
44 #include <boost/shared_ptr.hpp>
48 class BRepAdaptor_CompCurve;
55 typedef boost::shared_ptr< SMESH_ComputeError >
TError;
70 enum { ALL_EDGES = -1, LAST_EDGE = -1 };
76 const TopoDS_Edge& theEdge,
78 const bool theIsForward,
79 const bool theIgnoreMediumNodes,
86 std::list<TopoDS_Edge>& theEdges,
88 const bool theIsForward,
89 const bool theIgnoreMediumNodes,
97 const gp_Pnt2d* thePnt2d1,
98 const gp_Pnt2d* thePnt2d2 = NULL,
99 const Handle(Geom2d_Curve)& theC2d = NULL,
100 const double theUFirst = 0.,
101 const double theULast = 1.);
106 const TopoDS_Face& theFace = TopoDS_Face(),
107 const TopoDS_Edge& theEdge = TopoDS_Edge(),
114 const TopoDS_Edge&
Edge,
116 const bool IsForward,
117 const bool IgnoreMediumNodes,
121 (
new StdMeshers_FaceSide( Face,Edge,Mesh,IsForward,IgnoreMediumNodes,FaceHelper,ProxyMesh ));
124 std::list<TopoDS_Edge>& Edges,
126 const bool IsForward,
127 const bool IgnoreMediumNodes,
131 (
new StdMeshers_FaceSide( Face,Edges,Mesh,IsForward,IgnoreMediumNodes,FaceHelper,ProxyMesh ));
135 const gp_Pnt2d* Pnt2d1,
136 const gp_Pnt2d* Pnt2d2 = NULL,
137 const Handle(Geom2d_Curve)& C2d = NULL,
138 const double UFirst = 0.,
139 const double ULast = 1.)
144 const TopoDS_Face& theFace = TopoDS_Face())
152 static TSideVector GetFaceWires(
const TopoDS_Face& theFace,
154 const bool theIgnoreMediumNodes,
158 const bool theCheckVertexNodes =
true);
166 void SetIgnoreMediumNodes(
bool toIgnore);
173 int NbPoints(
const bool update =
false)
const;
179 int NbSegments(
const bool update =
false)
const;
197 const UVPtStructVec& GetUVPtStruct(
bool isXConst = 0,
double constValue = 0 )
const;
205 double constValue = 0)
const;
211 std::vector<const SMDS_MeshNode*> GetOrderedNodes(
int iE = ALL_EDGES )
const;
219 std::vector<const SMDS_MeshNode*>& nodes,
220 bool inlude1stVertex=
true,
221 bool inludeLastVertex=
true)
const;
227 const SMDS_MeshNode* VertexNode(std::size_t i,
bool* isMoved = 0)
const;
232 inline double Parameter(
double U, TopoDS_Edge & edge)
const;
236 inline double Parameter(
double U,
int & edgeID)
const;
240 gp_Pnt2d Value2d(
double U)
const;
244 gp_Pnt Value3d(
double U)
const;
252 BRepAdaptor_CompCurve* GetCurve3d()
const;
260 const TopoDS_Edge&
Edge(
int i)
const {
return myEdge[i]; }
264 const std::vector<TopoDS_Edge>&
Edges()
const {
return myEdge; }
268 const TopoDS_Face&
Face()
const {
return myFace; }
272 TopoDS_Vertex FirstVertex(
int i=0)
const;
276 TopoDS_Vertex LastVertex(
int i = LAST_EDGE)
const;
280 bool IsClosed()
const;
284 double Length()
const {
return myLength; }
288 inline int EdgeIndex(
double U )
const;
290 void dump(
const char* msg=0)
const;
295 inline int EdgeID(
int i)
const;
299 inline Handle(Geom2d_Curve) Curve2d(
int i) const;
303 inline
double FirstParameter(
int i) const;
307 inline
double LastParameter(
int i) const;
312 inline
double FirstU(
int i) const;
317 inline
double LastU(
int i) const;
321 inline
double EdgeLength(
int i) const;
325 inline
bool IsReversed(
int i) const;
333 void reverseProxySubmesh( const TopoDS_Edge& E );
338 std::vector<TopoDS_Edge> myEdge;
339 std::vector<
int> myEdgeID;
341 std::vector<GeomAdaptor_Curve> myC3dAdaptor;
342 std::vector<
double> myFirst, myLast;
343 std::vector<
double> myNormPar;
344 std::vector<
double> myEdgeLength;
345 std::vector<
int> myIsUniform;
347 int myNbPonits, myNbSegments;
349 bool myMissingVertexNodes, myIgnoreMediumNodes;
350 gp_Pnt2d myDefaultPnt2d;
365 int i = myNormPar.size() - 1;
366 while ( i > 0 && U < myNormPar[ i-1 ] ) --i;
382 int i = EdgeIndex( U );
384 double prevU = i ? myNormPar[ i-1 ] : 0;
385 double r = ( U - prevU )/ ( myNormPar[ i ] - prevU );
386 return myFirst[i] * ( 1 - r ) + myLast[i] * r;
401 int i = EdgeIndex( U );
402 edgeID = myEdgeID[ i ];
403 double prevU = i ? myNormPar[ i-1 ] : 0;
404 double r = ( U - prevU )/ ( myNormPar[ i ] - prevU );
405 return myFirst[i] * ( 1 - r ) + myLast[i] * r;
416 return i==0 ? 0. : i<(
int)myNormPar.size() ? myNormPar[i-1] : 1.;
427 return i < (
int)myNormPar.size() ? myNormPar[i] : 1;
438 return myFirst[ i % myFirst.size() ];
449 return myLast[ i % myLast.size() ];
460 return myEdgeID[ i % myEdgeID.size() ];
471 return myC2d[ i % myC2d.size() ];
482 return myEdgeLength[ i % myEdgeLength.size() ];
493 return myFirst[i] > myLast[i];