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

Base class for 3D curves. More...

#include <cadex/Geom/Curve.hxx>

Inheritance diagram for cadex::Geom::Curve:
cadex::Geom::Geometry cadex::BaseObject cadex::Geom::BSplineCurve cadex::Geom::BezierCurve cadex::Geom::Conic cadex::Geom::Line cadex::Geom::OffsetCurve cadex::Geom::Circle cadex::Geom::Ellipse cadex::Geom::Hyperbola cadex::Geom::Parabola

Public Member Functions

 Curve ()
 Constructor.
 
CurveType Type () const
 
Geom::Continuity Continuity () const
 Returns a continuity type of the curve.
 
Point Value (double theParameter) const
 Evaluates a point on the curve.
 
Direction Normal (double theParameter) const
 Returns the normal direction theNormal of parameter theParam.
 
double Curvature (double theParameter) const
 Returns the curvature value of parameter theParam.
 
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.
 
bool IsTrimmed () const
 Returns whether curve is trimmed or not.
 
void SetTrim (double theFirst, double theLast)
 Trims curve with [theFirst, theLast] section.
 
void Transform (const Transformation &theTransformation)
 Applies transformation matrix to this object.
 
Curve Transformed (const Transformation &theTransformation) const
 Returns a copy this object after applying transformation.
 
void D0 (double theParameter, Point &theValue) const
 Returns the point theValue of parameter theParam.
 
void D1 (double theParameter, Point &theValue, Vector &theD1) const
 Returns the point theValue of parameter theParam and the first derivative theD1.
 
void D2 (double theParameter, Point &theValue, Vector &theD1, Vector &theD2) const
 Returns the point theValue of parameter theParam, the first theD1 and second theD2 derivatives.
 
bool DN (double theParameter, size_t theDerivativeOrder, Geom::Point &theValue, std::vector< Geom::Vector > &theD) const
 
void Mirror (const Point &thePoint)
 
void Mirror (const Axis1d &theAxis)
 
void Mirror (const Axis3d &theAxis)
 
Curve Mirrored (const Point &theRef) const
 
Curve Mirrored (const Axis1d &theAxis) const
 
Curve Mirrored (const Axis3d &theAxis) const
 
void Rotate (const Axis1d &theAxis, double theAngle)
 
Curve Rotated (const Axis1d &theAxis, double theAngle) const
 
void Translate (const Vector &theVector)
 
Curve Translated (const Vector &theVector) const
 
void Scale (const Point &thePoint, double theScale)
 
Curve Scaled (const Point &thePoint, double theScale) const
 
- Public Member Functions inherited from cadex::BaseObject
size_t Id () const
 Return unique identifier of public object.
 
internal::BaseObjectImpl * Impl () const
 
bool IsNull () const
 
 operator bool () const
 
template<typename T >
bool IsOfType () const
 
template<typename T >
T * Impl () const
 Reserved for internal use.
 

Static Public Member Functions

static bool CompareType (const BaseObject &theObject)
 
- Static Public Member Functions inherited from cadex::Geom::Geometry
static bool CompareType (const BaseObject &theObject)
 

Protected Member Functions

 Curve (const ImplType &theImpl)
 
- Protected Member Functions inherited from cadex::Geom::Geometry
 Geometry (const ImplType &theImpl)
 
- Protected Member Functions inherited from cadex::BaseObject
 BaseObject (const ImplType &theImpl)
 

Additional Inherited Members

- Public Types inherited from cadex::BaseObject
typedef std::shared_ptr< internal::BaseObjectImpl > ImplType
 

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:

Curve aCurve = ...;
if (aCurve.Type() == Geom::CurveType::Circle) {
const Circle& aCircle = static_cast<const Circle&> (aCurve);
double aRadius = aCircle.Radius();
...
}
Defines 3D circle.
Definition Circle.hxx:29
double Radius() const
Returns radius.
Definition Circle.cxx:87
Base class for 3D curves.
Definition Curve.hxx:39
CurveType Type() const
Definition Curve.cxx:434

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:

Line aLine = ...;
Point aPoint = aLine.Value (2.);
Defines 3D line.
Definition Line.hxx:31
Defines a 3D point.
Definition Point.hxx:35

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:

  • translation (Translate() and Translated());
  • rotation (Rotate() and Rotated());
  • mirroring (Mirror() and Mirrored());
  • scaling (Scale() and Scaled());
  • arbitrary transformation using 3x4 matrix (Transform() and Transformed()).
  • Reversed() returns a curve with opposite orientation.
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, Curve2d, ModelData::Edge, Surface.

Member Function Documentation

◆ D0()

void cadex::Geom::Curve::D0 ( double theParameter,
Point & theValue ) const

Returns the point theValue of parameter theParam.

Throws exception only for the 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::Geom::Curve::D1 ( double theParameter,
Point & theValue,
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::Geom::Curve::D2 ( double theParameter,
Point & theValue,
Vector & theD1,
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::Geom::Curve::DN ( double theParameter,
size_t theDerivativeOrder,
Geom::Point & theValue,
std::vector< Geom::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::Geom::Curve::Domain ( double & theUMin,
double & theUMax ) const

Returns a definition domain.

See also
UMin(), UMax().

◆ Transform()

void cadex::Geom::Curve::Transform ( const Transformation & theTransformation)

Applies transformation matrix to this object.

Results depends on the actual curve type.

See also
Transformed().

◆ Transformed()

Curve cadex::Geom::Curve::Transformed ( const Transformation & theTransformation) const

Returns a copy this object after applying transformation.

The contents of this object is not modified.

See also
Transform().

◆ Type()

CurveType cadex::Geom::Curve::Type ( ) const

Returns a curve type.

◆ UMax()

double cadex::Geom::Curve::UMax ( ) const

Returns a maximum parameter of a definition domain.

See also
UMin(), Domain().

◆ UMin()

double cadex::Geom::Curve::UMin ( ) const

Returns a minimum parameter of a definition domain.

See also
UMax(), Domain().

◆ Value()

Point cadex::Geom::Curve::Value ( double theParameter) const

Evaluates a point on the curve.

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