Hide menu
Loading...
Searching...
No Matches

Defines an edge. More...

Inheritance diagram for cadex.ModelData.Edge:
cadex.ModelData.Shape cadex.BaseObject

Public Member Functions

 Edge (global::System.IntPtr cPtr, bool cMemoryOwn)
 
 Edge (cadex.ModelData.Vertex theStartVertex, cadex.ModelData.Vertex theEndVertex)
 Constructor.
 
 Edge (cadex.Geom.Curve theCurve, cadex.ModelData.Vertex theStartVertex, cadex.ModelData.Vertex theEndVertex)
 Constructor.
 
void SetCurve (cadex.Geom.Curve theCurve, double theFirstParameter, double theLastParameter)
 Specifies 3D curve of the edge.
 
bool SetCurve (cadex.Geom.Curve theCurve)
 Specifies 3D curve of the edge.
 
cadex.Geom.Curve Curve (out double theFirstParameter, out double theLastParameter)
 Returns edge 3D curve and its limits.
 
void SetPCurve (cadex.Geom.Curve2d thePCurve, cadex.ModelData.Face theFace, double theFirstParameter, double theLastParameter)
 Specifies p-curve of the edge on the specified face.
 
bool SetPCurve (cadex.Geom.Curve2d thePCurve, cadex.ModelData.Face theFace)
 Specifies p-curve of the edge on the specified face.
 
void SetPCurve (cadex.Geom.Curve2d thePCurveForward, cadex.Geom.Curve2d thePCurveReversed, cadex.ModelData.Face theFace, double theFirstParameter, double theLastParameter)
 Specifies p-curves of the seam-edge on the specified face.
 
bool SetPCurve (cadex.Geom.Curve2d thePCurveForward, cadex.Geom.Curve2d thePCurveReversed, cadex.ModelData.Face theFace)
 Specifies p-curves of the seam-edge on the specified face.
 
cadex.Geom.Curve2d PCurve (cadex.ModelData.Face theFace, out double theFirstParameter, out double theLastParameter)
 Returns edge p-curve on a face and its limits.
 
cadex.ModelData.Vertex StartVertex ()
 Returns a start vertex.
 
cadex.ModelData.Vertex EndVertex ()
 Returns an end vertex.
 
void SetTolerance (double theTolerance)
 Sets edge tolerance.
 
double Tolerance ()
 Returns edge tolerance.
 
bool IsDegenerated ()
 Returns true if the edge is degenerated.
 
bool IsSeam (cadex.ModelData.Face theFace)
 Returns true if the edge is a seam-edge.
 
cadex.ModelData.PolylineSet Triangulation ()
 Returns a polyline approximation of the curve.
 
- Public Member Functions inherited from cadex.ModelData.Shape
 Shape (global::System.IntPtr cPtr, bool cMemoryOwn)
 
override int GetHashCode ()
 
cadex.ModelData.ShapeType Type ()
 Returns a shape type. For a null object returns Undefined.
 
cadex.ModelData.ShapeOrientation Orientation ()
 Returns orientation flag.
 
cadex.ModelData.Shape Reversed ()
 Returns a shape that shares the same geometry and subshape graph but has opposite orientation.
 
cadex.ModelData.Shape Oriented (cadex.ModelData.ShapeOrientation theOrientation)
 Returns a shape that shares the same geometry and subshape graph and has specified orientation.
 
bool IsEqual (cadex.ModelData.Shape theOther)
 Returns true if the shape shares the same geometry and subshape graph, and has equal orientation.
 
bool IsSame (cadex.ModelData.Shape theOther)
 Returns true if the shape shares the same geometry and subshape graph.
 
void SetName (cadex.UTF16String theName)
 Sets the name.
 
cadex.UTF16String Name ()
 Returns the name.
 
void AddAssociatedPMI (cadex.PMI.Element theElement)
 Adds the PMI element.
 
void AddAssociatedPMI (cadex.Collections.PMIElementList theElements)
 Adds the PMI elements.
 
cadex.Collections.PMIElementList AssociatedPMI ()
 Returns the PMI elements.
 
override bool Equals (System.Object o)
 
- Public Member Functions inherited from cadex.BaseObject
 BaseObject (global::System.IntPtr cPtr, bool cMemoryOwn)
 
void Dispose ()
 
bool IsNull ()
 
ulong Id ()
 Return unique identifier of public object.
 
bool IsEqual (cadex.BaseObject theObj)
 
override int GetHashCode ()
 
override bool Equals (System.Object o)
 

Static Public Member Functions

static cadex.ModelData.Edge Cast (cadex.ModelData.Shape theShape)
 Casts a base class object to Edge.
 
static new bool CompareType (cadex.BaseObject theObject)
 Check the type of object. Returns true if the specified object is this class type.
 
- Static Public Member Functions inherited from cadex.ModelData.Shape
static bool CompareType (cadex.BaseObject theObject)
 Check the type of object. Returns true if the specified object is this class type.
 
static cadex.ModelData.Shape Cast (cadex.BaseObject theBase)
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from cadex.ModelData.Shape
override void Dispose (bool disposing)
 

Detailed Description

Defines an edge.

The following image depicts an example of an edge:

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 p-curve (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. P-curves are oriented in the same direction as 3D curve.

Curve Representations

Each curve representation (3D curve and p-curves) 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.:

  • \(\|\mathbf{C}(t_{min}) - \mathbf{P}_{start}\| \leq \mathrm{tolerance}_{start}\)
  • \(\|\mathbf{C}(t_{max}) - \mathbf{P}_{end}\| \leq \mathrm{tolerance}_{end}\)

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 MTK also tries to ensure two more strict requirements:

  • "same range": all curve representations (3D curve and all p-curves) have the same definition parametric range (e.g. \([a, b]\));
  • "same parameter": for any parameter t from range \([a, b]\) a 3D point computed from 3D curve must be within an edge tolerance from a 3D point computed from p-curve and corresponding surface, i.e. \(\|\mathbf{C}(t) - \mathbf{S}(p(t))\| \leq \mathrm{tolerance}\).

Special Types of Edges

Degenerated Edge

An edge is called degenerated if it corresponds to a degenerated curve, e.g. a sphere pole, a cone apex or a B-Spline 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 V-isoline \(V=\frac{\pi}{2}\).

IsDegenerated() returns true for a degenerated edge, and Curve() returns a null curve.

Seam-edge

An edge is called seam-edge 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 U-isolines of a cylindrical surface with \(U=0\) and \(U=2\pi\).

Although, such seam-edges typically have pcurves corresponding to surface boundary iso-lines (e.g. one corresponding to surface \(U_{min}\) and another to \(U_{max}\)), this is not always the case. Some seam-edges may have pcurves corresponding to arbitrary pairs of isolines shifted by surface period (e.g. one is \(V^*\) and another \(V^* + V_{period}\)). Some seam-edges may have even a pair of free-form 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 seam-edges.

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 seam-edge.

Tolerance

The edge tolerance (returned by Tolerance()) defines a radius of a pipe around edge's 3D curve, in which all p-curves (reconstructed on surfaces) must reside.

Any edge is created with a default tolerance (returned by Tolerance()) of 1e-7mm. 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.

Bottom-up Creation

Creating an edge from scratch must be done in the following order:

  • Start and end vertices must be created in advance (from 3D points they will lie upon);
  • The edge is then constructed using those vertices. In the case of creating edges belonging to the same wire, the vertices must be shared by adjacent edges in order to ensure topological connectivity between the edges;
  • A 3D curve must be then added using the SetCurve() method. If the start/end parameters along the curve (corresponding to start/end vertices respectively) are reliably known then they should be specified. Otherwise they will be computed by projecting the vertices onto the curve;
  • If the edge belongs to face(s) then p-curves for that(those) face(s) must be added with SetPCurve(). Similar to SetCurve(), if the p-curve range is known then it should be specified. Otherwise the range will be computed by projecting the vertices.
  • If needed, the edge tolerance must be updated using SetTolerance().

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 p-curve on the cylindrical surface. The p-curve on the planar face is not created as explicit p-curves on planar surface are not required.

double R = 5., H = 10.; //radius and height
// 3D curves
Geom::Point (0, 0, H),
Geom::Direction::ZDir(),
Geom::Direction::XDir()), R); // top
// surfaces
Geom::Plane aPlane2 (aCircle2.Position());
Geom::Point::Origin(),
Geom::Direction::ZDir(),
Geom::Direction::XDir()), R);
// vertices
// edges
ModelData::Edge aE2 (aV2, aV2); // top
// faces
ModelData::Face aFace2 (aPlane2, false);
ModelData::Face aFace3 (aCyl, false);
aE2.SetCurve (aCircle2, 0, 2 * M_PI);
Geom::Line2d aLine23 (Geom::Point2d (0, H), Geom::Direction2d::XDir());
aE2.SetPCurve (aLine23, aFace3, 0, 2 * M_PI);
Defines a right-handed or left-handed axis in 3D.
Definition Axis3d.cs:24
Defines 3D circle.
Definition Circle.cs:29
Defines a cylindrical surface.
Definition CylindricalSurface.cs:40
Defines 2D line.
Definition Line2d.cs:19
Defines a plane.
Definition Plane.cs:29
Defines a 3D point.
Definition Point2d.cs:17
Defines a 3D point.
Definition Point.cs:17
Defines an edge.
Definition Edge.cs:146
Defines a topological face.
Definition Face.cs:120
Defines topological vertex.
Definition Vertex.cs:32
Examples
exploring/brep_geometry/Program.cs, exploring/brep_geometry/main.cxx, exploring/brep_topology/Program.cs, and exploring/brep_topology/main.cxx.

Constructor & Destructor Documentation

◆ Edge() [1/2]

cadex.ModelData.Edge.Edge ( cadex.ModelData.Vertex theStartVertex,
cadex.ModelData.Vertex theEndVertex )
inline

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 Bottom-up Creation.

◆ Edge() [2/2]

cadex.ModelData.Edge.Edge ( cadex.Geom.Curve theCurve,
cadex.ModelData.Vertex theStartVertex,
cadex.ModelData.Vertex theEndVertex )
inline

Constructor.

Creates an edge from a curve and explicitly specified bounding vertices:

Constructing edge from curve and vertices

The vertices must lie on the curve within their tolerances and within curve's definition range (see Geom.Curve.Domain()) unless it is periodic.

Member Function Documentation

◆ Cast()

static cadex.ModelData.Edge cadex.ModelData.Edge.Cast ( cadex.ModelData.Shape theShape)
inlinestatic

Casts a base class object to Edge.

theShape must be initialized and be of an instance of Edge. Otherwise behavior is undefined.

Examples
exploring/brep_geometry/Program.cs, and exploring/brep_topology/Program.cs.

◆ Curve()

cadex.Geom.Curve cadex.ModelData.Edge.Curve ( out double theFirstParameter,
out double theLastParameter )
inline

Returns edge 3D curve and its limits.

Returns null curve for a degenerated edge (see IsDegenerated()).

See also
SetCurve().
Examples
exploring/brep_geometry/Program.cs, exploring/brep_geometry/main.cxx, exploring/brep_topology/Program.cs, and exploring/brep_topology/main.cxx.

◆ Dispose()

override void cadex.ModelData.Edge.Dispose ( bool disposing)
inlineprotectedvirtual

Reimplemented from cadex.BaseObject.

◆ EndVertex()

cadex.ModelData.Vertex cadex.ModelData.Edge.EndVertex ( )
inline

Returns an end vertex.

End vertex corresponds to a point on a curve with greater parameter (regardless of edge orientation).

See also
StartVertex().

◆ IsDegenerated()

bool cadex.ModelData.Edge.IsDegenerated ( )
inline

Returns true if the edge is degenerated.

A degenerated edge has no 3D curve.

Examples
exploring/brep_geometry/Program.cs, exploring/brep_geometry/main.cxx, exploring/brep_topology/Program.cs, and exploring/brep_topology/main.cxx.

◆ IsSeam()

bool cadex.ModelData.Edge.IsSeam ( cadex.ModelData.Face theFace)
inline

Returns true if the edge is a seam-edge.

See also
Seam-edge.

◆ PCurve()

cadex.Geom.Curve2d cadex.ModelData.Edge.PCurve ( cadex.ModelData.Face theFace,
out double theFirstParameter,
out double theLastParameter )
inline

Returns edge p-curve on a face and its limits.

For a seam-edge (IsSeam() returns true), selects p-curve depending on this edge orientation. For a seam-edge both p-curves have the same definition range.

See also
SetPCurve().
Examples
exploring/brep_geometry/Program.cs, and exploring/brep_geometry/main.cxx.

◆ SetCurve() [1/2]

bool cadex.ModelData.Edge.SetCurve ( cadex.Geom.Curve theCurve)
inline

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 Geom.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.

See also
Curve Representations.

◆ SetCurve() [2/2]

void cadex.ModelData.Edge.SetCurve ( cadex.Geom.Curve theCurve,
double theFirstParameter,
double theLastParameter )
inline

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 Geom.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 Geom.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.

See also
Curve Representations.

◆ SetPCurve() [1/4]

bool cadex.ModelData.Edge.SetPCurve ( cadex.Geom.Curve2d thePCurve,
cadex.ModelData.Face theFace )
inline

Specifies p-curve 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 p-curve 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 non-null object).

The vertices must lie on the curve within their tolerances and within curve's definition range (see Geom.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 p-curve.

For degenerated edge, if the p-curve corresponds to surface singularity, the other SetPCurve() overalod should be used as projection will most likely fail.

If thePCurve is null then removes p-curve for theFace from the edge's curve representations.

See also
Curve Representations.

◆ SetPCurve() [2/4]

void cadex.ModelData.Edge.SetPCurve ( cadex.Geom.Curve2d thePCurve,
cadex.ModelData.Face theFace,
double theFirstParameter,
double theLastParameter )
inline

Specifies p-curve 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 non-null object).

theFirstParameter must be smaller than theLastParameter. Both must be within curve's definition range (see Geom.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 Geom.Curve.Domain()) unless it is periodic.

If the p-curve 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 p-curve ends correspond to ends of the adjacent edges' p-curves.

If thePCurve is null then removes p-curve for theFace from the edge's curve representations.

See also
Curve Representations.

◆ SetPCurve() [3/4]

bool cadex.ModelData.Edge.SetPCurve ( cadex.Geom.Curve2d thePCurveForward,
cadex.Geom.Curve2d thePCurveReversed,
cadex.ModelData.Face theFace )
inline

Specifies p-curves of the seam-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.

This method is fully equivalent to SetPCurve() for a single p-curve and face case but must be used when constructing seam-edges.

Both p-curves 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 p-curves.

◆ SetPCurve() [4/4]

void cadex.ModelData.Edge.SetPCurve ( cadex.Geom.Curve2d thePCurveForward,
cadex.Geom.Curve2d thePCurveReversed,
cadex.ModelData.Face theFace,
double theFirstParameter,
double theLastParameter )
inline

Specifies p-curves of the seam-edge on the specified face.

This method is fully equivalent to SetPCurve() for a single p-curve and face case but must be used when constructing seam-edges.

Both p-curves 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).

◆ SetTolerance()

void cadex.ModelData.Edge.SetTolerance ( double theTolerance)
inline

Sets edge tolerance.

If theTolerance is less than 1e-7 then it is ignored.

See also
Tolerance().

◆ StartVertex()

cadex.ModelData.Vertex cadex.ModelData.Edge.StartVertex ( )
inline

Returns a start vertex.

Start vertex corresponds to a point on a curve with smaller parameter (regardless of edge orientation).

See also
EndVertex().

◆ Tolerance()

◆ Triangulation()

cadex.ModelData.PolylineSet cadex.ModelData.Edge.Triangulation ( )
inline

Returns a polyline approximation of the curve.

An empty object may be returned.