Rhino C++ API  8.13
Public Member Functions | Public Attributes | List of all members
ON_BezierCage Class Reference

#include <opennurbs_bezier.h>

Public Member Functions

 ON_BezierCage ()
 
 ON_BezierCage (const ON_3dPoint *box_corners, int order0, int order1, int order2)
 
 ON_BezierCage (const ON_BezierCage &src)
 
 ON_BezierCage (const ON_BoundingBox &bbox, int order0, int order1, int order2)
 
 ON_BezierCage (int dim, bool is_rat, int order0, int order1, int order2)
 
 ~ON_BezierCage ()
 
bool Create (const ON_3dPoint *box_corners, int order0, int order1, int order2)
 
bool Create (const ON_BoundingBox &bbox, int order0, int order1, int order2)
 
bool Create (int dim, bool is_rat, int order0, int order1, int order2)
 
double * CV (int i, int j, int k) const
 
int CVSize () const
 
ON::point_style CVStyle () const
 
int Degree (int) const
 
void Destroy ()
 
int Dimension () const
 
ON_Interval Domain (int) const
 
void Dump (ON_TextLog &text_log) const
 
void EmergencyDestroy ()
 
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
 
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
 true if NURBS curve is rational More...
 
bool IsSingular (int) const
 
bool IsValid () const
 
bool MakeNonRational ()
 
bool MakeRational ()
 
bool Morph (const ON_SpaceMorph &morph)
 
ON_BezierCageoperator= (const ON_BezierCage &src)
 
int Order (int) const
 = IsRational() ? Dim()+1 : Dim() More...
 
ON_3dPoint PointAt (double r, double s, double t) const
 
ON_3dPoint PointAt (ON_3dPoint rst) const
 
bool Read (ON_BinaryArchive &archive)
 
bool ReserveCVCapacity (int cv_capacity)
 Tools for managing CV and knot memory. More...
 
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 SetCV (int i, int j, int k, const ON_3dPoint &point)
 
bool SetCV (int i, int j, int k, const ON_4dPoint &hpoint)
 
bool SetCV (int i, int j, int k, ON::point_style, const double *)
 
bool SetWeight (int i, int j, int k, double w)
 
bool Transform (const ON_Xform &xform)
 
bool Translate (const ON_3dVector &translation_vector)
 
double Weight (int i, int j, int k) const
 
bool Write (ON_BinaryArchive &archive) const
 
bool ZeroCVs ()
 zeros control vertices and, if rational, sets weights to 1 More...
 

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 
)

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

Description: 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 | | | | | | | | 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 ( const ON_3dPoint box_corners,
int  order0,
int  order1,
int  order2 
)

Description: Create a bezier volume from a 3d box Parameters: box_corners - [in] 8 points that define corners of the volume

    7______________6
    |\             |\
    | \            | \
    |  \ _____________\
    |   4          |   5
    |   |          |   |
    |   |          |   |
    3---|----------2   |
    \   |          \   |
     \  |t          \  |
    s \ |            \ |
       \0_____________\1
               r

◆ Create() [2/3]

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

Description: 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 ( int  dim,
bool  is_rat,
int  order0,
int  order1,
int  order2 
)

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

◆ CV()

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

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

number of doubles per control vertex

◆ CVStyle()

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

◆ Destroy()

void ON_BezierCage::Destroy ( )

Description: Frees the CV array and sets all members to zero.

◆ Dimension()

int ON_BezierCage::Dimension ( ) const

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

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

Parameters
varray of length stride*(ndir+1)*(ndir+2)/2

◆ GetBBox()

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

Description: 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
Parameters
iget a single control vertex

◆ GetCV() [2/3]

bool ON_BezierCage::GetCV ( int  i,
int  j,
int  k,
ON_3dPoint  
) const
Parameters
iget a single control vertex

◆ GetCV() [3/3]

bool ON_BezierCage::GetCV ( int  i,
int  j,
int  k,
ON_4dPoint  
) const
Parameters
iget a single control vertex

◆ IsRational()

bool ON_BezierCage::IsRational ( ) const

true if NURBS curve is rational

◆ IsSingular()

bool ON_BezierCage::IsSingular ( int  ) const

◆ IsValid()

bool ON_BezierCage::IsValid ( ) const

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

◆ Morph()

bool ON_BezierCage::Morph ( const ON_SpaceMorph morph)

◆ operator=()

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

◆ Order()

int ON_BezierCage::Order ( int  ) const

= IsRational() ? Dim()+1 : Dim()

◆ PointAt() [1/2]

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

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

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

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

Description: cv_capacity - [in] number of doubles to reserve

◆ Rotate() [1/2]

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

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

◆ Rotate() [2/2]

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

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

◆ Scale()

bool ON_BezierCage::Scale ( double  scale_factor)

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

◆ SetCV() [1/3]

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

set a single control vertex If NURBS is rational, weight will be set to 1.

◆ SetCV() [2/3]

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

set a single control vertex value of control vertex If NURBS is not rational, euclidean location of homogeneous point will be used.

◆ SetCV() [3/3]

bool ON_BezierCage::SetCV ( int  i,
int  j,
int  k,
ON::point_style  ,
const double *   
)
Parameters
iset a single control vertex

◆ SetWeight()

bool ON_BezierCage::SetWeight ( int  i,
int  j,
int  k,
double  w 
)
Parameters
iset value of control vertex weight

◆ Transform()

bool ON_BezierCage::Transform ( const ON_Xform xform)

◆ Translate()

bool ON_BezierCage::Translate ( const ON_3dVector translation_vector)

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

◆ Weight()

double ON_BezierCage::Weight ( int  i,
int  j,
int  k 
) const
Parameters
iget value of control vertex weight

◆ Write()

bool ON_BezierCage::Write ( ON_BinaryArchive archive) const

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

zeros control vertices and, if rational, sets weights to 1

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.

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.

◆ m_is_rat

bool ON_BezierCage::m_is_rat

◆ m_order

int ON_BezierCage::m_order[3]