Open CASCADE Technology  6.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions
Geom2d_BezierCurve Class Reference

Describes a rational or non-rational Bezier curve
More...

#include <Geom2d_BezierCurve.hxx>

Inheritance diagram for Geom2d_BezierCurve:
Inheritance graph
[legend]

Public Member Functions

 Geom2d_BezierCurve (const TColgp_Array1OfPnt2d &CurvePoles)
 Creates a non rational Bezier curve with a set of poles :
CurvePoles. The weights are defaulted to all being 1.
Raises ConstructionError if the number of poles is greater than MaxDegree + 1
or lower than 2.
More...
 
 Geom2d_BezierCurve (const TColgp_Array1OfPnt2d &CurvePoles, const TColStd_Array1OfReal &PoleWeights)
 Creates a rational Bezier curve with the set of poles
CurvePoles and the set of weights PoleWeights .
If all the weights are identical the curve is considered
as non rational. Raises ConstructionError if
the number of poles is greater than MaxDegree + 1 or lower
than 2 or CurvePoles and CurveWeights have not the same length
or one weight value is lower or equal to Resolution from
package gp.
More...
 
void Increase (const Standard_Integer Degree)
 Increases the degree of a bezier curve. Degree is the new
degree of <me>.
raises ConstructionError if Degree is greater than MaxDegree or lower than 2
or lower than the initial degree of <me>.
More...
 
void InsertPoleAfter (const Standard_Integer Index, const gp_Pnt2d &P, const Standard_Real Weight=1.0)
 Inserts a pole with its weight in the set of poles after the
pole of range Index. If the curve was non rational it can
become rational if all the weights are not identical.
//! Raised if Index is not in the range [0, NbPoles]
Raised if the resulting number of poles is greater than
MaxDegree + 1.
More...
 
void InsertPoleBefore (const Standard_Integer Index, const gp_Pnt2d &P, const Standard_Real Weight=1.0)
 Inserts a pole with its weight in the set of poles after
the pole of range Index. If the curve was non rational it
can become rational if all the weights are not identical.
//! Raised if Index is not in the range [1, NbPoles+1]
Raised if the resulting number of poles is greater than
MaxDegree + 1.
More...
 
void RemovePole (const Standard_Integer Index)
 
Removes the pole of range Index. <br>

If the curve was rational it can become non rational.
//! Raised if Index is not in the range [1, NbPoles]
More...

 
void Reverse ()
 Reverses the direction of parametrization of <me>
Value (NewU) = Value (1 - OldU)
More...
 
Standard_Real ReversedParameter (const Standard_Real U) const
 
 Returns the  parameter on the  reversed  curve for <br>
     the point of parameter U on <me>. <br>


returns 1-U
More...

 
void Segment (const Standard_Real U1, const Standard_Real U2)
 
Segments the curve between U1 and U2 which can be out <br>

of the bounds of the curve. The curve is oriented from U1
to U2.
The control points are modified, the first and the last point
are not the same but the parametrization range is [0, 1]
else it could not be a Bezier curve.
Warnings :
Even if <me> is not closed it can become closed after the
segmentation for example if U1 or U2 are out of the bounds
of the curve <me> or if the curve makes loop.
After the segmentation the length of a curve can be null.
More...

 
void SetPole (const Standard_Integer Index, const gp_Pnt2d &P)
 Substitutes the pole of range index with P.
If the curve <me> is rational the weight of range Index
is not modified.
//! raiseD if Index is not in the range [1, NbPoles]
More...
 
void SetPole (const Standard_Integer Index, const gp_Pnt2d &P, const Standard_Real Weight)
 Substitutes the pole and the weights of range Index.
If the curve <me> is not rational it can become rational
if all the weights are not identical.
If the curve was rational it can become non rational if
all the weights are identical.
//! Raised if Index is not in the range [1, NbPoles]
//! Raised if Weight <= Resolution from package gp
More...
 
void SetWeight (const Standard_Integer Index, const Standard_Real Weight)
 Changes the weight of the pole of range Index.
If the curve <me> is not rational it can become rational
if all the weights are not identical.
If the curve was rational it can become non rational if
all the weights are identical.
//! Raised if Index is not in the range [1, NbPoles]
//! Raised if Weight <= Resolution from package gp
More...
 
Standard_Boolean IsClosed () const
 Returns True if the distance between the first point
and the last point of the curve is lower or equal to
the Resolution from package gp.
More...
 
Standard_Boolean IsCN (const Standard_Integer N) const
 Continuity of the curve, returns True.
More...
 
Standard_Boolean IsPeriodic () const
 Returns False. A BezierCurve cannot be periodic in this
package
More...
 
Standard_Boolean IsRational () const
 Returns false if all the weights are identical. The tolerance
criterion is Resolution from package gp.
More...
 
GeomAbs_Shape Continuity () const
 Returns GeomAbs_CN, which is the continuity of any Bezier curve.
More...
 
Standard_Integer Degree () const
 Returns the polynomial degree of the curve. It is the number
of poles less one. In this package the Degree of a Bezier
curve cannot be greater than "MaxDegree".
More...
 
void D0 (const Standard_Real U, gp_Pnt2d &P) const
 
Returns in P the point of parameter U. <br>

If the curve is periodic then the returned point is P(U) with
U = Ustart + (U - Uend) where Ustart and Uend are the
parametric bounds of the curve.
Raised 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.
More...

 
void D1 (const Standard_Real U, gp_Pnt2d &P, gp_Vec2d &V1) const
 Returns the point P of parameter U and the first derivative V1.
//! Raised if the continuity of the curve is not C1.
More...
 
void D2 (const Standard_Real 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.
//! Raised if the continuity of the curve is not C2.
More...
 
void D3 (const Standard_Real 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.
//! Raised if the continuity of the curve is not C3.
More...
 
gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const
 For this Bezier curve, computes
More...
 
gp_Pnt2d EndPoint () const
 Returns the end point or start point of this Bezier curve.
More...
 
Standard_Real FirstParameter () const
 
 Returns the value of the first  parameter of this <br>

Bezier curve. This is 0.0, which gives the start point of this Bezier curve.
More...

 
Standard_Real LastParameter () const
 
 Returns the value of the last  parameter of this <br>

Bezier curve. This is 1.0, which gives the end point of this Bezier curve.
More...

 
Standard_Integer NbPoles () const
 Returns the number of poles for this Bezier curve.
More...
 
gp_Pnt2d Pole (const Standard_Integer Index) const
 Returns the pole of range Index.
//! Raised if Index is not in the range [1, NbPoles]
More...
 
void Poles (TColgp_Array1OfPnt2d &P) const
 
Returns all the poles of the curve. <br>

Raised if the length of P is not equal to the number of poles.
More...

 
gp_Pnt2d StartPoint () const
 Returns Value (U=1), it is the first control point
of the curve.
More...
 
Standard_Real Weight (const Standard_Integer Index) const
 Returns the weight of range Index.
//! Raised if Index is not in the range [1, NbPoles]
More...
 
void Weights (TColStd_Array1OfReal &W) const
 
Returns all the weights of the curve. <br>

Raised if the length of W is not equal to the number of poles.
More...

 
void Transform (const gp_Trsf2d &T)
 Applies the transformation T to this Bezier curve.
More...
 
void Resolution (const Standard_Real ToleranceUV, Standard_Real &UTolerance)
 
  Computes for this Bezier curve the parametric <br>

tolerance UTolerance for a given tolerance
Tolerance3D (relative to dimensions in the plane).
If f(t) is the equation of this Bezier curve,
UTolerance ensures that
| t1 - t0| < Utolerance ===>
|f(t1) - f(t0)| < ToleranceUV
More...

 
Handle_Geom2d_Geometry Copy () const
 Creates a new object which is a copy of this Bezier curve.
More...
 
- Public Member Functions inherited from Geom2d_Curve
virtual Standard_Real TransformedParameter (const Standard_Real U, const gp_Trsf2d &T) const
 
 Computes the parameter on the curve transformed by <br>

T for the point of parameter U on this curve.
Note: this function generally returns U but it can be
redefined (for example, on a line).
More...

 
virtual Standard_Real ParametricTransformation (const gp_Trsf2d &T) const
 
 Returns the coefficient required to compute the <br>

parametric transformation of this curve when
transformation T is applied. This coefficient is the
ratio between the parameter of a point on this curve
and the parameter of the transformed point on the
new curve transformed by T.
Note: this function generally returns 1. but it can be
redefined (for example, on a line).
More...

 
Handle_Geom2d_Curve Reversed () const
 
 Creates a reversed duplicate Changes the orientation of this curve. The first and <br>

last parameters are not changed, but the parametric
direction of the curve is reversed.
If the curve is bounded:
More...

 
virtual Standard_Real Period () const
 Returns thne period of this curve.
//! raises if the curve is not periodic
More...
 
gp_Pnt2d Value (const Standard_Real U) const
 
 Computes the point of parameter U on <me>. <br>

If the curve is periodic then the returned point is P(U) with
U = Ustart + (U - Uend) where Ustart and Uend are the
parametric bounds of the curve.

it is implemented with D0.
Raised 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.
More...

 
- Public Member Functions inherited from Geom2d_Geometry
void Mirror (const gp_Pnt2d &P)
 
Performs the symmetrical transformation of a Geometry <br>

with respect to the point P which is the center of the
symmetry and assigns the result to this geometric object.
More...

 
void Mirror (const gp_Ax2d &A)
 
Performs the symmetrical transformation of a Geometry <br>

with respect to an axis placement which is the axis of the symmetry.
More...

 
void Rotate (const gp_Pnt2d &P, const Standard_Real Ang)
 
Rotates a Geometry. P is the center of the rotation. <br>

Ang is the angular value of the rotation in radians.
More...

 
void Scale (const gp_Pnt2d &P, const Standard_Real S)
 Scales a Geometry. S is the scaling value.
More...
 
void Translate (const gp_Vec2d &V)
 Translates a Geometry. V is the vector of the tanslation.
More...
 
void Translate (const gp_Pnt2d &P1, const gp_Pnt2d &P2)
 Translates a Geometry from the point P1 to the point P2.
More...
 
Handle_Geom2d_Geometry Mirrored (const gp_Pnt2d &P) const
 
Handle_Geom2d_Geometry Mirrored (const gp_Ax2d &A) const
 
Handle_Geom2d_Geometry Rotated (const gp_Pnt2d &P, const Standard_Real Ang) const
 
Handle_Geom2d_Geometry Scaled (const gp_Pnt2d &P, const Standard_Real S) const
 
Handle_Geom2d_Geometry Transformed (const gp_Trsf2d &T) const
 
Handle_Geom2d_Geometry Translated (const gp_Vec2d &V) const
 
Handle_Geom2d_Geometry Translated (const gp_Pnt2d &P1, const gp_Pnt2d &P2) const
 
- Public Member Functions inherited from MMgt_TShared
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void ShallowDump (Standard_OStream &) const
 
virtual const
Handle_Standard_Type & 
DynamicType () const
 Returns a type information object about this object. More...
 
Standard_Boolean IsInstance (const Handle_Standard_Type &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const 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. More...
 
Standard_Boolean IsKind (const Standard_CString 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. More...
 
virtual Handle_Standard_Transient This () const
 Returns a Handle which references this object. Must never be called to objects created in stack. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 

Static Public Member Functions

static Standard_Integer MaxDegree ()
 Returns the value of the maximum polynomial degree of a
BezierCurve. This value is 25.
More...
 

Detailed Description

Describes a rational or non-rational Bezier curve

Constructor & Destructor Documentation

Geom2d_BezierCurve::Geom2d_BezierCurve ( const TColgp_Array1OfPnt2d CurvePoles)

Creates a non rational Bezier curve with a set of poles :
CurvePoles. The weights are defaulted to all being 1.
Raises ConstructionError if the number of poles is greater than MaxDegree + 1
or lower than 2.

Geom2d_BezierCurve::Geom2d_BezierCurve ( const TColgp_Array1OfPnt2d CurvePoles,
const TColStd_Array1OfReal PoleWeights 
)

Creates a rational Bezier curve with the set of poles
CurvePoles and the set of weights PoleWeights .
If all the weights are identical the curve is considered
as non rational. Raises ConstructionError if
the number of poles is greater than MaxDegree + 1 or lower
than 2 or CurvePoles and CurveWeights have not the same length
or one weight value is lower or equal to Resolution from
package gp.

Member Function Documentation

GeomAbs_Shape Geom2d_BezierCurve::Continuity ( ) const
virtual

Returns GeomAbs_CN, which is the continuity of any Bezier curve.

Implements Geom2d_Curve.

Handle_Geom2d_Geometry Geom2d_BezierCurve::Copy ( ) const
virtual

Creates a new object which is a copy of this Bezier curve.

Implements Geom2d_Geometry.

void Geom2d_BezierCurve::D0 ( const Standard_Real  U,
gp_Pnt2d P 
) const
virtual

Returns in P the point of parameter U. <br>

If the curve is periodic then the returned point is P(U) with
U = Ustart + (U - Uend) where Ustart and Uend are the
parametric bounds of the curve.
Raised 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.

Implements Geom2d_Curve.

void Geom2d_BezierCurve::D1 ( const Standard_Real  U,
gp_Pnt2d P,
gp_Vec2d V1 
) const
virtual

Returns the point P of parameter U and the first derivative V1.
//! Raised if the continuity of the curve is not C1.

Implements Geom2d_Curve.

void Geom2d_BezierCurve::D2 ( const Standard_Real  U,
gp_Pnt2d P,
gp_Vec2d V1,
gp_Vec2d V2 
) const
virtual

Returns the point P of parameter U, the first and second
derivatives V1 and V2.
//! Raised if the continuity of the curve is not C2.

Implements Geom2d_Curve.

void Geom2d_BezierCurve::D3 ( const Standard_Real  U,
gp_Pnt2d P,
gp_Vec2d V1,
gp_Vec2d V2,
gp_Vec2d V3 
) const
virtual

Returns the point P of parameter U, the first, the second
and the third derivative.
//! Raised if the continuity of the curve is not C3.

Implements Geom2d_Curve.

Standard_Integer Geom2d_BezierCurve::Degree ( ) const

Returns the polynomial degree of the curve. It is the number
of poles less one. In this package the Degree of a Bezier
curve cannot be greater than "MaxDegree".

gp_Vec2d Geom2d_BezierCurve::DN ( const Standard_Real  U,
const Standard_Integer  N 
) const
virtual

For this Bezier curve, computes

  • the point P of parameter U, or
  • the point P and one or more of the following values:
    • V1, the first derivative vector,
    • V2, the second derivative vector,
    • V3, the third derivative vector.
      Note: the parameter U can be outside the bounds of the curve.
      Raises RangeError if N < 1.

Implements Geom2d_Curve.

gp_Pnt2d Geom2d_BezierCurve::EndPoint ( ) const
virtual

Returns the end point or start point of this Bezier curve.

Implements Geom2d_BoundedCurve.

Standard_Real Geom2d_BezierCurve::FirstParameter ( ) const
virtual

 Returns the value of the first  parameter of this <br>

Bezier curve. This is 0.0, which gives the start point of this Bezier curve.

Implements Geom2d_Curve.

void Geom2d_BezierCurve::Increase ( const Standard_Integer  Degree)

Increases the degree of a bezier curve. Degree is the new
degree of <me>.
raises ConstructionError if Degree is greater than MaxDegree or lower than 2
or lower than the initial degree of <me>.

void Geom2d_BezierCurve::InsertPoleAfter ( const Standard_Integer  Index,
const gp_Pnt2d P,
const Standard_Real  Weight = 1.0 
)

Inserts a pole with its weight in the set of poles after the
pole of range Index. If the curve was non rational it can
become rational if all the weights are not identical.
//! Raised if Index is not in the range [0, NbPoles]
Raised if the resulting number of poles is greater than
MaxDegree + 1.

void Geom2d_BezierCurve::InsertPoleBefore ( const Standard_Integer  Index,
const gp_Pnt2d P,
const Standard_Real  Weight = 1.0 
)

Inserts a pole with its weight in the set of poles after
the pole of range Index. If the curve was non rational it
can become rational if all the weights are not identical.
//! Raised if Index is not in the range [1, NbPoles+1]
Raised if the resulting number of poles is greater than
MaxDegree + 1.

Standard_Boolean Geom2d_BezierCurve::IsClosed ( ) const
virtual

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

Implements Geom2d_Curve.

Standard_Boolean Geom2d_BezierCurve::IsCN ( const Standard_Integer  N) const
virtual

Continuity of the curve, returns True.

Implements Geom2d_Curve.

Standard_Boolean Geom2d_BezierCurve::IsPeriodic ( ) const
virtual

Returns False. A BezierCurve cannot be periodic in this
package

Implements Geom2d_Curve.

Standard_Boolean Geom2d_BezierCurve::IsRational ( ) const

Returns false if all the weights are identical. The tolerance
criterion is Resolution from package gp.

Standard_Real Geom2d_BezierCurve::LastParameter ( ) const
virtual

 Returns the value of the last  parameter of this <br>

Bezier curve. This is 1.0, which gives the end point of this Bezier curve.

Implements Geom2d_Curve.

static Standard_Integer Geom2d_BezierCurve::MaxDegree ( )
static

Returns the value of the maximum polynomial degree of a
BezierCurve. This value is 25.

Standard_Integer Geom2d_BezierCurve::NbPoles ( ) const

Returns the number of poles for this Bezier curve.

gp_Pnt2d Geom2d_BezierCurve::Pole ( const Standard_Integer  Index) const

Returns the pole of range Index.
//! Raised if Index is not in the range [1, NbPoles]

void Geom2d_BezierCurve::Poles ( TColgp_Array1OfPnt2d P) const

Returns all the poles of the curve. <br>

Raised if the length of P is not equal to the number of poles.

void Geom2d_BezierCurve::RemovePole ( const Standard_Integer  Index)

Removes the pole of range Index. <br>

If the curve was rational it can become non rational.
//! Raised if Index is not in the range [1, NbPoles]

void Geom2d_BezierCurve::Resolution ( const Standard_Real  ToleranceUV,
Standard_Real UTolerance 
)

  Computes for this Bezier curve the parametric <br>

tolerance UTolerance for a given tolerance
Tolerance3D (relative to dimensions in the plane).
If f(t) is the equation of this Bezier curve,
UTolerance ensures that
| t1 - t0| < Utolerance ===>
|f(t1) - f(t0)| < ToleranceUV

void Geom2d_BezierCurve::Reverse ( )
virtual

Reverses the direction of parametrization of <me>
Value (NewU) = Value (1 - OldU)

Implements Geom2d_Curve.

Standard_Real Geom2d_BezierCurve::ReversedParameter ( const Standard_Real  U) const
virtual

 Returns the  parameter on the  reversed  curve for <br>
     the point of parameter U on <me>. <br>


returns 1-U

Implements Geom2d_Curve.

void Geom2d_BezierCurve::Segment ( const Standard_Real  U1,
const Standard_Real  U2 
)

Segments the curve between U1 and U2 which can be out <br>

of the bounds of the curve. The curve is oriented from U1
to U2.
The control points are modified, the first and the last point
are not the same but the parametrization range is [0, 1]
else it could not be a Bezier curve.
Warnings :
Even if <me> is not closed it can become closed after the
segmentation for example if U1 or U2 are out of the bounds
of the curve <me> or if the curve makes loop.
After the segmentation the length of a curve can be null.

void Geom2d_BezierCurve::SetPole ( const Standard_Integer  Index,
const gp_Pnt2d P 
)

Substitutes the pole of range index with P.
If the curve <me> is rational the weight of range Index
is not modified.
//! raiseD if Index is not in the range [1, NbPoles]

void Geom2d_BezierCurve::SetPole ( const Standard_Integer  Index,
const gp_Pnt2d P,
const Standard_Real  Weight 
)

Substitutes the pole and the weights of range Index.
If the curve <me> is not rational it can become rational
if all the weights are not identical.
If the curve was rational it can become non rational if
all the weights are identical.
//! Raised if Index is not in the range [1, NbPoles]
//! Raised if Weight <= Resolution from package gp

void Geom2d_BezierCurve::SetWeight ( const Standard_Integer  Index,
const Standard_Real  Weight 
)

Changes the weight of the pole of range Index.
If the curve <me> is not rational it can become rational
if all the weights are not identical.
If the curve was rational it can become non rational if
all the weights are identical.
//! Raised if Index is not in the range [1, NbPoles]
//! Raised if Weight <= Resolution from package gp

gp_Pnt2d Geom2d_BezierCurve::StartPoint ( ) const
virtual

Returns Value (U=1), it is the first control point
of the curve.

Implements Geom2d_BoundedCurve.

void Geom2d_BezierCurve::Transform ( const gp_Trsf2d T)
virtual

Applies the transformation T to this Bezier curve.

Implements Geom2d_Geometry.

Standard_Real Geom2d_BezierCurve::Weight ( const Standard_Integer  Index) const

Returns the weight of range Index.
//! Raised if Index is not in the range [1, NbPoles]

void Geom2d_BezierCurve::Weights ( TColStd_Array1OfReal W) const

Returns all the weights of the curve. <br>

Raised if the length of W is not equal to the number of poles.


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