Rhino C++ API  7.19
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ON_BezierCurve Class Reference

#include <opennurbs_bezier.h>

Inheritance diagram for ON_BezierCurve:
CRhinoInferredCurve ON_CurveTreeBezier

Public Member Functions

 ON_BezierCurve ()
 
 ON_BezierCurve (const ON_2dPointArray &)
 sets control points More...
 
 ON_BezierCurve (const ON_3dPointArray &)
 sets control points More...
 
 ON_BezierCurve (const ON_4dPointArray &)
 sets control points More...
 
 ON_BezierCurve (const ON_BezierCurve &)
 
 ON_BezierCurve (const ON_PolynomialCurve &)
 
 ON_BezierCurve (int dim, bool bIsRational, int order)
 
 ~ON_BezierCurve ()
 
ON_BoundingBox BoundingBox () const
 
bool ChangeDimension (int desired_dimension)
 
bool ChangeWeights (int i0, double w0, int i1, double w1)
 
const ON_4dPoint ControlPoint (int cv_index) const
 
double ControlPolygonLength () const
 
bool Create (int dim, bool bIsRational, int order)
 
ON_3dVector CurvatureAt (double t) const
 
double * CV (int cv_index) const
 
int CVCount () const
 
int CVSize () const
 
ON::point_style CVStyle () const
 
int Degree () const
 
ON_3dVector DerivativeAt (double t) const
 
void Destroy ()
 
int Dimension () const
 
ON_Interval Domain () const
 
void Dump (ON_TextLog &) const
 for debugging More...
 
void EmergencyDestroy ()
 call if memory used by ON_NurbsCurve becomes invalid More...
 
bool Ev1Der (double t, ON_3dPoint &point, ON_3dVector &first_derivative) const
 
bool Ev2Der (double t, ON_3dPoint &point, ON_3dVector &first_derivative, ON_3dVector &second_derivative) const
 
bool Evaluate (double t, int der_count, int v_stride, double *v) const
 
bool EvCurvature (double t, ON_3dPoint &point, ON_3dVector &tangent, ON_3dVector &kappa) const
 
bool EvPoint (double t, ON_3dPoint &point) const
 
bool EvTangent (double t, ON_3dPoint &point, ON_3dVector &tangent) const
 
int FindRoots (double *root, double tol=ON_ZERO_TOLERANCE) const
 
bool GetBBox (double *box_min, double *box_max, bool bGrowBox=false) const
 
bool GetBoundingBox (ON_BoundingBox &bbox, int bGrowBox=false) const
 
bool GetClosestPoint (ON_3dPoint P, double *t, double maximum_distance=0.0, const ON_Interval *sub_domain=0) const
 
bool GetCV (int cv_index, ON::point_style pointstyle, double *cv) const
 
bool GetCV (int cv_index, ON_3dPoint &point) const
 
bool GetCV (int cv_index, ON_4dPoint &point) const
 
bool GetLocalClosestPoint (ON_3dPoint P, double seed_parameter, double *t, const ON_Interval *sub_domain=0) const
 
bool GetLocalCurveIntersection (const ON_BezierCurve *other_bezcrv, double this_seed_t, double other_seed_t, double *this_t, double *other_t, const ON_Interval *this_domain=0, const ON_Interval *other_domain=0) const
 
bool GetLocalSurfaceIntersection (const ON_BezierSurface *bezsrf, double seed_t, double seed_u, double seed_v, double *t, double *u, double *v, const ON_Interval *tdomain=0, const ON_Interval *udomain=0, const ON_Interval *vdomain=0) const
 
int GetNurbForm (ON_NurbsCurve &nurbs_curve) const
 
bool GetTightBoundingBox (ON_BoundingBox &tight_bbox, bool bGrowBox=false, const ON_Xform *xform=nullptr) const
 
bool IncreaseDegree (int desired_degree)
 
int IntersectCurve (const ON_BezierCurve *bezierB, ON_SimpleArray< ON_X_EVENT > &x, double intersection_tolerance=0.0, double overlap_tolerance=0.0, const ON_Interval *bezierA_domain=0, const ON_Interval *bezierB_domain=0) const
 
int IntersectSelf (ON_SimpleArray< ON_X_EVENT > &x, double intersection_tolerance=0.0) const
 
int IntersectSurface (const ON_BezierSurface *bezsrfB, ON_SimpleArray< ON_X_EVENT > &x, double intersection_tolerance=0.0, double overlap_tolerance=0.0, const ON_Interval *bezierA_domain=0, const ON_Interval *bezsrfB_udomain=0, const ON_Interval *bezsrfB_vdomain=0) const
 
bool IsRational () const
 
bool IsValid () const
 
bool Loft (const ON_3dPointArray &points)
 
bool Loft (int pt_dim, int pt_count, int pt_stride, const double *pt, int t_stride, const double *t)
 
bool MakeNonRational ()
 
bool MakeRational ()
 
bool Morph (const ON_SpaceMorph &morph)
 
ON_BezierCurve operator* (const ON_BezierCurve &B) const
 
ON_BezierCurve operator* (double a) const
 
ON_BezierCurve operator+ (const double *v) const
 
ON_BezierCurve operator+ (const ON_BezierCurve &B) const
 
ON_BezierCurve operator+ (ON_3dVector v) const
 Arithmetic operations. More...
 
ON_BezierCurve operator- (const double *v) const
 
ON_BezierCurve operator- (const ON_BezierCurve &crv) const
 
ON_BezierCurve operator- (ON_3dVector v) const
 
ON_BezierCurveoperator= (const ON_2dPointArray &)
 sets control points More...
 
ON_BezierCurveoperator= (const ON_3dPointArray &)
 sets control points More...
 
ON_BezierCurveoperator= (const ON_4dPointArray &)
 sets control points More...
 
ON_BezierCurveoperator= (const ON_BezierCurve &)
 
ON_BezierCurveoperator= (const ON_PolynomialCurve &)
 
int Order () const
 order = degree + 1 More...
 
ON_3dPoint PointAt (double t) const
 
bool Reparameterize (double c)
 
bool Reparametrize (double)
 
bool ReserveCVCapacity (int desired_cv_capacity)
 Tools for managing CV and knot memory. More...
 
bool Reverse ()
 
bool Rotate (double rotation_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 
bool Rotate (double sin_angle, double cos_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 
bool Scale (double scale_factor)
 
bool ScaleConrolPoints (int i, double w)
 
bool SetCV (int cv_index, const ON_3dPoint &point)
 
bool SetCV (int cv_index, const ON_4dPoint &point)
 
bool SetCV (int cv_index, ON::point_style pointstyle, const double *cv)
 
bool SetWeight (int cv_index, double weight)
 
bool Split (double t, ON_BezierCurve &left_side, ON_BezierCurve &right_side) const
 
ON_3dVector TangentAt (double t) const
 
bool Transform (const ON_Xform &xform)
 
bool Translate (const ON_3dVector &translation_vector)
 
bool Trim (const ON_Interval &interval)
 
double Weight (int cv_index) const
 
bool ZeroCVs ()
 

Static Public Member Functions

static ON_BezierCurve CrossProduct (const ON_BezierCurve &A, ON_3dVector V)
 
static ON_BezierCurve Derivative (const ON_BezierCurve &A)
 
static bool Derivative (const ON_BezierCurve &A, ON_BezierCurve &derivativeA)
 
static ON_BezierCurve DotProduct (const ON_BezierCurve &A, const double *B)
 
static ON_BezierCurve DotProduct (const ON_BezierCurve &A, const ON_BezierCurve &B)
 
static ON_BezierCurve DotProduct (const ON_BezierCurve &A, ON_3dVector B)
 

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 
)

Description: 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 )

sets control points

◆ ON_BezierCurve() [6/7]

ON_BezierCurve::ON_BezierCurve ( const ON_3dPointArray )

sets control points

◆ ON_BezierCurve() [7/7]

ON_BezierCurve::ON_BezierCurve ( const ON_4dPointArray )

sets control points

Member Function Documentation

◆ BoundingBox()

ON_BoundingBox ON_BezierCurve::BoundingBox ( ) const

Description: Gets bounding box. Returns: Axis aligned bounding box.

◆ ChangeDimension()

bool ON_BezierCurve::ChangeDimension ( int  desired_dimension)

Description: 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 
)

Description: 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. Remarks: 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. Remarks: 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

Description: returns the length of the control polygon

◆ Create()

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

Description: 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.

◆ CrossProduct()

static ON_BezierCurve ON_BezierCurve::CrossProduct ( const ON_BezierCurve A,
ON_3dVector  V 
)
static

Returns: A X V Remarks: A.m_dim must be 3.

◆ CurvatureAt()

ON_3dVector ON_BezierCurve::CurvatureAt ( double  t) const

Description: Evaluate the curvature vector at a parameter. Parameters: t - [in] evaluation parameter Returns: curvature vector of the curve at the parameter t. Remarks: No error handling. See Also: ON_Curve::EvCurvature

◆ CV()

double* ON_BezierCurve::CV ( int  cv_index) const

Description: 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. Remarks: 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

Description: Returns the style of control vertices in the m_cv array. Returns: @untitled 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)

◆ Derivative() [1/2]

static ON_BezierCurve ON_BezierCurve::Derivative ( const ON_BezierCurve A)
static

Returns: First derivative of A.

◆ Derivative() [2/2]

static bool ON_BezierCurve::Derivative ( const ON_BezierCurve A,
ON_BezierCurve derivativeA 
)
static

Description: TL_Derivative( const ON_BezierCurve& Crv, ON_BezierCurve& Cdot) Computes the bezier representing the derivative of Crv . Returns true if the result is the derivative. Details: For non-rational Crv the order of the result is 2*Crv.Order()-1

Remarks For optimal performance use this version with derivativeA allocated to the proper size, instead of using ON_BezierCurve::Derivative.
This will avoid allocating and copying of temporary objects. Parameters: A - [in] A.Order() must be >= 2.

derivativeA - [out] For a non-rational A with degree > 1, the result is non-rational of degree A.Degree()-1. For non-rational A with degree 1, the result is degree 1. For rational A, the degee of derivativeA is 2*A.Degree() (quotient rule). Returns:
True if A is valid and derivative is returned

◆ DerivativeAt()

ON_3dVector ON_BezierCurve::DerivativeAt ( double  t) const

Description: Evaluate first derivative at a parameter. Parameters: t - [in] evaluation parameter Returns: First derivative of the curve at the parameter t. Remarks: No error handling. See Also: ON_Curve::Ev1Der

◆ Destroy()

void ON_BezierCurve::Destroy ( )

Description: 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]).

◆ DotProduct() [1/3]

static ON_BezierCurve ON_BezierCurve::DotProduct ( const ON_BezierCurve A,
const double *  B 
)
static

Returns: A o B (scalar dot product) Remarks: A.m_dim and B's dimension must be equal

◆ DotProduct() [2/3]

static ON_BezierCurve ON_BezierCurve::DotProduct ( const ON_BezierCurve A,
const ON_BezierCurve B 
)
static

Returns: A o B (scalar dot product) Remarks: A.m_dim and B.m_dim must be qeual

◆ DotProduct() [3/3]

static ON_BezierCurve ON_BezierCurve::DotProduct ( const ON_BezierCurve A,
ON_3dVector  B 
)
static

Returns: A o B (scalar dot product) Remarks: A.m_dim must be 3.

◆ Dump()

void ON_BezierCurve::Dump ( ON_TextLog ) const

for debugging

◆ EmergencyDestroy()

void ON_BezierCurve::EmergencyDestroy ( )

call if memory used by ON_NurbsCurve becomes invalid

◆ Ev1Der()

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

Description: 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

Description: 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

Description: 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

Description: 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

Description: 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

Description: 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

◆ FindRoots()

int ON_BezierCurve::FindRoots ( double *  root,
double  tol = ON_ZERO_TOLERANCE 
) const

Description: Find all the zeros of the first coordinate of a bezier in the domain [0,1].
Roots are reported only once regardless of multiplicity. Parameters root [out] An array of degree many doubles. Roots are returned here in increasing order tol [in] tolerance >0 used for detecting roots of even multiplicity

Details: All roots are computed to full machine precision.
As an example of how tol is used (x-.123)^2 + tol/2 will have a root at .123 where as (x-.123)^2 + 2*tol has no roots

Returns: Number of roots found.

◆ GetBBox()

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

Description: 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.

Parameters
box_minreturns true if successful

◆ GetBoundingBox()

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

Description: 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.

◆ GetClosestPoint()

bool ON_BezierCurve::GetClosestPoint ( ON_3dPoint  P,
double *  t,
double  maximum_distance = 0.0,
const ON_Interval sub_domain = 0 
) const

Description: Get the parameter of the point on the bezier curve that is closest to the point P. Parameters: P - [in] t - [out] Closest point parameter. maximum_distance - [in] If maximum_distance > 0.0, then an answer is returned only if the distance from the bezier curve to P is <= maximum_distance. If maximum_distance <= 0.0, then maximum_distance is ignored. sub_domain - [in] If not nullptr, the search is confined to the intersection of the sub_domain interval and (0,1). Returns: True if a point is found. See Also: ON_CurveTreeNode::GetClosestPoint Remarks: This function is not efficient if you will be finding multiple closest points to the same bezier. To efficiently find multiple closest points, make a curve tree and use it. See the ON_BezierCurve::GetClosestPoint code for an example.

◆ GetCV() [1/3]

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

Description: 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

Description: 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

Description: 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.

◆ GetLocalClosestPoint()

bool ON_BezierCurve::GetLocalClosestPoint ( ON_3dPoint  P,
double  seed_parameter,
double *  t,
const ON_Interval sub_domain = 0 
) const

Description: Get the parameter of the point on the bezier curve that is locally closest to the point P when the search begins at seed_parameter. Parameters: P - [in] seed_parameter - [in] Parameter where the search begins. t - [out] Closest point parameter. sub_domain - [in] If not nullptr, the search is confined to the intersection of the sub_domain interval and (0,1). Returns: True if a point is found.

◆ GetLocalCurveIntersection()

bool ON_BezierCurve::GetLocalCurveIntersection ( const ON_BezierCurve other_bezcrv,
double  this_seed_t,
double  other_seed_t,
double *  this_t,
double *  other_t,
const ON_Interval this_domain = 0,
const ON_Interval other_domain = 0 
) const

Description: Get a local curve-curve intersection point. Parameters: other_bezcrv - [in] other curve this_seed_t - [in] this curve seed paramter other_seed_t - [in] other curve seed paramter this_t - [out] this curve paramter other_t - [out] other curve paramter this_domain - [in] optional this curve domain restriction other_domain - [in] optional other curve domain restriction Returns: True if something is returned in (t,u,v). Check answer.

◆ GetLocalSurfaceIntersection()

bool ON_BezierCurve::GetLocalSurfaceIntersection ( const ON_BezierSurface bezsrf,
double  seed_t,
double  seed_u,
double  seed_v,
double *  t,
double *  u,
double *  v,
const ON_Interval tdomain = 0,
const ON_Interval udomain = 0,
const ON_Interval vdomain = 0 
) const

Description: Get a local curve-surface intersection point. Parameters: bezsrf - [in] seed_t - [in] curve paramter seed_u - [in] surface parameter seed_v - [in] surface parameter t - [out] curve paramter u - [out] surface parameter v - [out] surface parameter tdomain - [in] optional curve domain restriction udomain - [in] optional surface domain restriction vdomain - [in] optional surface domain restriction Returns: True if something is returned in (t,u,v). Check answer.

◆ GetNurbForm()

int ON_BezierCurve::GetNurbForm ( ON_NurbsCurve nurbs_curve) const

Description: 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

Description: 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)

Description: Increase degree of bezier. Parameters: desired_degree - [in] Returns: true if successful. false if desired_degree < current degree.

◆ IntersectCurve()

int ON_BezierCurve::IntersectCurve ( const ON_BezierCurve bezierB,
ON_SimpleArray< ON_X_EVENT > &  x,
double  intersection_tolerance = 0.0,
double  overlap_tolerance = 0.0,
const ON_Interval bezierA_domain = 0,
const ON_Interval bezierB_domain = 0 
) const

Description: Intersect this bezier with bezierB. Parameters: curveB - [in] x - [out] Intersection events are appended to this array. intersection_tolerance - [in] If the distance from a point on this curve to curveB is <= intersection tolerance, then the point will be part of an intersection event. If the input intersection_tolerance <= 0.0, then 0.001 is used. overlap_tolerance - [in] If t1 and t2 are parameters of this curve's intersection events and the distance from curve(t) to curveB is <= overlap_tolerance for every t1 <= t <= t2, then the event will be returened as an overlap event. If the input overlap_tolerance <= 0.0, then intersection_tolerance*2.0 is used. curveA_domain - [in] optional restriction on this bezier's domain curveB_domain - [in] optional restriction on bezierB domain Returns: Number of intersection events appended to x. Remarks: If you are performing more than one intersection, you should create curve trees and intersect them. See the IntersectBezierCurve code for an example.

◆ IntersectSelf()

int ON_BezierCurve::IntersectSelf ( ON_SimpleArray< ON_X_EVENT > &  x,
double  intersection_tolerance = 0.0 
) const

Description: Find bezier self intersection points. Parameters: x - [out] Intersection events are appended to this array. intersection_tolerance - [in] Returns: Number of intersection events appended to x.

◆ IntersectSurface()

int ON_BezierCurve::IntersectSurface ( const ON_BezierSurface bezsrfB,
ON_SimpleArray< ON_X_EVENT > &  x,
double  intersection_tolerance = 0.0,
double  overlap_tolerance = 0.0,
const ON_Interval bezierA_domain = 0,
const ON_Interval bezsrfB_udomain = 0,
const ON_Interval bezsrfB_vdomain = 0 
) const

Description: Intersect this bezier curve with bezsrfB. Parameters: bezsrfB - [in] x - [out] Intersection events are appended to this array. intersection_tolerance - [in] If the distance from a point on this curve to the surface is <= intersection tolerance, then the point will be part of an intersection event. If the input intersection_tolerance <= 0.0, then 0.001 is used. overlap_tolerance - [in] If t1 and t2 are curve parameters of intersection events and the distance from curve(t) to the surface is <= overlap_tolerance for every t1 <= t <= t2, then the event will be returened as an overlap event. If the input overlap_tolerance <= 0.0, then intersection_tolerance*2.0 is used. curveA_domain - [in] optional restriction on this curve's domain surfaceB_udomain - [in] optional restriction on surfaceB u domain surfaceB_vdomain - [in] optional restriction on surfaceB v domain Returns: Number of intersection events appended to x. Remarks: If you are performing more than one intersection, you should create curve and surface trees and intersect them. See the IntersectBezierSurface code for an example.

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

Description: 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 Remarks: 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 
)

Description: 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 Remarks: The result has order = points.Count() and the loft uses the parameterizaton curve( t[i] ) = points[i].

◆ MakeNonRational()

bool ON_BezierCurve::MakeNonRational ( )

Description: 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 ( )

Description: Make beizer rational. Returns: true if successful. See Also: ON_Bezier::MakeNonRational

◆ Morph()

bool ON_BezierCurve::Morph ( const ON_SpaceMorph morph)

◆ operator*() [1/2]

ON_BezierCurve ON_BezierCurve::operator* ( const ON_BezierCurve B) const

Returns: this * B (scalar multiplication)

◆ operator*() [2/2]

ON_BezierCurve ON_BezierCurve::operator* ( double  a) const

Returns: a * this

◆ operator+() [1/3]

ON_BezierCurve ON_BezierCurve::operator+ ( const double *  v) const

Parameters: v - [in] A vector with dimension = m_dim. Returns: this + v Remarks: Ignores coordinates after the first three.

◆ operator+() [2/3]

ON_BezierCurve ON_BezierCurve::operator+ ( const ON_BezierCurve B) const

Parameters: v - [in] A vector with dimension = m_dim. Returns: this + B Remarks: m_dim and B.m_dim must be equal.

◆ operator+() [3/3]

ON_BezierCurve ON_BezierCurve::operator+ ( ON_3dVector  v) const

Arithmetic operations.

Returns: this + v Remarks: Ignores coordinates after the first three.

◆ operator-() [1/3]

ON_BezierCurve ON_BezierCurve::operator- ( const double *  v) const

Parameters: v - [in] A vector with dimension = m_dim. Returns: this - v Remarks: Ignores coordinates after the first three.

◆ operator-() [2/3]

ON_BezierCurve ON_BezierCurve::operator- ( const ON_BezierCurve crv) const

Parameters: v - [in] A vector with dimension = m_dim. Returns: this - crv Remarks: this and crv must have the same dimension.

◆ operator-() [3/3]

ON_BezierCurve ON_BezierCurve::operator- ( ON_3dVector  v) const

Returns: this - v Remarks: Ignores coordinates after the first three.

◆ operator=() [1/5]

ON_BezierCurve& ON_BezierCurve::operator= ( const ON_2dPointArray )

sets control points

◆ operator=() [2/5]

ON_BezierCurve& ON_BezierCurve::operator= ( const ON_3dPointArray )

sets control points

◆ operator=() [3/5]

ON_BezierCurve& ON_BezierCurve::operator= ( const ON_4dPointArray )

sets control points

◆ operator=() [4/5]

ON_BezierCurve& ON_BezierCurve::operator= ( const ON_BezierCurve )

◆ operator=() [5/5]

ON_BezierCurve& ON_BezierCurve::operator= ( const ON_PolynomialCurve )

◆ Order()

int ON_BezierCurve::Order ( ) const

order = degree + 1

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

◆ PointAt()

ON_3dPoint ON_BezierCurve::PointAt ( double  t) const

Description: 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)

Description: 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. Remarks: 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

Deprecated:
misspelled - use Reparameterize

◆ ReserveCVCapacity()

bool ON_BezierCurve::ReserveCVCapacity ( int  desired_cv_capacity)

Tools for managing CV and knot memory.

Description: 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 ( )

Description: Reverses bezier by reversing the order of the control points.

◆ Rotate() [1/2]

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

Description: 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 Remarks: Uses ON_BezierCurve::Transform() function to calculate the result.

◆ Rotate() [2/2]

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

Description: 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 Remarks: Uses ON_BezierCurve::Transform() function to calculate the result.

◆ Scale()

bool ON_BezierCurve::Scale ( double  scale_factor)

Description: 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 Remarks: Uses ON_BezierCurve::Transform() function to calculate the result.

◆ ScaleConrolPoints()

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

Description: 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. Remarks: 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,
const ON_3dPoint point 
)

Description: 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() [2/3]

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

Description: 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

◆ SetCV() [3/3]

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

Description: 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.

◆ SetWeight()

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

Description: 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

Description: 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]
Example: 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

Description: Evaluate unit tangent vector at a parameter. Parameters: t - [in] evaluation parameter Returns: Unit tangent vector of the curve at the parameter t. Remarks: No error handling. See Also: ON_Curve::EvTangent

◆ Transform()

bool ON_BezierCurve::Transform ( const ON_Xform xform)

Description: 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)

Description: Translates the bezier curve along the specified vector. Parameters: translation_vector - [in] translation vector Returns: true if bezier curve successfully translated Remarks: Uses ON_BezierCurve::Transform() function to calculate the result.

◆ Trim()

bool ON_BezierCurve::Trim ( const ON_Interval interval)

Description: 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] Example: 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 ( )

Description: 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

Number of doubles in m_cv array. If m_cv_capacity is zero and m_cv is not nullptr, an expert user is managing the m_cv memory. ~ON_BezierCurve will not deallocate m_cv unless m_cv_capacity is greater than zero.

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

NOTE: These members are left "public" so that expert users may efficiently create bezier curves using the default constructor and borrow the knot and CV arrays from their native NURBS representation. No technical support will be provided for users who access these members directly. If you can't get your stuff to work, then use the constructor with the arguments and the SetKnot() and SetCV() functions to fill in the arrays. 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