#include <opennurbs_bezier.h>

Public Member Functions

 ON_BezierCage ()
 
 ON_BezierCage (int dim, bool is_rat, int order0, int order1, int order2)
 
 ON_BezierCage (const ON_BoundingBox &bbox, int order0, int order1, int order2)
 Construct a bezier volume that maps the unit cube to a bounding box. More...
 
 ON_BezierCage (const ON_3dPoint *box_corners, int order0, int order1, int order2)
 Construct a bezier volume that maps the unit cube to an eight sided box. More...
 
 ON_BezierCage (const ON_BezierCage &src)
 
 ~ON_BezierCage ()
 
bool Create (int dim, bool is_rat, int order0, int order1, int order2)
 Creates a bezier volume with specified orders. More...
 
bool Create (const ON_BoundingBox &bbox, int order0, int order1, int order2)
 Create a Bezier volume with corners defined by a bounding box. More...
 
bool Create (const ON_3dPoint *box_corners, int order0, int order1, int order2)
 Create a bezier volume from a 3d box More...
 
double * CV (int i, int j, int k) const
 Expert user function to get a pointer to control vertex memory. If you are not an expert user, please use ON_BezierCage::GetCV( ON_3dPoint& ) or ON_BezierCage::GetCV( ON_4dPoint& ). More...
 
int CVSize () const
 
ON::point_style CVStyle () const
 Returns the style of control vertices in the m_cv array. More...
 
int Degree (int) const
 
void Destroy ()
 Frees the CV array and sets all members to zero. More...
 
int Dimension () const
 The dimension of the image of the bazier volume map. This is generally three, but can be any positive integer. More...
 
ON_Interval Domain (int) const
 
void Dump (ON_TextLog &text_log) const
 
void EmergencyDestroy ()
 Sets all members to zero. Does not free the CV array even when m_cv is not nullptr. Generally used when the CVs were allocated from a memory pool that no longer exists and the free done in ~ON_BezierCage would cause a crash. More...
 
bool Evaluate (double r, double s, double t, int der_count, int v_stride, double *v) const
 returns false if unable to evaluate More...
 
bool GetBBox (double *boxmin, double *boxmax, bool bGrowBox=false) const
 Gets the axis aligned bounding box that contains the bezier's control points. The bezier volume maps the unit cube into this box. More...
 
bool GetCV (int i, int j, int k, ON::point_style, double *) const
 
bool GetCV (int i, int j, int k, ON_3dPoint &) const
 
bool GetCV (int i, int j, int k, ON_4dPoint &) const
 
bool IsRational () const
 
bool IsSingular (int) const
 
bool IsValid () const
 Tests class to make sure members are correctly initialized. More...
 
bool MakeNonRational ()
 
bool MakeRational ()
 
ON_BezierCageoperator= (const ON_BezierCage &src)
 
int Order (int) const
 
ON_3dPoint PointAt (double r, double s, double t) const
 Evaluates bezer volume map. More...
 
ON_3dPoint PointAt (ON_3dPoint rst) const
 Evaluates bezer volume map. More...
 
bool Read (ON_BinaryArchive &archive)
 Reads the definition of this class from an archive previously saved by ON_BezierVolue::Write. More...
 
bool ReserveCVCapacity (int cv_capacity)
 Tools for managing CV and knot memory. More...
 
bool Rotate (double sin_angle, double cos_angle, const ON_3dVector &rotation_axis, const ON_3dPoint &rotation_center)
 Rotates the bezier surface 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 surface 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 surface by the specified facotor. The scale is centered at the origin. More...
 
bool SetCV (int i, int j, int k, ON::point_style, const double *)
 
bool SetCV (int i, int j, int k, const ON_3dPoint &point)
 
bool SetCV (int i, int j, int k, const ON_4dPoint &hpoint)
 
bool SetWeight (int i, int j, int k, double w)
 
bool Transform (const ON_Xform &xform)
 
bool Translate (const ON_3dVector &translation_vector)
 Translates the bezier surface along the specified vector. More...
 
double Weight (int i, int j, int k) const
 
bool Write (ON_BinaryArchive &archive) const
 Saves the definition of this class in serial binary form that can be read by ON_BezierVolue::Read. More...
 
bool ZeroCVs ()
 

Public Attributes

double * m_cv
 
int m_cv_capacity
 
int m_cv_stride [3]
 
int m_dim
 Implementation. More...
 
bool m_is_rat
 
int m_order [3]
 

Constructor & Destructor Documentation

◆ ON_BezierCage() [1/5]

ON_BezierCage::ON_BezierCage ( )

◆ ON_BezierCage() [2/5]

ON_BezierCage::ON_BezierCage ( int  dim,
bool  is_rat,
int  order0,
int  order1,
int  order2 
)

◆ ON_BezierCage() [3/5]

ON_BezierCage::ON_BezierCage ( const ON_BoundingBox bbox,
int  order0,
int  order1,
int  order2 
)

Construct a bezier volume that maps the unit cube to a bounding box.

Parameters
bbox[in] target bounding box
order0[in]
order1[in]
order2[in]

◆ ON_BezierCage() [4/5]

ON_BezierCage::ON_BezierCage ( const ON_3dPoint box_corners,
int  order0,
int  order1,
int  order2 
)

Construct a bezier volume that maps the unit cube to an eight sided box.

Parameters
box_corners[in] 8 points that define corners of the target volume.

7______________6 |\ |\ | \ | \ | \ _____________\ | 4 | 5 | | | | | | | |

Parameters
3–|-------—2 | \ | \ | \ |t \ | s \ | \ | \0_____________\1 r
order0[in]
order1[in]
order2[in]

◆ ~ON_BezierCage()

ON_BezierCage::~ON_BezierCage ( )

◆ ON_BezierCage() [5/5]

ON_BezierCage::ON_BezierCage ( const ON_BezierCage src)

Member Function Documentation

◆ Create() [1/3]

bool ON_BezierCage::Create ( int  dim,
bool  is_rat,
int  order0,
int  order1,
int  order2 
)

Creates a bezier volume with specified orders.

Parameters
dim[in]
is_rat[in]
order0[in]
order1[in]
order2[in]
Returns
True if input was valid and creation succeded.

◆ Create() [2/3]

bool ON_BezierCage::Create ( const ON_BoundingBox bbox,
int  order0,
int  order1,
int  order2 
)

Create a Bezier volume with corners defined by a bounding box.

Parameters
bbox[in] target bounding box - the bezier will map the unit cube onto this bounding box.
order0[in]
order1[in]
order2[in]

◆ Create() [3/3]

bool ON_BezierCage::Create ( const ON_3dPoint box_corners,
int  order0,
int  order1,
int  order2 
)

Create a bezier volume from a 3d box

Parameters
box_corners[in] 8 points that define corners of the volume
      7______________6
      |\             |\
      | \            | \
      |  \ _____________\
      |   4          |   5
      |   |          |   |
      |   |          |   |</param>
Parameters
3–|-------—2 | \ | \ | \ |t \ | s \ | \ | \0_____________\1 r

◆ CV()

double* ON_BezierCage::CV ( int  i,
int  j,
int  k 
) const

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

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

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

◆ CVSize()

int ON_BezierCage::CVSize ( ) const

◆ CVStyle()

ON::point_style ON_BezierCage::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_BezierCage::Degree ( int  ) const

◆ Destroy()

void ON_BezierCage::Destroy ( )

Frees the CV array and sets all members to zero.

◆ Dimension()

int ON_BezierCage::Dimension ( ) const

The dimension of the image of the bazier volume map. This is generally three, but can be any positive integer.

Returns
Dimesion of the image space.

◆ Domain()

ON_Interval ON_BezierCage::Domain ( int  ) const

◆ Dump()

void ON_BezierCage::Dump ( ON_TextLog text_log) const

◆ EmergencyDestroy()

void ON_BezierCage::EmergencyDestroy ( )

Sets all members to zero. Does not free the CV array even when m_cv is not nullptr. Generally used when the CVs were allocated from a memory pool that no longer exists and the free done in ~ON_BezierCage would cause a crash.

◆ Evaluate()

bool ON_BezierCage::Evaluate ( double  r,
double  s,
double  t,
int  der_count,
int  v_stride,
double *  v 
) const

returns false if unable to evaluate

◆ GetBBox()

bool ON_BezierCage::GetBBox ( double *  boxmin,
double *  boxmax,
bool  bGrowBox = false 
) const

Gets the axis aligned bounding box that contains the bezier's control points. The bezier volume maps the unit cube into this box.

Parameters
boxmin[in] array of Dimension() doubles
boxmax[in] array of Dimension() doubles bGrowBox = [in] if true and the input is a valid box then the input box is grown to include this object's bounding box.
Returns
true if successful.

◆ GetCV() [1/3]

bool ON_BezierCage::GetCV ( int  i,
int  j,
int  k,
ON::point_style  ,
double *   
) const

◆ GetCV() [2/3]

bool ON_BezierCage::GetCV ( int  i,
int  j,
int  k,
ON_3dPoint  
) const

◆ GetCV() [3/3]

bool ON_BezierCage::GetCV ( int  i,
int  j,
int  k,
ON_4dPoint  
) const

◆ IsRational()

bool ON_BezierCage::IsRational ( ) const

◆ IsSingular()

bool ON_BezierCage::IsSingular ( int  ) const

◆ IsValid()

bool ON_BezierCage::IsValid ( ) const

Tests class to make sure members are correctly initialized.

Returns
True if the orders are all >= 2, dimension is positive, and the rest of the members have settings that are valid for the orders and dimension.

◆ MakeNonRational()

bool ON_BezierCage::MakeNonRational ( )

◆ MakeRational()

bool ON_BezierCage::MakeRational ( )

◆ operator=()

ON_BezierCage& ON_BezierCage::operator= ( const ON_BezierCage src)

◆ Order()

int ON_BezierCage::Order ( int  ) const

◆ PointAt() [1/2]

ON_3dPoint ON_BezierCage::PointAt ( double  r,
double  s,
double  t 
) const

Evaluates bezer volume map.

Parameters
rst[in]
Returns
Value of the bezier volume map at (r,s,t).

◆ PointAt() [2/2]

ON_3dPoint ON_BezierCage::PointAt ( ON_3dPoint  rst) const

Evaluates bezer volume map.

Parameters
rst[in]
Returns
Value of the bezier volume map at (rst.x,rst.y,rst.z).

◆ Read()

bool ON_BezierCage::Read ( ON_BinaryArchive archive)

Reads the definition of this class from an archive previously saved by ON_BezierVolue::Write.

Parameters
archive[in] target archive
Returns
True if successful.

◆ ReserveCVCapacity()

bool ON_BezierCage::ReserveCVCapacity ( int  cv_capacity)

Tools for managing CV and knot memory.

cv_capacity - [in] number of doubles to reserve

◆ Rotate() [1/2]

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

Rotates the bezier surface 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 surface successfully rotated

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

◆ Rotate() [2/2]

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

Rotates the bezier surface 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 surface successfully rotated

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

◆ Scale()

bool ON_BezierCage::Scale ( double  scale_factor)

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

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

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

◆ SetCV() [1/3]

bool ON_BezierCage::SetCV ( int  i,
int  j,
int  k,
ON::point_style  ,
const double *   
)

◆ SetCV() [2/3]

bool ON_BezierCage::SetCV ( int  i,
int  j,
int  k,
const ON_3dPoint point 
)

◆ SetCV() [3/3]

bool ON_BezierCage::SetCV ( int  i,
int  j,
int  k,
const ON_4dPoint hpoint 
)

◆ SetWeight()

bool ON_BezierCage::SetWeight ( int  i,
int  j,
int  k,
double  w 
)

◆ Transform()

bool ON_BezierCage::Transform ( const ON_Xform xform)

◆ Translate()

bool ON_BezierCage::Translate ( const ON_3dVector translation_vector)

Translates the bezier surface along the specified vector.

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

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

◆ Weight()

double ON_BezierCage::Weight ( int  i,
int  j,
int  k 
) const

◆ Write()

bool ON_BezierCage::Write ( ON_BinaryArchive archive) const

Saves the definition of this class in serial binary form that can be read by ON_BezierVolue::Read.

Parameters
archive[in] target archive
Returns
True if successful.

◆ ZeroCVs()

bool ON_BezierCage::ZeroCVs ( )

Member Data Documentation

◆ m_cv

double* ON_BezierCage::m_cv

◆ m_cv_capacity

int ON_BezierCage::m_cv_capacity

◆ m_cv_stride

int ON_BezierCage::m_cv_stride[3]

◆ m_dim

int ON_BezierCage::m_dim

Implementation.

◆ m_is_rat

bool ON_BezierCage::m_is_rat

◆ m_order

int ON_BezierCage::m_order[3]