CAD Exchanger SDK
cadex::ModelData_Curve Class Reference

Base class for 3D curves. More...

Inheritance diagram for cadex::ModelData_Curve:
cadex::ModelData_BezierCurve cadex::ModelData_BSplineCurve cadex::ModelData_Conic cadex::ModelData_Line cadex::ModelData_OffsetCurve cadex::ModelData_TrimmedCurve cadex::ModelData_Circle cadex::ModelData_Ellipse cadex::ModelData_Hyperbola cadex::ModelData_Parabola

Public Member Functions

 ModelData_Curve ()
 Constructor.
 
 ModelData_Curve (const ModelData_Curve &theOther)
 Constructor.
 
 ModelData_Curve (ModelData_Curve &&theOther)
 Constructor.
 
 ~ModelData_Curve ()
 Destructor.
 
ModelData_Curveoperator= (const ModelData_Curve &theOther)
 Assignment operator.
 
ModelData_Curveoperator= (ModelData_Curve &&theOther)
 Move assignment operator.
 
 operator const Handle_C & () const
 Cast operator.
 
ModelData_CurveType Type () const
 Returns a curve type.
 
bool IsNull () const
 Returns true if the object has not been initialized yet.
 
 operator bool () const
 Returns if the object has been initialized. More...
 
bool IsPeriodic () const
 Returns true if the curve is periodic.
 
double UMin () const
 Returns a minimum parameter of a definition domain. More...
 
double UMax () const
 Returns a maximum parameter of a definition domain. More...
 
void Domain (double &theUMin, double &theUMax) const
 Returns a definition domain. More...
 
ModelData_Point Value (double theParameter) const
 Evaluates a point on the curve. More...
 
ModelData_Curve Reversed () const
 Returns a curve with reversed orientation. More...
 
void Transform (const ModelData_Transformation &theTransformation)
 Applies transformation matrix to this object. More...
 
ModelData_Curve Transformed (const ModelData_Transformation &theTransformation) const
 Returns a copy this object after applying transformation. More...
 
ModelData_Continuity Continuity () const
 Returns a continuity type of the curve.
 
void D0 (double theParameter, ModelData_Point &theValue) const
 Returns the point theValue of parameter theParam. More...
 
void D1 (double theParameter, ModelData_Point &theValue, ModelData_Vector &theD1) const
 Returns the point theValue of parameter theParam and the first derivative theD1. More...
 
void D2 (double theParameter, ModelData_Point &theValue, ModelData_Vector &theD1, ModelData_Vector &theD2) const
 Returns the point theValue of parameter theParam and second derivatives theD1 and theD2. More...
 
bool DN (double theParameter, size_t theDerivativeOrder, ModelData_Point &theValue, ModelData_Vector theD[]) const
 
double Curvature (double theParameter) const
 Returns the curvature value of parameter theParam.
 
void Normal (double theParameter, ModelData_Direction &theNormal) const
 Returns the normal direction theNormal of parameter theParam.
 
void Mirror (const ModelData_Point &thePoint)
 Mirrors the curve relative to the point.
 
void Mirror (const ModelData_Axis1Placement &theAxis)
 Mirrors the curve relative to the axis placement.
 
void Mirror (const ModelData_Axis2Placement &theAxis)
 Mirrors the curve relative to the axis placement.
 
template<typename T >
ModelData_Curve Mirrored (const T &theRef) const
 Returns a copy this curve translated along the vector. More...
 
void Rotate (const ModelData_Axis1Placement &theAxis, double theAngle)
 Rotates the curve around the axis.
 
ModelData_Curve Rotated (const ModelData_Axis1Placement &theAxis, double theAngle)
 Returns a copy this curve rotated along the axis. More...
 
void Translate (const ModelData_Vector &theVector)
 Translates the curve along the vector.
 
ModelData_Curve Translated (const ModelData_Vector &theVector)
 Returns a copy this curve translated along the vector. More...
 
void Scale (const ModelData_Point &thePoint, double theScale)
 Scales the curve with respect to the point.
 
ModelData_Curve Scaled (const ModelData_Point &thePoint, double theScale)
 Returns a copy this curve scaled with respect to the point. More...
 

Protected Member Functions

 ModelData_Curve (const Handle_C &, ModelData_CurveType)
 Constructor.
 
internal::ModelData_CurveImpl & Impl ()
 Returns internal implementation object.
 

Detailed Description

Base class for 3D curves.

3D curves are used to represent curves in 3D space. Each non-degenerated edge must refer to a 3D curve.

Types

Refer to Curve Types for the list of supported curve types. Type() returns a curve type as enumeration value which can be used to downcast to a respective subclass type, for instance:

ModelData_Curve aCurve = ...;
if (aCurve.Type() == ModelData_CT_Circle) {
const ModelData_Circle& aCircle = static_cast<const ModelData_Circle&> (aCurve);
double aRadius = aCircle.Radius();
...
}

Parametric Definition

Curve is defined using parametric definition as C(t) where C is a 3D radius-vector (x,y,z) and t is a parameter from a definition range [a, b].

UMin() and UMax(), and Domain() return parametric definition range. Parametric range can be bounded (e.g. [0, 2 * PI] for a circle) or unbounded (e.g. (-infinity, + infinity) for a line).

Evaluation

At any parameter t within a definition range, the curve can be evaluated as follows:

  • Value() and D0() return a 3D point;
  • D1(), D2() and DN() return a derivative of a respective order;
  • Curvature() returns a curvature;
  • Normal() returns a normal to the curve (i.e. perpendicular to its first derivative).

The following example demonstrates computation of a point on a line at parameter t=2:

ModelData_Line aLine = ...;
ModelData_Point aPoint = aLine.Value (2.);

If the curve is periodic (IsPeriodic() returns true) then the curve can be evaluated at any parameter t, otherwise behavior is undefined (e.g. an exception can be thrown or a weird value can be returned).

Continuity

Continuity() returns continuity (C0, C1, C2, CN) of the curve, where C0 indicates continuity of the curve only, C1 - of its first derivative and so on.

Transformation

The curve can be modified using the following operations:

Warning
As the curve data is shared via internal pointer modification of the curve may affect other users of the curve (e.g. an edge referring to it). So you might want to use method returning a modified copy of the curve (such as Transformed()).
See also
Curves, ModelData_Curve2d, ModelData_Edge, ModelData_Surface.
Examples:
modelexplorer/main.cxx.

Member Function Documentation

◆ D0()

void cadex::ModelData_Curve::D0 ( double  theParam,
ModelData_Point theValue 
) const

Returns the point theValue of parameter theParam.

Throws exception only for the ModelData_OffsetCurve if it is not possible to compute the current point. For example when the first derivative on the basis curve and the offset direction are parallel.

◆ D1()

void cadex::ModelData_Curve::D1 ( double  theParam,
ModelData_Point theValue,
ModelData_Vector theD1 
) const

Returns the point theValue of parameter theParam and the first derivative theD1.

Throws exception if the continuity of the curve is not C1.

◆ D2()

void cadex::ModelData_Curve::D2 ( double  theParam,
ModelData_Point theValue,
ModelData_Vector theD1,
ModelData_Vector theD2 
) const

Returns the point theValue of parameter theParam and second derivatives theD1 and theD2.

Throws exception if the continuity of the curve is not C2.

◆ DN()

bool cadex::ModelData_Curve::DN ( double  theParam,
size_t  theDerivativeOrder,
ModelData_Point theValue,
ModelData_Vector  theD[] 
) const

Returns true if calculation completed successfully. In this case theD contains values of the derivatives from 0 up to theDerivativeOrder. Otherwise returns false. May throw exception if the continuity of the curve is less than theDerivativeOrder.

Parameters:

  • theDerivativeOrder must belong to range [0, 3].
  • theD should have size to store theDerivativeOrder derivatives (i.e. theDerivativeOrder or more).

◆ Domain()

void cadex::ModelData_Curve::Domain ( double &  theUMin,
double &  theUMax 
) const

Returns a definition domain.

See also
UMin(), UMax().

◆ Mirrored()

template<typename T >
ModelData_Curve cadex::ModelData_Curve::Mirrored ( const T &  theRef) const
inline

Returns a copy this curve translated along the vector.

The contents of this object is not modified.

See also
Mirror().

◆ operator bool()

cadex::ModelData_Curve::operator bool ( ) const
inline

Returns if the object has been initialized.

Returns the value opposite to IsNull().

◆ Reversed()

ModelData_Curve cadex::ModelData_Curve::Reversed ( ) const

Returns a curve with reversed orientation.

Creates a deep copy of the curve which does not share any definition with this object.

◆ Rotated()

ModelData_Curve cadex::ModelData_Curve::Rotated ( const ModelData_Axis1Placement theAxis,
double  theAngle 
)
inline

Returns a copy this curve rotated along the axis.

The contents of this object is not modified.

See also
Rotate().

◆ Scaled()

ModelData_Curve cadex::ModelData_Curve::Scaled ( const ModelData_Point thePoint,
double  theScale 
)
inline

Returns a copy this curve scaled with respect to the point.

The contents of this object is not modified.

See also
Scale().

◆ Transform()

void cadex::ModelData_Curve::Transform ( const ModelData_Transformation theTransformation)

Applies transformation matrix to this object.

Results depends on the actual curve type.

See also
Transformed().

◆ Transformed()

ModelData_Curve cadex::ModelData_Curve::Transformed ( const ModelData_Transformation theTransformation) const

Returns a copy this object after applying transformation.

The contents of this object is not modified.

See also
Transform().

◆ Translated()

ModelData_Curve cadex::ModelData_Curve::Translated ( const ModelData_Vector theVector)
inline

Returns a copy this curve translated along the vector.

The contents of this object is not modified.

See also
Translate().

◆ UMax()

double cadex::ModelData_Curve::UMax ( ) const

Returns a maximum parameter of a definition domain.

See also
UMin(), Domain().

◆ UMin()

double cadex::ModelData_Curve::UMin ( ) const

Returns a minimum parameter of a definition domain.

See also
UMax(), Domain().

◆ Value()

ModelData_Point cadex::ModelData_Curve::Value ( double  theParameter) const

Evaluates a point on the curve.

theParameter must be within Domain() if the curve is not periodic.