Hide menu
Loading...
Searching...
No Matches
cadex::ModelData_Curve Class Reference

Base class for 3D curves. More...

#include <cadex/ModelData_Curve.hxx>

Inheritance diagram for cadex::ModelData_Curve:
cadex::ModelData_BSplineCurve cadex::ModelData_BezierCurve 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.
 
ModelData_CurveType Type () const
 Returns a curve type.
 
bool IsNull () const
 Returns true if the object has not been initialized yet.
 
void Nullify ()
 Resets the object.
 
 operator bool () const
 Returns if the object has been initialized.
 
bool IsPeriodic () const
 Returns true if the curve is periodic.
 
double UMin () const
 Returns a minimum parameter of a definition domain.
 
double UMax () const
 Returns a maximum parameter of a definition domain.
 
void Domain (double &theUMin, double &theUMax) const
 Returns a definition domain.
 
ModelData_Point Value (double theParameter) const
 Evaluates a point on the curve.
 
ModelData_Curve Reversed () const
 Returns a curve with reversed orientation.
 
void Transform (const ModelData_Transformation &theTransformation)
 Applies transformation matrix to this object.
 
ModelData_Curve Transformed (const ModelData_Transformation &theTransformation) const
 Returns a copy this object after applying transformation.
 
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.
 
void D1 (double theParameter, ModelData_Point &theValue, ModelData_Vector &theD1) const
 Returns the point theValue of parameter theParam and the first derivative theD1.
 
void D2 (double theParameter, ModelData_Point &theValue, ModelData_Vector &theD1, ModelData_Vector &theD2) const
 Returns the point theValue of parameter theParam, the first theD1 and second theD2 derivatives.
 
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.
 
ModelData_Curve Mirrored (const ModelData_Point &theRef) const
 Returns a copy this curve mirrored along the object.
 
ModelData_Curve Mirrored (const ModelData_Axis1Placement &theAxis) const
 Returns a copy this curve mirrored along the object.
 
ModelData_Curve Mirrored (const ModelData_Axis2Placement &theAxis) const
 Returns a copy this curve mirrored along the object.
 
void Rotate (const ModelData_Axis1Placement &theAxis, double theAngle)
 Rotates the curve around the axis.
 
ModelData_Curve Rotated (const ModelData_Axis1Placement &theAxis, double theAngle) const
 Returns a copy this curve rotated along the axis.
 
void Translate (const ModelData_Vector &theVector)
 Translates the curve along the vector.
 
ModelData_Curve Translated (const ModelData_Vector &theVector) const
 Returns a copy this curve translated along the vector.
 
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) const
 Returns a copy this curve scaled with respect to the point.
 

Public Attributes

 operator Handle_C const
 

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();
...
}
Defines 3D circle.
Definition: ModelData_Circle.hxx:33
double Radius() const
Returns radius.
Definition: ModelData_Circle.cxx:68
Base class for 3D curves.
Definition: ModelData_Curve.hxx:44
ModelData_CurveType Type() const
Returns a curve type.
Definition: ModelData_Curve.cxx:205

Parametric Definition

Curve is defined using parametric definition as \(\mathbf{C}(t)\) where \(\mathbf{C}\) is a 3D radius-vector \((x,y,z)^\top\) 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. \((-\infty, +\infty)\) 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.);
ModelData_Point Value(double theParameter) const
Evaluates a point on the curve.
Definition: ModelData_Curve.cxx:255
Defines 3D line.
Definition: ModelData_Line.hxx:36
Defines a 3D point.
Definition: ModelData_Point.hxx:295

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 ( \(C^0\), \(C^1\), \(C^2\), \(C^N\)) of the curve, where \(C^0\) that only the curve itself is continuous, \(C^1\) - that the curve is continuous together with 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
exploring/brepgeometry/Program.cs, exploring/brepgeometry/main.cxx, exploring/breprepresentation/Program.cs, exploring/breprepresentation/main.cxx, and modeling/assembly/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 \(C^1\).

◆ 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, the first theD1 and second theD2 derivatives.

Throws exception if the continuity of the curve is not \(C^2\).

◆ 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().

◆ IsNull()

bool cadex::ModelData_Curve::IsNull ( ) const

Returns true if the object has not been initialized yet.

See also
Nullify().

◆ Mirrored() [1/3]

ModelData_Curve cadex::ModelData_Curve::Mirrored ( const ModelData_Axis1Placement theAxis) const

Returns a copy this curve mirrored along the object.

The contents of this object is not modified.

See also
Mirror().

◆ Mirrored() [2/3]

ModelData_Curve cadex::ModelData_Curve::Mirrored ( const ModelData_Axis2Placement theAxis) const

Returns a copy this curve mirrored along the object.

The contents of this object is not modified.

See also
Mirror().

◆ Mirrored() [3/3]

ModelData_Curve cadex::ModelData_Curve::Mirrored ( const ModelData_Point theRef) const

Returns a copy this curve mirrored along the object.

The contents of this object is not modified.

See also
Mirror().

◆ Nullify()

void cadex::ModelData_Curve::Nullify ( )

Resets the object.

IsNull() will return true after calling this method.

◆ 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 
) const

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 
) const

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) const

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().
Examples
exploring/brepgeometry/Program.cs, and exploring/brepgeometry/main.cxx.

◆ UMin()

double cadex::ModelData_Curve::UMin ( ) const

Returns a minimum parameter of a definition domain.

See also
UMax(), Domain().
Examples
exploring/brepgeometry/Program.cs, and exploring/brepgeometry/main.cxx.

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