Defines an edge. More...
#include <cadex/ModelData_Edge.hxx>
Public Member Functions  
ModelData_Edge (const ModelData_Vertex &theStartVertex, const ModelData_Vertex &theEndVertex)  
Constructor.  
void  SetCurve (const ModelData_Curve &theCurve, double theFirstParameter, double theLastParameter) 
Specifies 3D curve of the edge.  
bool  SetCurve (const ModelData_Curve &theCurve) 
Specifies 3D curve of the edge.  
void  SetPCurve (const ModelData_Curve2d &thePCurve, const ModelData_Face &theFace, double theFirstParameter, double theLastParameter) 
Specifies pcurve of the edge on the specified face.  
bool  SetPCurve (const ModelData_Curve2d &thePCurve, const ModelData_Face &theFace) 
Specifies pcurve of the edge on the specified face.  
void  SetPCurve (const ModelData_Curve2d &thePCurveForward, const ModelData_Curve2d &thePCurveReversed, const ModelData_Face &theFace, double theFirstParameter, double theLastParameter) 
Specifies pcurves of the seamedge on the specified face.  
bool  SetPCurve (const ModelData_Curve2d &thePCurveForward, const ModelData_Curve2d &thePCurveReversed, const ModelData_Face &theFace) 
Specifies pcurves of the seamedge on the specified face.  
ModelData_Vertex  StartVertex () const 
Returns a start vertex.  
ModelData_Vertex  EndVertex () const 
Returns a start vertex.  
ModelData_Curve  Curve (double &theFirstParameter, double &theLastParameter) const 
Returns edge 3D curve and its limits.  
ModelData_Curve2d  PCurve (const ModelData_Face &theFace, double &theFirstParameter, double &theLastParameter) const 
Returns edge pcurve on a face and its limits.  
void  SetTolerance (double theTolerance) 
Sets edge tolerance.  
double  Tolerance () const 
Returns edge tolerance.  
bool  IsDegenerated () const 
Returns true if the edge is degenerated.  
bool  IsSeam (const ModelData_Face &theFace) const 
Returns true if the edge is a seamedge.  
Public Member Functions inherited from cadex::ModelData_Shape  
ModelData_Shape ()  
Constructor.  
ModelData_Shape (const ModelData_Shape &theOther)  
Constructor.  
ModelData_Shape (ModelData_Shape &&theOther)  
Move constructor.  
~ModelData_Shape ()  
Destructor.  
ModelData_Shape &  operator= (const ModelData_Shape &theOther) 
Assignment operator.  
ModelData_Shape &  operator= (ModelData_Shape &&theOther) 
Move assignment operator.  
operator const TopoDS_Shape & () const  
Casts this object to TopoDS_Shape.  
ModelData_ShapeType  Type () const 
Returns a shape type.  
ModelData_ShapeOrientation  Orientation () const 
Returns orientation flag.  
ModelData_Shape  Reversed () const 
Returns a shape that shares the same geometry and subshape graph but has opposite orientation.  
ModelData_Shape  Oriented (ModelData_ShapeOrientation theOrientation) const 
Returns a shape that shares the same geometry and subshape graph and has specified orientation.  
void  Nullify () 
Nullifies the object.  
bool  IsNull () const 
Returns true if the object has not been initialized yet.  
operator bool () const  
Returns true if the object is not null.  
bool  IsEqual (const ModelData_Shape &theOther) const 
Returns true if the shape shares the same geometry and subshape graph, and has equal orientation.  
bool  IsSame (const ModelData_Shape &theOther) const 
Returns true if the shape shares the same geometry and subshape graph.  
internal::ModelData_ShapeImpl *  Impl () const 
Returns internal implementation object.  
Static Public Member Functions  
static const ModelData_Edge &  Cast (const ModelData_Shape &theShape) 
Casts a base class object to ModelData_Edge.  
static ModelData_Edge &  Cast (ModelData_Shape &theShape) 
Casts a base class object to ModelData_Edge.  
Additional Inherited Members  
Protected Member Functions inherited from cadex::ModelData_Shape  
ModelData_Shape (const TopoDS_Shape &theOther, bool)  
Constructor.  
ModelData_Shape (internal::ModelData_ShapeImpl *theImpl)  
Constructor.  
Protected Attributes inherited from cadex::ModelData_Shape  
internal::Base_Handle  myImpl 
Internal implementation object.  
Defines an edge.
The following image depicts an example of an edge:
An edge resides on a curve (returned by Curve()) and is bounded by two vertices returned by StartVertex() and EndVertex(). StartVertex() corresponds to smaller parameter along the curve and EndVertex()  to greater parameter (regardless of own edge orientation). Vertices must always be explicitly defined.
If an edge has forward Orientation() then it is considered to align with its underlying curve. If Orientation() is reversed, then the edge is considered to have an opposite orientation comparing to its underlying curve.
If an edge is owned by a face (via its wire) then this edge must also have a pcurve (parametric curve) defined in a parametric domain of the face surface. If an edge is shared by two faces in a shell then it must have pcurve on each parent face. Pcurves are oriented in the same direction as 3D curve.
Each curve representation (3D curve and pcurves) has explicit parametric range \([t_{min}, t_{max}]\), where \(t_{min}\) is a curve parameter corresponding to start vertex and \(t_{max}\) corresponding to end vertex. These points on the curve must be within vertex tolerances, i.e.:
The \(t_{min}\) parameter must always be smaller than \(t_{max}\). If the curve is not periodic then both parameters must be within the curve's definition range. If the curve is periodic then \(t_{min}\) should be within the curve's definition range. For instance, a closed edge lying on a circle (which has a definition range \([0, 2\pi]\)) may have a range \([0.5\pi, 2.5\pi]\).
When importing models from external files or creating from scratch CAD Exchanger also tries to ensure two more strict requirements:
An edge is called degenerated if it corresponds to a degenerated curve, e.g. a sphere pole, a cone apex or a BSpline singularity point. In this case it does not have a 3D curve and only has a pcurve. For instance in the case of a sphere 'north' pole the pcurve is Visoline \(V=\frac{\pi}{2}\).
IsDegenerated() returns true for a degenerated edge, and Curve() returns a null curve.
An edge is called seamedge if it corresponds to a curve on a periodical suface that has two pcurve representations in the surface parametric domain. Examples include a curve corresponding to Uisolines of a cylindrical surface with \(U=0\) and \(U=2\pi\).
Although, such seamedges typically have pcurves corresponding to surface boundary isolines (e.g. one corresponding to surface \(U_{min}\) and another to \(U_{max}\)), this is not always the case. Some seamedges may have pcurves corresponding to arbitrary pairs of isolines shifted by surface period (e.g. one is \(V^*\) and another \(V^* + V_{period}\)). Some seamedges may have even a pair of freeform pcurves, one shifted by surface period from another. This often happens when importing a file generated by CAD systems/kernels which do not explicitly support seamedges.
A seam edge occured twice in its parent wire  with forward and reversed orientations. Edge orientation defines which pcurve will be returned by PCurve(). IsSeam() returns true for the seamedge.
The edge tolerance (returned by Tolerance()) defines a radius of a pipe around edge's 3D curve, in which all pcurves (reconstructed on surfaces) must reside.
Any edge is created with a default tolerance (returned by Tolerance()) of 1e7mm. Vertex tolerance (see ModelData_Vertex::Tolerance()) defines a radius of a sphere around vertex point. Edge curves' ends must be inside those spheres.
Edge tolerance should not exceed vertices tolerances.
Creating an edge from scratch must be done in the following order:
The following example demonstrates creation of an edge in a solid cylinder, which is shared by top planar face and lateral cylindrical one. Note that the edge only has a 3D curve and a pcurve on the cylindrical surface. The pcurve on the planar face is not created as explicit pcurves on planar surface are not required.
cadex::ModelData_Edge::ModelData_Edge  (  const ModelData_Vertex &  theStartVertex, 
const ModelData_Vertex &  theEndVertex  
) 
Constructor.
Creates an edge from a explicitly specified bounding vertices.
theStartVertex must correspond to curve start parameter and theEndVertex to the end parameter (regardless of own edge orientation).
Orientation of the vertices is not important. Internally they will be assigned forward and reversed orientations respectively (however this will not modify input arguments).
For a closed edge (e.g. lying on a full circle) the vertices must be the same object (not just lie on geometrically coincident points), i.e. IsSame() on each vertex must return true for the other.
To complete edge construction the SetCurve() and/or SetPCurve() methods must be called. Refer to Bottomup Creation.

static 
Casts a base class object to ModelData_Edge.
theShape must be initialized and be of an instance of ModelData_Edge. Otherwise behavior is undefined.

static 
Casts a base class object to ModelData_Edge.
theShape must be initialized and be of an instance of ModelData_Edge. Otherwise behavior is undefined.
ModelData_Curve cadex::ModelData_Edge::Curve  (  double &  theFirstParameter, 
double &  theLastParameter  
)  const 
Returns edge 3D curve and its limits.
Returns null curve for a degenerated edge (see IsDegenerated()).
ModelData_Vertex cadex::ModelData_Edge::EndVertex  (  )  const 
Returns a start vertex.
End vertex corresponds to a point on a curve with greater parameter (regardless of edge orientation).
bool cadex::ModelData_Edge::IsDegenerated  (  )  const 
Returns true if the edge is degenerated.
A degenerated edge has no 3D curve.
bool cadex::ModelData_Edge::IsSeam  (  const ModelData_Face &  theFace  )  const 
Returns true if the edge is a seamedge.
ModelData_Curve2d cadex::ModelData_Edge::PCurve  (  const ModelData_Face &  theFace, 
double &  theFirstParameter,  
double &  theLastParameter  
)  const 
Returns edge pcurve on a face and its limits.
For a seamedge (IsSeam() returns true), selects pcurve depending on this edge orientation. For a seamedge both pcurves have the same definition range.
bool cadex::ModelData_Edge::SetCurve  (  const ModelData_Curve &  theCurve  ) 
Specifies 3D curve of the edge.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The curve must go from the start to the end vertex (specified in the constructor) in the direction of increasing curve's parameter.
The vertices must lie on the curve within their tolerances and within curve's definition range (see ModelData_Curve::Domain()) unless it is periodic.
Curve's range (explicitly stored inside) is computed by projecting vertices onto the curve. If the curve's range is known upfront it is recommended to use another SetCurve() overload accepting the range. If the range cannot be computed then returns false and does not store the curve.
If theCurve is null then removes 3D curve from the edge's curve representations.
For degenerated edges (e.g. sphere pole or cone apex) this method should not be called.
void cadex::ModelData_Edge::SetCurve  (  const ModelData_Curve &  theCurve, 
double  theFirstParameter,  
double  theLastParameter  
) 
Specifies 3D curve of the edge.
The curve must go from the start to the end vertex (specified in the constructor) in the direction of increasing curve's parameter. The point on theCurve at theFirstParameter must correspond to the start vertex, and the point at theLastParameter must correspond to the end vertex.
theFirstParameter must be smaller than theLastParameter. Both must be within curve's definition range (see ModelData_Curve::Domain()). If the curve is periodic, then theFirstParameter should be within the definition range.
The vertices must lie on the curve within their tolerances and within curve's definition range (see ModelData_Curve::Domain()) unless it is periodic.
If theCurve is null then removes 3D curve from the edge's curve representations.
For degenerated edges (e.g. sphere pole or cone apex) this method should not be called.
bool cadex::ModelData_Edge::SetPCurve  (  const ModelData_Curve2d &  thePCurve, 
const ModelData_Face &  theFace  
) 
Specifies pcurve of the edge on the specified face.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The pcurve must go from the start to the end vertex (specified in the constructor) in the direction of increasing curve's parameter.
theFace must already be created on an underlying surface (i.e. ModelData_Face::Surface() must return a nonnull object).
The vertices must lie on the curve within their tolerances and within curve's definition range (see ModelData_Curve::Domain()) unless it is periodic.
Curve's range (explicitly stored inside) is computed by projecting vertices onto the curve. If the curve's range is known upfront it is recommended to use another SetPCurve() overload accepting the range. If the range cannot be computed then returns false and does not store the pcurve.
For degenerated edge, if the pcurve corresponds to surface singularity, the other SetPCurve() overalod should be used as projection will most likely fail.
If thePCurve is null then removes pcurve for theFace from the edge's curve representations.
void cadex::ModelData_Edge::SetPCurve  (  const ModelData_Curve2d &  thePCurve, 
const ModelData_Face &  theFace,  
double  theFirstParameter,  
double  theLastParameter  
) 
Specifies pcurve of the edge on the specified face.
The curve must go from the start to the end vertex (specified in the constructor) in the direction of increasing curve's parameter. The point on theCurve at theFirstParameter must correspond to the start vertex, and the point at theLastParameter must correspond to the end vertex.
theFace must already be created on an underlying surface (i.e. ModelData_Face::Surface() must return a nonnull object).
theFirstParameter must be smaller than theLastParameter. Both must be within curve's definition range (see ModelData_Curve::Domain()). If the curve is periodic, then theFirstParameter should be within the definition range.
The vertices must lie on the curve within their tolerances and within curve's definition range (see ModelData_Curve::Domain()) unless it is periodic.
If the pcurve corresponds to surface singularity, the IsDegenerated() flag is automatically set. For degenerated edges, theFirstParameter and theLastParameter must be specified such that in 2D parametric space the pcurve ends correspond to ends of the adjacent edges' pcurves.
If thePCurve is null then removes pcurve for theFace from the edge's curve representations.
bool cadex::ModelData_Edge::SetPCurve  (  const ModelData_Curve2d &  thePCurveForward, 
const ModelData_Curve2d &  thePCurveReversed,  
const ModelData_Face &  theFace  
) 
Specifies pcurves of the seamedge on the specified face.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This method is fully equivalent to SetPCurve() for a single pcurve and face case but must be used when constructing seamedges.
Both pcurves must have the same parametrization (i.e. a point along one curve equals to a point along the other).
thePCurveForward corresponds to the edge when it has forward orientation in the parent wire, thePCurveReversed to the edge when it has reversed orientation. To determine material location with respect to the edge, only a surface normal is taken into account (i.e. face orientation is ignored). Refer to Face Boundaries).
Curves' range (explicitly stored inside) is computed by projecting vertices onto the curves. If the range is known upfront it is recommended to use another SetPCurve() overload accepting the range. If the range cannot be computed or ranges differ then returns false and does not store the pcurves.
void cadex::ModelData_Edge::SetPCurve  (  const ModelData_Curve2d &  thePCurveForward, 
const ModelData_Curve2d &  thePCurveReversed,  
const ModelData_Face &  theFace,  
double  theFirstParameter,  
double  theLastParameter  
) 
Specifies pcurves of the seamedge on the specified face.
This method is fully equivalent to SetPCurve() for a single pcurve and face case but must be used when constructing seamedges.
Both pcurves must have the same parametrization (i.e. a point along one curve equals to a point along the other).
thePCurveForward corresponds to the edge when it has forward orientation in the parent wire, thePCurveReversed to the edge when it has reversed orientation. To determine material location with respect to the edge, only a surface normal is taken into account (i.e. face orientation is ignored). Refer to Face Boundaries).
void cadex::ModelData_Edge::SetTolerance  (  double  theTolerance  ) 
ModelData_Vertex cadex::ModelData_Edge::StartVertex  (  )  const 
Returns a start vertex.
Start vertex corresponds to a point on a curve with smaller parameter (regardless of edge orientation).
double cadex::ModelData_Edge::Tolerance  (  )  const 
Returns edge tolerance.