#include <opennurbs_bezier.h>

Public Member Functions

 ON_BezierCurve ()
 
 ON_BezierCurve (int dim, bool bIsRational, int order)
 Creates a bezier with cv memory allocated. More...
 
 ON_BezierCurve (const ON_BezierCurve &)
 
 ON_BezierCurve (const ON_PolynomialCurve &)
 
 ON_BezierCurve (const ON_2dPointArray &)
 
 ON_BezierCurve (const ON_3dPointArray &)
 
 ON_BezierCurve (const ON_4dPointArray &)
 
 ~ON_BezierCurve ()
 
ON_BoundingBox BoundingBox () const
 Gets bounding box. More...
 
bool ChangeDimension (int desired_dimension)
 Change dimension of bezier. More...
 
bool ChangeWeights (int i0, double w0, int i1, double w1)
 Use a combination of scaling and reparameterization to set two rational Bezier weights to specified values. More...
 
const ON_4dPoint ControlPoint (int cv_index) const
 
double ControlPolygonLength () const
 returns the length of the control polygon More...
 
bool Create (int dim, bool bIsRational, int order)
 Creates a bezier with cv memory allocated. More...
 
ON_3dVector CurvatureAt (double t) const
 Evaluate the curvature vector at a parameter. More...
 
double * CV (int cv_index) const
 Expert user function to get a pointer to control vertex memory. If you are not an expert user, please use ON_BezierCurve::GetCV( ON_3dPoint& ) or ON_BezierCurve::GetCV( ON_4dPoint& ). More...
 
int CVCount () const
 
int CVSize () const
 
ON::point_style CVStyle () const
 Returns the style of control vertices in the m_cv array. More...
 
int Degree () const
 
ON_3dVector DerivativeAt (double t) const
 Evaluate first derivative at a parameter. More...
 
void Destroy ()
 Deallocates m_cv memory. More...
 
int Dimension () const
 
ON_Interval Domain () const
 
void Dump (ON_TextLog &) const
 
void EmergencyDestroy ()
 
bool Ev1Der (double t, ON_3dPoint &point, ON_3dVector &first_derivative) const
 Evaluate first derivative at a parameter with error checking. More...
 
bool Ev2Der (double t, ON_3dPoint &point, ON_3dVector &first_derivative, ON_3dVector &second_derivative) const
 Evaluate second derivative at a parameter with error checking. More...
 
bool Evaluate (double t, int der_count, int v_stride, double *v) const
 Evaluate a bezier. More...
 
bool EvCurvature (double t, ON_3dPoint &point, ON_3dVector &tangent, ON_3dVector &kappa) const
 Evaluate unit tangent and curvature at a parameter with error checking. More...
 
bool EvPoint (double t, ON_3dPoint &point) const
 Evaluate point at a parameter with error checking. More...
 
bool EvTangent (double t, ON_3dPoint &point, ON_3dVector &tangent) const
 Evaluate unit tangent at a parameter with error checking. More...
 
bool GetBBox (double *box_min, double *box_max, bool bGrowBox=false) const
 Gets bounding box. More...
 
bool GetBoundingBox (ON_BoundingBox &bbox, int bGrowBox=false) const
 Gets bounding box. More...
 
bool GetCV (int cv_index, ON::point_style pointstyle, double *cv) const
 Get location of a control vertex. More...
 
bool GetCV (int cv_index, ON_3dPoint &point) const
 Get location of a control vertex. More...
 
bool GetCV (int cv_index, ON_4dPoint &point) const
 Get value of a control vertex. More...
 
int GetNurbForm (ON_NurbsCurve &nurbs_curve) const
 Get ON_NurbsCurve form of a bezier. More...
 
bool GetTightBoundingBox (ON_BoundingBox &tight_bbox, bool bGrowBox=false, const ON_Xform *xform=nullptr) const
 Get tight bounding box of the bezier. More...
 
bool IncreaseDegree (int desired_degree)
 Increase degree of bezier. More...
 
bool IsRational () const
 
bool IsValid () const
 
bool Loft (const ON_3dPointArray &points)
 Loft a bezier curve through a list of points. More...
 
bool Loft (int pt_dim, int pt_count, int pt_stride, const double *pt, int t_stride, const double *t)
 Loft a bezier curve through a list of points. More...
 
bool MakeNonRational ()
 Make beizer not rational by setting all control vertices to their euclidean locations and setting m_is_rat to false. More...
 
bool MakeRational ()
 Make beizer rational. More...
 
ON_BezierCurveoperator= (const ON_BezierCurve &)
 
ON_BezierCurveoperator= (const ON_PolynomialCurve &)
 
ON_BezierCurveoperator= (const ON_2dPointArray &)
 
ON_BezierCurveoperator= (const ON_3dPointArray &)
 
ON_BezierCurveoperator= (const ON_4dPointArray &)
 
int Order () const
 
ON_3dPoint PointAt (double t) const
 Evaluate point at a parameter. More...
 
bool Reparameterize (double c)
 Use a linear fractional tranformation for [0,1] to reparameterize the bezier. The locus of the curve is not changed, but the parameterization is changed. More...
 
bool Reparametrize (double)
 misspelled function name is obsolete More...
 
bool ReserveCVCapacity (int desired_cv_capacity)
 Tools for managing CV and knot memory. More...
 
bool Reverse ()
 Reverses bezier by reversing the order of the control points. More...
 
bool Rotate (double sin_angle, double cos_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 Rotates the bezier curve about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule). More...
 
bool Rotate (double rotation_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 Rotates the bezier curve about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule). More...
 
bool Scale (double scale_factor)
 Scales the bezier curve by the specified facotor. The scale is centered at the origin. More...
 
bool ScaleConrolPoints (int i, double w)
 Scale a rational Bezier's control vertices to set a weight to a specified value. More...
 
bool SetCV (int cv_index, ON::point_style pointstyle, const double *cv)
 Set control vertex More...
 
bool SetCV (int cv_index, const ON_3dPoint &point)
 Set location of a control vertex. More...
 
bool SetCV (int cv_index, const ON_4dPoint &point)
 Set value of a control vertex. More...
 
bool SetWeight (int cv_index, double weight)
 Set weight of a control vertex. More...
 
bool Split (double t, ON_BezierCurve &left_side, ON_BezierCurve &right_side) const
 Split() divides the Bezier curve at the specified parameter. The parameter must satisfy 0 < t < 1. You may pass *this as one of the curves to be returned. More...
 
ON_3dVector TangentAt (double t) const
 Evaluate unit tangent vector at a parameter. More...
 
bool Transform (const ON_Xform &xform)
 Transform the bezier. More...
 
bool Translate (const ON_3dVector &translation_vector)
 Translates the bezier curve along the specified vector. More...
 
bool Trim (const ON_Interval &interval)
 Trims (or extends) the bezier so the bezier so that the result starts bezier(interval[0]) and ends at bezier(interval[1]) (Evaluation performed on input bezier.) More...
 
double Weight (int cv_index) const
 
bool ZeroCVs ()
 Zeros control vertices and, if rational, sets weights to 1. More...
 

Public Attributes

double * m_cv
 The i-th cv begins at cv[i*m_cv_stride]. More...
 
int m_cv_capacity
 
int m_cv_stride
 Number of doubles per cv ( >= ((m_is_rat)?m_dim+1:m_dim) ) More...
 
int m_dim
 Implementation. More...
 
int m_is_rat
 1 if bezier is rational, 0 if bezier is not rational More...
 
int m_order
 order = degree+1 More...
 

Constructor & Destructor Documentation

◆ ON_BezierCurve() [1/7]

ON_BezierCurve::ON_BezierCurve ( )

◆ ON_BezierCurve() [2/7]

ON_BezierCurve::ON_BezierCurve ( int  dim,
bool  bIsRational,
int  order 
)

Creates a bezier with cv memory allocated.

Parameters
dim[in] (>0) dimension of bezier curve
bIsRational[in] true for a rational bezier
order[in] (>=2) order (=degree+1) of bezier curve

◆ ~ON_BezierCurve()

ON_BezierCurve::~ON_BezierCurve ( )

◆ ON_BezierCurve() [3/7]

ON_BezierCurve::ON_BezierCurve ( const ON_BezierCurve )

◆ ON_BezierCurve() [4/7]

ON_BezierCurve::ON_BezierCurve ( const ON_PolynomialCurve )

◆ ON_BezierCurve() [5/7]

ON_BezierCurve::ON_BezierCurve ( const ON_2dPointArray )

◆ ON_BezierCurve() [6/7]

ON_BezierCurve::ON_BezierCurve ( const ON_3dPointArray )

◆ ON_BezierCurve() [7/7]

ON_BezierCurve::ON_BezierCurve ( const ON_4dPointArray )

Member Function Documentation

◆ BoundingBox()

ON_BoundingBox ON_BezierCurve::BoundingBox ( ) const

Gets bounding box.

Returns
Axis aligned bounding box.

◆ ChangeDimension()

bool ON_BezierCurve::ChangeDimension ( int  desired_dimension)

Change dimension of bezier.

Parameters
desired_dimension[in]
Returns
true if successful. false if desired_dimension < 1

◆ ChangeWeights()

bool ON_BezierCurve::ChangeWeights ( int  i0,
double  w0,
int  i1,
double  w1 
)

Use a combination of scaling and reparameterization to set two rational Bezier weights to specified values.

Parameters
i0[in] control point index (0 <= i0 < order, i0 != i1)
w0[in] Desired weight for i0-th control point
i1[in] control point index (0 <= i1 < order, i0 != i1)
w1[in] Desired weight for i1-th control point
Returns
True if successful. The returned bezier has the same locus but probably has a different parameterization.

The i0-th cv will have weight w0 and the i1-rst cv will have weight w1. If v0 and v1 are the cv's input weights, then v0, v1, w0 and w1 must all be nonzero, and w0*v0 and w1*v1 must have the same sign.

The equations

    s * r^i0 = w0/v0
    s * r^i1 = w1/v1

determine the scaling and reparameterization necessary to change v0,v1 to w0,w1.

If the input Bezier has control vertices

    (B_0, ..., B_d),

then the output Bezier has control vertices

    (s*B_0, ... s*r^i * B_i, ..., s*r^d * B_d).
See also
ON_Bezier::Reparameterize, ON_Bezier::ScaleConrolPoints

◆ ControlPoint()

const ON_4dPoint ON_BezierCurve::ControlPoint ( int  cv_index) const
Parameters
cv_index[in] zero based control point index
Returns
Control point as an ON_4dPoint.

If cv_index or the bezier is not valid, then ON_4dPoint::Nan is returned. If dim < 3, unused coordinates are zero. If dim >= 4, the first three coordinates are returned. If is_rat is false, the weight is 1.

◆ ControlPolygonLength()

double ON_BezierCurve::ControlPolygonLength ( ) const

returns the length of the control polygon

◆ Create()

bool ON_BezierCurve::Create ( int  dim,
bool  bIsRational,
int  order 
)

Creates a bezier with cv memory allocated.

Parameters
dim[in] (>0) dimension of bezier curve
bIsRational[in] true for a rational bezier
order[in] (>=2) order (=degree+1) of bezier curve
Returns
true if successful.

◆ CurvatureAt()

ON_3dVector ON_BezierCurve::CurvatureAt ( double  t) const

Evaluate the curvature vector at a parameter.

Parameters
t[in] evaluation parameter
Returns
curvature vector of the curve at the parameter t.

No error handling.

See also
ON_Curve::EvCurvature

◆ CV()

double* ON_BezierCurve::CV ( int  cv_index) const

Expert user function to get a pointer to control vertex memory. If you are not an expert user, please use ON_BezierCurve::GetCV( ON_3dPoint& ) or ON_BezierCurve::GetCV( ON_4dPoint& ).

Parameters
cv_index[in] (0 <= cv_index < m_order)
Returns
Pointer to control vertex.

If the Bezier curve is rational, the format of the returned array is a homogeneos rational point with length m_dim+1. If the Bezier curve is not rational, the format of the returned array is a nonrational euclidean point with length m_dim. See Also ON_BezierCurve::CVStyle ON_BezierCurve::GetCV ON_BezierCurve::Weight

◆ CVCount()

int ON_BezierCurve::CVCount ( ) const
Returns
Number of control vertices in the bezier. This is always the same as the order of the bezier.

◆ CVSize()

int ON_BezierCurve::CVSize ( ) const
Returns
Number of doubles per control vertex. (= IsRational() ? Dim()+1 : Dim())

◆ CVStyle()

ON::point_style ON_BezierCurve::CVStyle ( ) const

Returns the style of control vertices in the m_cv array.

Returns
table ON::not_rational m_is_rat is false ON::homogeneous_rational m_is_rat is true

◆ Degree()

int ON_BezierCurve::Degree ( ) const
Returns
Degree of the bezier. (degree=order-1)

◆ DerivativeAt()

ON_3dVector ON_BezierCurve::DerivativeAt ( double  t) const

Evaluate first derivative at a parameter.

Parameters
t[in] evaluation parameter
Returns
First derivative of the curve at the parameter t.

No error handling.

See also
ON_Curve::Ev1Der

◆ Destroy()

void ON_BezierCurve::Destroy ( )

Deallocates m_cv memory.

◆ Dimension()

int ON_BezierCurve::Dimension ( ) const
Returns
Dimension of bezier.

◆ Domain()

ON_Interval ON_BezierCurve::Domain ( ) const
Returns
Domain of bezier (always [0,1]).

◆ Dump()

void ON_BezierCurve::Dump ( ON_TextLog ) const

◆ EmergencyDestroy()

void ON_BezierCurve::EmergencyDestroy ( )

◆ Ev1Der()

bool ON_BezierCurve::Ev1Der ( double  t,
ON_3dPoint point,
ON_3dVector first_derivative 
) const

Evaluate first derivative at a parameter with error checking.

Parameters
t[in] evaluation parameter
point[out] value of curve at t
first_derivative[out] value of first derivative at t
Returns
false if unable to evaluate.

◆ Ev2Der()

bool ON_BezierCurve::Ev2Der ( double  t,
ON_3dPoint point,
ON_3dVector first_derivative,
ON_3dVector second_derivative 
) const

Evaluate second derivative at a parameter with error checking.

Parameters
t[in] evaluation parameter
point[out] value of curve at t
first_derivative[out] value of first derivative at t
second_derivative[out] value of second derivative at t
Returns
false if unable to evaluate.

◆ Evaluate()

bool ON_BezierCurve::Evaluate ( double  t,
int  der_count,
int  v_stride,
double *  v 
) const

Evaluate a bezier.

Parameters
t[in] evaluation parameter (usually 0 <= t <= 1)
der_count[in] (>=0) number of derivatives to evaluate
v_stride[in] (>=m_dim) stride to use for the v[] array
v[out] array of length (der_count+1)*v_stride bez(t) is returned in (v[0],...,v[m_dim-1]), bez'(t) is retuned in (v[v_stride],...,v[v_stride+m_dim-1]), bez"(t) is retuned in (v[2*v_stride],...,v[2*v_stride+m_dim-1]), etc.
Returns
true if successful

◆ EvCurvature()

bool ON_BezierCurve::EvCurvature ( double  t,
ON_3dPoint point,
ON_3dVector tangent,
ON_3dVector kappa 
) const

Evaluate unit tangent and curvature at a parameter with error checking.

Parameters
t[in] evaluation parameter
point[out] value of curve at t
tangent[out] value of unit tangent
kappa[out] value of curvature vector
Returns
false if unable to evaluate.

◆ EvPoint()

bool ON_BezierCurve::EvPoint ( double  t,
ON_3dPoint point 
) const

Evaluate point at a parameter with error checking.

Parameters
t[in] evaluation parameter
point[out] value of curve at t
Returns
false if unable to evaluate.

◆ EvTangent()

bool ON_BezierCurve::EvTangent ( double  t,
ON_3dPoint point,
ON_3dVector tangent 
) const

Evaluate unit tangent at a parameter with error checking.

Parameters
t[in] evaluation parameter
point[out] value of curve at t
tangent[out] value of unit tangent
Returns
false if unable to evaluate.
See also
ON_Curve::TangentAt, ON_Curve::Ev1Der

◆ GetBBox()

bool ON_BezierCurve::GetBBox ( double *  box_min,
double *  box_max,
bool  bGrowBox = false 
) const

Gets bounding box.

Parameters
box_min[out] minimum corner of axis aligned bounding box The box_min[] array must have size m_dim.
box_max[out] maximum corner of axis aligned bounding box The box_max[] array must have size m_dim.
bGrowBox[in] if true, input box_min/box_max must be set to valid bounding box corners and this box is enlarged to be the union of the input box and the bezier's bounding box.
Returns
true if successful.

◆ GetBoundingBox()

bool ON_BezierCurve::GetBoundingBox ( ON_BoundingBox bbox,
int  bGrowBox = false 
) const

Gets bounding box.

Parameters
bbox[out] axis aligned bounding box returned here.
bGrowBox[in] if true, input bbox must be a valid bounding box and this box is enlarged to be the union of the input box and the bezier's bounding box.
Returns
true if successful.

◆ GetCV() [1/3]

bool ON_BezierCurve::GetCV ( int  cv_index,
ON::point_style  pointstyle,
double *  cv 
) const

Get location of a control vertex.

Parameters
cv_index[in] control vertex index (0 <= cv_index < m_order)
pointstyle[in] specifes what kind of values to get ON::not_rational cv[] is an array of length m_dim that defines a euclidean (world coordinate) point ON::homogeneous_rational cv[] is an array of length (m_dim+1) that defines a rational homogeneous point. ON::euclidean_rational cv[] is an array of length (m_dim+1). The first m_dim values define the euclidean (world coordinate) location of the point. cv[m_dim] is the weight ON::intrinsic_point_style If m_is_rat is true, cv[] has ON::homogeneous_rational point style. If m_is_rat is false, cv[] has ON::not_rational point style.
cv[out] array with control vertex value.
Returns
true if successful. false if cv_index is invalid.

◆ GetCV() [2/3]

bool ON_BezierCurve::GetCV ( int  cv_index,
ON_3dPoint point 
) const

Get location of a control vertex.

Parameters
cv_index[in] control vertex index (0 <= cv_index < m_order)
point[out] Location of control vertex. If the bezier is rational, the euclidean location is returned.
Returns
true if successful.

◆ GetCV() [3/3]

bool ON_BezierCurve::GetCV ( int  cv_index,
ON_4dPoint point 
) const

Get value of a control vertex.

Parameters
cv_index[in] control vertex index (0 <= cv_index < m_order)
point[out] Homogenous value of control vertex. If the bezier is not rational, the weight is 1.
Returns
true if successful.

◆ GetNurbForm()

int ON_BezierCurve::GetNurbForm ( ON_NurbsCurve nurbs_curve) const

Get ON_NurbsCurve form of a bezier.

Parameters
nurbs_curve[out] NURBS curve form of a bezier. The domain is [0,1].
Returns
0 = failure 1 = success

◆ GetTightBoundingBox()

bool ON_BezierCurve::GetTightBoundingBox ( ON_BoundingBox tight_bbox,
bool  bGrowBox = false,
const ON_Xform xform = nullptr 
) const

Get tight bounding box of the bezier.

Parameters
tight_bbox[in/out] tight bounding box
bGrowBox[in] (default=false) If true and the input tight_bbox is valid, then returned tight_bbox is the union of the input tight_bbox and the tight bounding box of the bezier curve.
xform[in] (default=nullptr) If not nullptr, the tight bounding box of the transformed bezier is calculated. The bezier curve is not modified.
Returns
True if the returned tight_bbox is set to a valid bounding box.

◆ IncreaseDegree()

bool ON_BezierCurve::IncreaseDegree ( int  desired_degree)

Increase degree of bezier.

Parameters
desired_degree[in]
Returns
true if successful. false if desired_degree < current degree.

◆ IsRational()

bool ON_BezierCurve::IsRational ( ) const
Returns
true if bezier is rational.

◆ IsValid()

bool ON_BezierCurve::IsValid ( ) const

◆ Loft() [1/2]

bool ON_BezierCurve::Loft ( const ON_3dPointArray points)

Loft a bezier curve through a list of points.

Parameters
points[in] an array of 2 or more points to interpolate
Returns
true if successful

The result has order = points.Count() and the loft uses the uniform parameterizaton curve( i/(points.Count()-1) ) = points[i].

◆ Loft() [2/2]

bool ON_BezierCurve::Loft ( int  pt_dim,
int  pt_count,
int  pt_stride,
const double *  pt,
int  t_stride,
const double *  t 
)

Loft a bezier curve through a list of points.

Parameters
pt_dim[in] dimension of points to interpolate
pt_count[in] number of points (>=2)
pt_stride[in] (>=pt_dim) pt[] array stride
pt[in] array of points
t_stride[in] (>=1) t[] array stride
t[in] strictly increasing array of interpolation parameters
Returns
true if successful

The result has order = points.Count() and the loft uses the parameterizaton curve( t[i] ) = points[i].

◆ MakeNonRational()

bool ON_BezierCurve::MakeNonRational ( )

Make beizer not rational by setting all control vertices to their euclidean locations and setting m_is_rat to false.

See also
ON_Bezier::MakeRational

◆ MakeRational()

bool ON_BezierCurve::MakeRational ( )

Make beizer rational.

Returns
true if successful.
See also
ON_Bezier::MakeNonRational

◆ operator=() [1/5]

ON_BezierCurve& ON_BezierCurve::operator= ( const ON_BezierCurve )

◆ operator=() [2/5]

ON_BezierCurve& ON_BezierCurve::operator= ( const ON_PolynomialCurve )

◆ operator=() [3/5]

ON_BezierCurve& ON_BezierCurve::operator= ( const ON_2dPointArray )

◆ operator=() [4/5]

ON_BezierCurve& ON_BezierCurve::operator= ( const ON_3dPointArray )

◆ operator=() [5/5]

ON_BezierCurve& ON_BezierCurve::operator= ( const ON_4dPointArray )

◆ Order()

int ON_BezierCurve::Order ( ) const
Returns
Order of the bezier. (order=degree+1)

◆ PointAt()

ON_3dPoint ON_BezierCurve::PointAt ( double  t) const

Evaluate point at a parameter.

Parameters
t[in] evaluation parameter
Returns
Point (location of curve at the parameter t).

◆ Reparameterize()

bool ON_BezierCurve::Reparameterize ( double  c)

Use a linear fractional tranformation for [0,1] to reparameterize the bezier. The locus of the curve is not changed, but the parameterization is changed.

Parameters
c[in] reparameterization constant (generally speaking, c should be > 0). If c != 1, then the returned bezier will be rational.
Returns
true if successful.

The reparameterization is performed by composing the input Bezier with the function lambda: [0,1] -> [0,1] given by

    t ->  c*t / ( (c-1)*t + 1 )

Note that lambda(0) = 0, lambda(1) = 1, lambda'(t) > 0, lambda'(0) = c and lambda'(1) = 1/c.

If the input Bezier has control vertices {B_0, ..., B_d}, then the output Bezier has control vertices

    (B_0, ... c^i * B_i, ..., c^d * B_d).

To derive this formula, simply compute the i-th Bernstein polynomial composed with lambda().

The inverse parameterization is given by 1/c. That is, the cumulative effect of the two calls

    Reparameterize(c)
    Reparameterize(1.0/c)

is to leave the bezier unchanged.

See also
ON_Bezier::ScaleConrolPoints

◆ Reparametrize()

bool ON_BezierCurve::Reparametrize ( double  )

misspelled function name is obsolete

◆ ReserveCVCapacity()

bool ON_BezierCurve::ReserveCVCapacity ( int  desired_cv_capacity)

Tools for managing CV and knot memory.

Make sure m_cv array has a certain length.

Parameters
desired_cv_capacity[in] minimum length of m_cv array.
Returns
true if successful.

◆ Reverse()

bool ON_BezierCurve::Reverse ( )

Reverses bezier by reversing the order of the control points.

◆ Rotate() [1/2]

bool ON_BezierCurve::Rotate ( double  sin_angle,
double  cos_angle,
const ON_3dVector rotation_axis,
const ON_3dPoint rotation_center 
)

Rotates the bezier curve about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule).

Parameters
sin_angle[in] sine of rotation angle
cos_angle[in] sine of rotation angle
rotation_axis[in] direction of the axis of rotation
rotation_center[in] point on the axis of rotation
Returns
true if bezier curve successfully rotated

Uses ON_BezierCurve::Transform() function to calculate the result.

◆ Rotate() [2/2]

bool ON_BezierCurve::Rotate ( double  rotation_angle,
const ON_3dVector rotation_axis,
const ON_3dPoint rotation_center 
)

Rotates the bezier curve about the specified axis. A positive rotation angle results in a counter-clockwise rotation about the axis (right hand rule).

Parameters
rotation_angle[in] angle of rotation in radians
rotation_axis[in] direction of the axis of rotation
rotation_center[in] point on the axis of rotation
Returns
true if bezier curve successfully rotated

Uses ON_BezierCurve::Transform() function to calculate the result.

◆ Scale()

bool ON_BezierCurve::Scale ( double  scale_factor)

Scales the bezier curve by the specified facotor. The scale is centered at the origin.

Parameters
scale_factor[in] scale factor
Returns
true if bezier curve successfully scaled

Uses ON_BezierCurve::Transform() function to calculate the result.

◆ ScaleConrolPoints()

bool ON_BezierCurve::ScaleConrolPoints ( int  i,
double  w 
)

Scale a rational Bezier's control vertices to set a weight to a specified value.

Parameters
i[in] (0 <= i < order)
w[in] w != 0.0
Returns
True if successful. The i-th control vertex will have weight w.

Each control point is multiplied by w/w0, where w0 is the input value of Weight(i).

See also
ON_Bezier::Reparameterize, ON_Bezier::ChangeWeights

◆ SetCV() [1/3]

bool ON_BezierCurve::SetCV ( int  cv_index,
ON::point_style  pointstyle,
const double *  cv 
)

Set control vertex

Parameters
cv_index[in] control vertex index (0 <= cv_index < m_order)
pointstyle[in] specifes what kind of values are passed in the cv array. ON::not_rational cv[] is an array of length m_dim that defines a euclidean (world coordinate) point ON::homogeneous_rational cv[] is an array of length (m_dim+1) that defines a rational homogeneous point. ON::euclidean_rational cv[] is an array of length (m_dim+1). The first m_dim values define the euclidean (world coordinate) location of the point. cv[m_dim] is the weight ON::intrinsic_point_style If m_is_rat is true, cv[] has ON::homogeneous_rational point style. If m_is_rat is false, cv[] has ON::not_rational point style.
cv[in] array with control vertex value.
Returns
true if the point can be set.

◆ SetCV() [2/3]

bool ON_BezierCurve::SetCV ( int  cv_index,
const ON_3dPoint point 
)

Set location of a control vertex.

Parameters
cv_index[in] control vertex index (0 <= cv_index < m_order)
point[in] control vertex location. If the bezier is rational, the weight will be set to 1.
Returns
true if successful.
See also
ON_BezierCurve::CV, ON_BezierCurve::SetCV,, ON_BezierCurve::SetWeight, ON_BezierCurve::Weight

◆ SetCV() [3/3]

bool ON_BezierCurve::SetCV ( int  cv_index,
const ON_4dPoint point 
)

Set value of a control vertex.

Parameters
cv_index[in] control vertex index (0 <= cv_index < m_order)
point[in] control vertex value. If the bezier is not rational, the euclidean location of homogenoeous point will be used.
Returns
true if successful.
See also
ON_BezierCurve::CV, ON_BezierCurve::SetCV,, ON_BezierCurve::SetWeight, ON_BezierCurve::Weight

◆ SetWeight()

bool ON_BezierCurve::SetWeight ( int  cv_index,
double  weight 
)

Set weight of a control vertex.

Parameters
cv_index[in] control vertex index (0 <= cv_index < m_order)
weight[in] weight
Returns
true if the weight can be set. If weight is not 1 and the bezier is not rational, then false is returned. Use ON_BezierCurve::MakeRational to make a bezier curve rational.
See also
ON_BezierCurve::SetCV, ON_BezierCurve::MakeRational,, ON_BezierCurve::IsRational, ON_BezierCurve::Weight

◆ Split()

bool ON_BezierCurve::Split ( double  t,
ON_BezierCurve left_side,
ON_BezierCurve right_side 
) const

Split() divides the Bezier curve at the specified parameter. The parameter must satisfy 0 < t < 1. You may pass *this as one of the curves to be returned.

Parameters
t[in] (0 < t < 1 ) parameter to split at
left_side[out]
right_side[out]
ON_BezierCurve crv = ...;
ON_BezierCurve right_side;
crv.Split( 0.5, crv, right_side );
would split crv at the 1/2, put the left side in crv,
and return the right side in right_side.

◆ TangentAt()

ON_3dVector ON_BezierCurve::TangentAt ( double  t) const

Evaluate unit tangent vector at a parameter.

Parameters
t[in] evaluation parameter
Returns
Unit tangent vector of the curve at the parameter t.

No error handling.

See also
ON_Curve::EvTangent

◆ Transform()

bool ON_BezierCurve::Transform ( const ON_Xform xform)

Transform the bezier.

Parameters
xform[in] transformation to apply to bezier
Returns
true if successful. false if bezier is invalid and cannot be transformed.

◆ Translate()

bool ON_BezierCurve::Translate ( const ON_3dVector translation_vector)

Translates the bezier curve along the specified vector.

Parameters
translation_vector[in] translation vector
Returns
true if bezier curve successfully translated

Uses ON_BezierCurve::Transform() function to calculate the result.

◆ Trim()

bool ON_BezierCurve::Trim ( const ON_Interval interval)

Trims (or extends) the bezier so the bezier so that the result starts bezier(interval[0]) and ends at bezier(interval[1]) (Evaluation performed on input bezier.)

Parameters
interval[in]
An interval of [0,1] leaves the bezier unchanged. An
interval of [0.5,1] would trim away the left half. An
interval of [0.0,2.0] would extend the right end.

◆ Weight()

double ON_BezierCurve::Weight ( int  cv_index) const
Parameters
cv_index[in] control vertex index (0<=i<m_order)
Returns
Weight of the i-th control vertex.

◆ ZeroCVs()

bool ON_BezierCurve::ZeroCVs ( )

Zeros control vertices and, if rational, sets weights to 1.

Member Data Documentation

◆ m_cv

double* ON_BezierCurve::m_cv

The i-th cv begins at cv[i*m_cv_stride].

◆ m_cv_capacity

int ON_BezierCurve::m_cv_capacity

◆ m_cv_stride

int ON_BezierCurve::m_cv_stride

Number of doubles per cv ( >= ((m_is_rat)?m_dim+1:m_dim) )

◆ m_dim

int ON_BezierCurve::m_dim

Implementation.

dimension of bezier (>=1)

◆ m_is_rat

int ON_BezierCurve::m_is_rat

1 if bezier is rational, 0 if bezier is not rational

◆ m_order

int ON_BezierCurve::m_order

order = degree+1