Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions
Geom2d_OffsetCurve Class Reference

This class implements the basis services for the creation, edition, modification and evaluation of planar offset curve. The offset curve is obtained by offsetting by distance along the normal to a basis curve defined in 2D space. The offset curve in this package can be a self intersecting curve even if the basis curve does not self-intersect. The self intersecting portions are not deleted at the construction time. An offset curve is a curve at constant distance (Offset) from a basis curve and the offset curve takes its parametrization from the basis curve. The Offset curve is in the direction of the normal to the basis curve N. The distance offset may be positive or negative to indicate the preferred side of the curve : . distance offset >0 => the curve is in the direction of N . distance offset >0 => the curve is in the direction of - N On the Offset curve : Value(u) = BasisCurve.Value(U) + (Offset * (T ^ Z)) / ||T ^ Z|| where T is the tangent vector to the basis curve and Z the direction of the normal vector to the plane of the curve, N = T ^ Z defines the offset direction and should not have null length. More...

#include <Geom2d_OffsetCurve.hxx>

Inheritance diagram for Geom2d_OffsetCurve:
Inheritance graph
[legend]

Public Member Functions

 Geom2d_OffsetCurve (const occ::handle< Geom2d_Curve > &C, const double Offset, const bool isNotCheckC0=false)
 Constructs a curve offset from the basis curve C, where Offset is the distance between the offset curve and the basis curve at any point. A point on the offset curve is built by measuring the offset value along a normal vector at a point on C. This normal vector is obtained by rotating the vector tangential to C at 90 degrees in the anti-trigonometric sense. The side of C on which the offset value is measured is indicated by this normal vector if Offset is positive, or in the inverse sense if Offset is negative. If isNotCheckC0 = TRUE checking if basis curve has C0-continuity is not made. Warnings : In this package the entities are not shared. The OffsetCurve is built with a copy of the curve C. So when C is modified the OffsetCurve is not modified Warning! if isNotCheckC0 = false, ConstructionError raised if the basis curve C is not at least C1. No check is done to know if ||V^Z|| != 0.0 at any point.
 
 Geom2d_OffsetCurve (const Geom2d_OffsetCurve &theOther)
 Copy constructor for optimized copying without validation.
 
bool HasEvalRepresentation () const
 Returns true if an evaluation representation is attached.
 
const occ::handle< Geom2dEval_RepCurveDesc::Base > & EvalRepresentation () const
 Returns the current evaluation representation descriptor (may be null).
 
void SetEvalRepresentation (const occ::handle< Geom2dEval_RepCurveDesc::Base > &theDesc)
 Sets a new evaluation representation. Validates descriptor data and ensures no circular references.
 
void ClearEvalRepresentation ()
 Removes the evaluation representation.
 
void Reverse () final
 Changes the direction of parametrization of <me>. As a result:
 
double ReversedParameter (const double U) const final
 Computes the parameter on the reversed curve for the point of parameter U on this offset curve.
 
void SetBasisCurve (const occ::handle< Geom2d_Curve > &C, const bool isNotCheckC0=false)
 Changes this offset curve by assigning C as the basis curve from which it is built. If isNotCheckC0 = TRUE checking if basis curve has C0-continuity is not made. Exceptions if isNotCheckC0 = false, Standard_ConstructionError if the curve C is not at least "C1" continuous.
 
void SetOffsetValue (const double D)
 Changes this offset curve by assigning D as the offset value.
 
occ::handle< Geom2d_CurveBasisCurve () const
 Returns the basis curve of this offset curve. The basis curve can be an offset curve.
 
GeomAbs_Shape Continuity () const final
 Continuity of the Offset curve : C0 : only geometric continuity, C1 : continuity of the first derivative all along the Curve, C2 : continuity of the second derivative all along the Curve, C3 : continuity of the third derivative all along the Curve, G1 : tangency continuity all along the Curve, G2 : curvature continuity all along the Curve, CN : the order of continuity is infinite. Warnings : Returns the continuity of the basis curve - 1. The offset curve must have a unique normal direction defined at any point. Value and derivatives.
 
gp_Pnt2d EvalD0 (const double U) const final
 Warning! this should not be called if the basis curve is not at least C1. Nevertheless if used on portion where the curve is C1, it is OK.
 
Geom2d_Curve::ResD1 EvalD1 (const double U) const final
 Warning! this should not be called if the continuity of the basis curve is not C2. Nevertheless, it's OK to use it on portion where the curve is C2.
 
Geom2d_Curve::ResD2 EvalD2 (const double U) const final
 Warning! This should not be called if the continuity of the basis curve is not C3. Nevertheless, it's OK to use it on portion where the curve is C3.
 
Geom2d_Curve::ResD3 EvalD3 (const double U) const final
 Warning! This should not be called if the continuity of the basis curve is not C4. Nevertheless, it's OK to use it on portion where the curve is C4.
 
gp_Vec2d EvalDN (const double U, const int N) const final
 The returned vector gives the value of the derivative for the order of derivation N. Warning! this should not be called raises UndefunedDerivative if the continuity of the basis curve is not CN+1. Nevertheless, it's OK to use it on portion where the curve is CN+1 raises RangeError if N < 1. raises NotImplemented if N > 3. The following functions compute the value and derivatives on the offset curve and returns the derivatives on the basis curve too. The computation of the value and derivatives on the basis curve are used to evaluate the offset curve Warnings : The exception UndefinedValue or UndefinedDerivative is raised if it is not possible to compute a unique offset direction.
 
double FirstParameter () const final
 Returns the value of the first parameter of this offset curve. The first parameter corresponds to the start point of the curve. Note: the first and last parameters of this offset curve are also the ones of its basis curve.
 
double LastParameter () const final
 Returns the value of the last parameter of this offset curve. The last parameter corresponds to the end point. Note: the first and last parameters of this offset curve are also the ones of its basis curve.
 
double Offset () const
 Returns the offset value of this offset curve.
 
bool IsClosed () const final
 Returns True if the distance between the start point and the end point of the curve is lower or equal to Resolution from package gp.
 
bool IsCN (const int N) const final
 Is the order of continuity of the curve N ? Warnings : This method answer True if the continuity of the basis curve is N + 1. We suppose in this class that a normal direction to the basis curve (used to compute the offset curve) is defined at any point on the basis curve. Raised if N < 0.
 
bool IsPeriodic () const final
 Is the parametrization of a curve is periodic ? If the basis curve is a circle or an ellipse the corresponding OffsetCurve is periodic. If the basis curve can't be periodic (for example BezierCurve) the OffsetCurve can't be periodic.
 
double Period () const final
 Returns the period of this offset curve, i.e. the period of the basis curve of this offset curve. Exceptions Standard_NoSuchObject if the basis curve is not periodic.
 
void Transform (const gp_Trsf2d &T) final
 Applies the transformation T to this offset curve. Note: the basis curve is also modified.
 
double TransformedParameter (const double U, const gp_Trsf2d &T) const final
 Returns the parameter on the transformed curve for the transform of the point of parameter U on <me>.
 
double ParametricTransformation (const gp_Trsf2d &T) const final
 Returns a coefficient to compute the parameter on the transformed curve for the transform of the point on <me>.
 
occ::handle< Geom2d_GeometryCopy () const final
 Creates a new object, which is a copy of this offset curve.
 
GeomAbs_Shape GetBasisCurveContinuity () const
 Returns continuity of the basis curve.
 
void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const final
 Dumps the content of me into the stream.
 
- Public Member Functions inherited from Geom2d_Curve
occ::handle< Geom2d_CurveReversed () const
 Creates a reversed duplicate Changes the orientation of this curve. The first and last parameters are not changed, but the parametric direction of the curve is reversed. If the curve is bounded:
 
void D0 (const double U, gp_Pnt2d &P) const
 Returns in P the point of parameter U.
 
void D1 (const double U, gp_Pnt2d &P, gp_Vec2d &V1) const
 Returns the point P of parameter U and the first derivative V1.
 
void D2 (const double U, gp_Pnt2d &P, gp_Vec2d &V1, gp_Vec2d &V2) const
 Returns the point P of parameter U, the first and second derivatives V1 and V2.
 
void D3 (const double U, gp_Pnt2d &P, gp_Vec2d &V1, gp_Vec2d &V2, gp_Vec2d &V3) const
 Returns the point P of parameter U, the first, the second and the third derivative.
 
gp_Vec2d DN (const double U, const int N) const
 Computes the Nth derivative vector.
 
gp_Pnt2d Value (const double U) const
 Computes the point of parameter U on <me>. Implemented with D0.
 
- Public Member Functions inherited from Geom2d_Geometry
void Mirror (const gp_Pnt2d &P)
 Performs the symmetrical transformation of a Geometry with respect to the point P which is the center of the symmetry and assigns the result to this geometric object.
 
void Mirror (const gp_Ax2d &A)
 Performs the symmetrical transformation of a Geometry with respect to an axis placement which is the axis of the symmetry.
 
void Rotate (const gp_Pnt2d &P, const double Ang)
 Rotates a Geometry. P is the center of the rotation. Ang is the angular value of the rotation in radians.
 
void Scale (const gp_Pnt2d &P, const double S)
 Scales a Geometry. S is the scaling value.
 
void Translate (const gp_Vec2d &V)
 Translates a Geometry. V is the vector of the translation.
 
void Translate (const gp_Pnt2d &P1, const gp_Pnt2d &P2)
 Translates a Geometry from the point P1 to the point P2.
 
occ::handle< Geom2d_GeometryMirrored (const gp_Pnt2d &P) const
 
occ::handle< Geom2d_GeometryMirrored (const gp_Ax2d &A) const
 
occ::handle< Geom2d_GeometryRotated (const gp_Pnt2d &P, const double Ang) const
 
occ::handle< Geom2d_GeometryScaled (const gp_Pnt2d &P, const double S) const
 
occ::handle< Geom2d_GeometryTransformed (const gp_Trsf2d &T) const
 
occ::handle< Geom2d_GeometryTranslated (const gp_Vec2d &V) const
 
occ::handle< Geom2d_GeometryTranslated (const gp_Pnt2d &P1, const gp_Pnt2d &P2) const
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 

Detailed Description

This class implements the basis services for the creation, edition, modification and evaluation of planar offset curve. The offset curve is obtained by offsetting by distance along the normal to a basis curve defined in 2D space. The offset curve in this package can be a self intersecting curve even if the basis curve does not self-intersect. The self intersecting portions are not deleted at the construction time. An offset curve is a curve at constant distance (Offset) from a basis curve and the offset curve takes its parametrization from the basis curve. The Offset curve is in the direction of the normal to the basis curve N. The distance offset may be positive or negative to indicate the preferred side of the curve : . distance offset >0 => the curve is in the direction of N . distance offset >0 => the curve is in the direction of - N On the Offset curve : Value(u) = BasisCurve.Value(U) + (Offset * (T ^ Z)) / ||T ^ Z|| where T is the tangent vector to the basis curve and Z the direction of the normal vector to the plane of the curve, N = T ^ Z defines the offset direction and should not have null length.

Warnings : In this package we suppose that the continuity of the offset curve is one degree less than the continuity of the basis curve and we don't check that at any point ||T^Z|| != 0.0

So to evaluate the curve it is better to check that the offset curve is well defined at any point because an exception could be raised. The check is not done in this package at the creation of the offset curve because the control needs the use of an algorithm which cannot be implemented in this package. The OffsetCurve is closed if the first point and the last point are the same (The distance between these two points is lower or equal to the Resolution sea package gp) . The OffsetCurve can be closed even if the basis curve is not closed.

Constructor & Destructor Documentation

◆ Geom2d_OffsetCurve() [1/2]

Geom2d_OffsetCurve::Geom2d_OffsetCurve ( const occ::handle< Geom2d_Curve > & C,
const double Offset,
const bool isNotCheckC0 = false )

Constructs a curve offset from the basis curve C, where Offset is the distance between the offset curve and the basis curve at any point. A point on the offset curve is built by measuring the offset value along a normal vector at a point on C. This normal vector is obtained by rotating the vector tangential to C at 90 degrees in the anti-trigonometric sense. The side of C on which the offset value is measured is indicated by this normal vector if Offset is positive, or in the inverse sense if Offset is negative. If isNotCheckC0 = TRUE checking if basis curve has C0-continuity is not made. Warnings : In this package the entities are not shared. The OffsetCurve is built with a copy of the curve C. So when C is modified the OffsetCurve is not modified Warning! if isNotCheckC0 = false, ConstructionError raised if the basis curve C is not at least C1. No check is done to know if ||V^Z|| != 0.0 at any point.

◆ Geom2d_OffsetCurve() [2/2]

Geom2d_OffsetCurve::Geom2d_OffsetCurve ( const Geom2d_OffsetCurve & theOther)

Copy constructor for optimized copying without validation.

Member Function Documentation

◆ BasisCurve()

occ::handle< Geom2d_Curve > Geom2d_OffsetCurve::BasisCurve ( ) const

Returns the basis curve of this offset curve. The basis curve can be an offset curve.

◆ ClearEvalRepresentation()

void Geom2d_OffsetCurve::ClearEvalRepresentation ( )
inline

Removes the evaluation representation.

◆ Continuity()

GeomAbs_Shape Geom2d_OffsetCurve::Continuity ( ) const
finalvirtual

Continuity of the Offset curve : C0 : only geometric continuity, C1 : continuity of the first derivative all along the Curve, C2 : continuity of the second derivative all along the Curve, C3 : continuity of the third derivative all along the Curve, G1 : tangency continuity all along the Curve, G2 : curvature continuity all along the Curve, CN : the order of continuity is infinite. Warnings : Returns the continuity of the basis curve - 1. The offset curve must have a unique normal direction defined at any point. Value and derivatives.

Warnings : The exception UndefinedValue or UndefinedDerivative is raised if it is not possible to compute a unique offset direction. If T is the first derivative with not null length and Z the direction normal to the plane of the curve, the relation ||T(U) ^ Z|| != 0 must be satisfied to evaluate the offset curve. No check is done at the creation time and we suppose in this package that the offset curve is well defined.

Implements Geom2d_Curve.

◆ Copy()

occ::handle< Geom2d_Geometry > Geom2d_OffsetCurve::Copy ( ) const
finalvirtual

Creates a new object, which is a copy of this offset curve.

Implements Geom2d_Geometry.

◆ DumpJson()

void Geom2d_OffsetCurve::DumpJson ( Standard_OStream & theOStream,
int theDepth = -1 ) const
finalvirtual

Dumps the content of me into the stream.

Reimplemented from Geom2d_Curve.

◆ EvalD0()

gp_Pnt2d Geom2d_OffsetCurve::EvalD0 ( const double U) const
finalvirtual

Warning! this should not be called if the basis curve is not at least C1. Nevertheless if used on portion where the curve is C1, it is OK.

Implements Geom2d_Curve.

◆ EvalD1()

Geom2d_Curve::ResD1 Geom2d_OffsetCurve::EvalD1 ( const double U) const
finalvirtual

Warning! this should not be called if the continuity of the basis curve is not C2. Nevertheless, it's OK to use it on portion where the curve is C2.

Implements Geom2d_Curve.

◆ EvalD2()

Geom2d_Curve::ResD2 Geom2d_OffsetCurve::EvalD2 ( const double U) const
finalvirtual

Warning! This should not be called if the continuity of the basis curve is not C3. Nevertheless, it's OK to use it on portion where the curve is C3.

Implements Geom2d_Curve.

◆ EvalD3()

Geom2d_Curve::ResD3 Geom2d_OffsetCurve::EvalD3 ( const double U) const
finalvirtual

Warning! This should not be called if the continuity of the basis curve is not C4. Nevertheless, it's OK to use it on portion where the curve is C4.

Implements Geom2d_Curve.

◆ EvalDN()

gp_Vec2d Geom2d_OffsetCurve::EvalDN ( const double U,
const int N ) const
finalvirtual

The returned vector gives the value of the derivative for the order of derivation N. Warning! this should not be called raises UndefunedDerivative if the continuity of the basis curve is not CN+1. Nevertheless, it's OK to use it on portion where the curve is CN+1 raises RangeError if N < 1. raises NotImplemented if N > 3. The following functions compute the value and derivatives on the offset curve and returns the derivatives on the basis curve too. The computation of the value and derivatives on the basis curve are used to evaluate the offset curve Warnings : The exception UndefinedValue or UndefinedDerivative is raised if it is not possible to compute a unique offset direction.

Implements Geom2d_Curve.

◆ EvalRepresentation()

const occ::handle< Geom2dEval_RepCurveDesc::Base > & Geom2d_OffsetCurve::EvalRepresentation ( ) const
inline

Returns the current evaluation representation descriptor (may be null).

◆ FirstParameter()

double Geom2d_OffsetCurve::FirstParameter ( ) const
finalvirtual

Returns the value of the first parameter of this offset curve. The first parameter corresponds to the start point of the curve. Note: the first and last parameters of this offset curve are also the ones of its basis curve.

Implements Geom2d_Curve.

◆ GetBasisCurveContinuity()

GeomAbs_Shape Geom2d_OffsetCurve::GetBasisCurveContinuity ( ) const

Returns continuity of the basis curve.

◆ HasEvalRepresentation()

bool Geom2d_OffsetCurve::HasEvalRepresentation ( ) const
inline

Returns true if an evaluation representation is attached.

◆ IsClosed()

bool Geom2d_OffsetCurve::IsClosed ( ) const
finalvirtual

Returns True if the distance between the start point and the end point of the curve is lower or equal to Resolution from package gp.

Implements Geom2d_Curve.

◆ IsCN()

bool Geom2d_OffsetCurve::IsCN ( const int N) const
finalvirtual

Is the order of continuity of the curve N ? Warnings : This method answer True if the continuity of the basis curve is N + 1. We suppose in this class that a normal direction to the basis curve (used to compute the offset curve) is defined at any point on the basis curve. Raised if N < 0.

Implements Geom2d_Curve.

◆ IsPeriodic()

bool Geom2d_OffsetCurve::IsPeriodic ( ) const
finalvirtual

Is the parametrization of a curve is periodic ? If the basis curve is a circle or an ellipse the corresponding OffsetCurve is periodic. If the basis curve can't be periodic (for example BezierCurve) the OffsetCurve can't be periodic.

Implements Geom2d_Curve.

◆ LastParameter()

double Geom2d_OffsetCurve::LastParameter ( ) const
finalvirtual

Returns the value of the last parameter of this offset curve. The last parameter corresponds to the end point. Note: the first and last parameters of this offset curve are also the ones of its basis curve.

Implements Geom2d_Curve.

◆ Offset()

double Geom2d_OffsetCurve::Offset ( ) const

Returns the offset value of this offset curve.

◆ ParametricTransformation()

double Geom2d_OffsetCurve::ParametricTransformation ( const gp_Trsf2d & T) const
finalvirtual

Returns a coefficient to compute the parameter on the transformed curve for the transform of the point on <me>.

Transformed(T)->Value(U * ParametricTransformation(T))

is the same point as

Value(U).Transformed(T)

This methods calls the basis curve method.

Reimplemented from Geom2d_Curve.

◆ Period()

double Geom2d_OffsetCurve::Period ( ) const
finalvirtual

Returns the period of this offset curve, i.e. the period of the basis curve of this offset curve. Exceptions Standard_NoSuchObject if the basis curve is not periodic.

Reimplemented from Geom2d_Curve.

◆ Reverse()

void Geom2d_OffsetCurve::Reverse ( )
finalvirtual

Changes the direction of parametrization of <me>. As a result:

  • the basis curve is reversed,
  • the start point of the initial curve becomes the end point of the reversed curve,
  • the end point of the initial curve becomes the start point of the reversed curve, and
  • the first and last parameters are recomputed.

Implements Geom2d_Curve.

◆ ReversedParameter()

double Geom2d_OffsetCurve::ReversedParameter ( const double U) const
finalvirtual

Computes the parameter on the reversed curve for the point of parameter U on this offset curve.

Implements Geom2d_Curve.

◆ SetBasisCurve()

void Geom2d_OffsetCurve::SetBasisCurve ( const occ::handle< Geom2d_Curve > & C,
const bool isNotCheckC0 = false )

Changes this offset curve by assigning C as the basis curve from which it is built. If isNotCheckC0 = TRUE checking if basis curve has C0-continuity is not made. Exceptions if isNotCheckC0 = false, Standard_ConstructionError if the curve C is not at least "C1" continuous.

◆ SetEvalRepresentation()

void Geom2d_OffsetCurve::SetEvalRepresentation ( const occ::handle< Geom2dEval_RepCurveDesc::Base > & theDesc)

Sets a new evaluation representation. Validates descriptor data and ensures no circular references.

◆ SetOffsetValue()

void Geom2d_OffsetCurve::SetOffsetValue ( const double D)

Changes this offset curve by assigning D as the offset value.

◆ Transform()

void Geom2d_OffsetCurve::Transform ( const gp_Trsf2d & T)
finalvirtual

Applies the transformation T to this offset curve. Note: the basis curve is also modified.

Implements Geom2d_Geometry.

◆ TransformedParameter()

double Geom2d_OffsetCurve::TransformedParameter ( const double U,
const gp_Trsf2d & T ) const
finalvirtual

Returns the parameter on the transformed curve for the transform of the point of parameter U on <me>.

me->Transformed(T)->Value(me->TransformedParameter(U,T))

is the same point as

me->Value(U).Transformed(T)

This methods calls the basis curve method.

Reimplemented from Geom2d_Curve.


The documentation for this class was generated from the following file: