Rhino C++ API
8.10
|
#include <opennurbs_bezier.h>
Public Member Functions | |
ON_BezierSurface () | |
ON_BezierSurface (const ON_BezierSurface &) | |
ON_BezierSurface (const ON_PolynomialSurface &) | |
ON_BezierSurface (int dim, bool is_rat, int order0, int order1) | |
~ON_BezierSurface () | |
ON_BoundingBox | BoundingBox () const |
bool | Create (int dim, bool is_rat, int order0, int order1) |
double * | CV (int cv_index0, int cv_index1) 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 &) const |
for debugging More... | |
void | EmergencyDestroy () |
call if memory used by ON_NurbsCurve becomes invalid More... | |
bool | Evaluate (double, double, int, int, double *) const |
bool | GetBBox (double *, double *, bool bGrowBox=false) const |
bool | GetBoundingBox (ON_BoundingBox &bbox, int bGrowBox) const |
bool | GetClosestPoint (ON_3dPoint P, double *s, double *t, double maximum_distance=0.0, const ON_Interval *sub_domain0=0, const ON_Interval *sub_domain1=0) const |
bool | GetCV (int, int, ON::point_style, double *) const |
bool | GetCV (int, int, ON_3dPoint &) const |
bool | GetCV (int, int, ON_4dPoint &) const |
bool | GetLocalClosestPoint (ON_3dPoint P, double s_seed, double t_seed, double *s, double *t, const ON_Interval *sub_domain0=0, const ON_Interval *sub_domain1=0) const |
int | GetNurbForm (ON_NurbsSurface &) const |
bool | GetSurfaceSize (double *width, double *height) const |
ON_BezierCurve * | IsoCurve (int dir, double c, ON_BezierCurve *iso=nullptr) const |
returns the isocurve. More... | |
bool | IsRational () const |
true if NURBS curve is rational More... | |
bool | IsSingular (int) const |
bool | IsValid () const |
bool | Loft (const ON_ClassArray< ON_BezierCurve > &curve_list) |
bool | Loft (int count, const ON_BezierCurve *const *curve_list) |
bool | MakeNonRational () |
bool | MakeRational () |
bool | Morph (const ON_SpaceMorph &morph) |
ON_BezierSurface & | operator= (const ON_BezierSurface &) |
ON_BezierSurface & | operator= (const ON_PolynomialSurface &) |
int | Order (int) const |
= IsRational() ? Dim()+1 : Dim() More... | |
ON_3dPoint | PointAt (double s, double t) const |
bool | ReserveCVCapacity (int) |
Tools for managing CV and knot memory. More... | |
bool | Reverse (int) |
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, int, const ON_3dPoint &) |
bool | SetCV (int, int, const ON_4dPoint &) |
bool | SetCV (int, int, ON::point_style, const double *) |
bool | SetWeight (int, int, double) |
bool | Split (int, double, ON_BezierSurface &, ON_BezierSurface &) const |
bool | Transform (const ON_Xform &) |
bool | Translate (const ON_3dVector &translation_vector) |
bool | Transpose () |
transpose surface parameterization (swap "s" and "t") More... | |
bool | Trim (int dir, const ON_Interval &domain) |
double | Weight (int, int) const |
bool | ZeroCVs () |
zeros control vertices and, if rational, sets weights to 1 More... | |
Static Public Member Functions | |
static ON_BezierSurface * | InterpolateGrid (const double *point_grid, int dim, int point_count0, int point_count1, size_t point_stride0, size_t point_stride1, ON_BezierSurface *dest) |
Interpolate arectangular grid of points so that bez(i/(point_count0 - 1), i/(point_count1 - 1))) = point_grid[i][j]. The returned bezier has order (point_count0,point_count1). Be aware that interpolation of irregular grids can create surfaces with extreme oscillations. More... | |
static ON_BezierSurface * | InterpolateGrid (const ON_3dPoint *point_grid, int point_count0, int point_count1, size_t point_stride0, size_t point_stride1, ON_BezierSurface *dest) |
Interpolate arectangular grid of 3d points so that bez(i/(point_count0 - 1), i/(point_count1 - 1))) = point_grid[i][j] More... | |
static bool | MatchTangency (ON_SimpleArray< ON_BezierSurface * > &BezArray, ON_3dPoint P, ON_3dVector N, double *pMaxAngleDeviation) |
Public Attributes | |
double * | m_cv |
int | m_cv_capacity |
if 0, then destructor does not free m_cv More... | |
int | m_cv_stride [2] |
int | m_dim |
Implementation. More... | |
int | m_is_rat |
0 = no, 1 = yes More... | |
int | m_order [2] |
order = degree+1 >= 2 More... | |
ON_BezierSurface::ON_BezierSurface | ( | ) |
ON_BezierSurface::ON_BezierSurface | ( | int | dim, |
bool | is_rat, | ||
int | order0, | ||
int | order1 | ||
) |
ON_BezierSurface::~ON_BezierSurface | ( | ) |
ON_BezierSurface::ON_BezierSurface | ( | const ON_BezierSurface & | ) |
ON_BezierSurface::ON_BezierSurface | ( | const ON_PolynomialSurface & | ) |
ON_BoundingBox ON_BezierSurface::BoundingBox | ( | ) | const |
bool ON_BezierSurface::Create | ( | int | dim, |
bool | is_rat, | ||
int | order0, | ||
int | order1 | ||
) |
double* ON_BezierSurface::CV | ( | int | cv_index0, |
int | cv_index1 | ||
) | const |
Description: Expert user function to get a pointer to control vertex memory. If you are not an expert user, please use ON_BezierSurface::GetCV( ON_3dPoint& ) or ON_BezierSurface::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_BezierSurface::CVStyle ON_BezierSurface::GetCV ON_BezierSurface::Weight
int ON_BezierSurface::CVSize | ( | ) | const |
number of doubles per control vertex
ON::point_style ON_BezierSurface::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
int ON_BezierSurface::Degree | ( | int | ) | const |
void ON_BezierSurface::Destroy | ( | ) |
int ON_BezierSurface::Dimension | ( | ) | const |
ON_Interval ON_BezierSurface::Domain | ( | int | ) | const |
void ON_BezierSurface::Dump | ( | ON_TextLog & | ) | const |
for debugging
void ON_BezierSurface::EmergencyDestroy | ( | ) |
call if memory used by ON_NurbsCurve becomes invalid
bool ON_BezierSurface::Evaluate | ( | double | , |
double | , | ||
int | , | ||
int | , | ||
double * | |||
) | const |
bool ON_BezierSurface::GetBBox | ( | double * | , |
double * | , | ||
bool | bGrowBox = false |
||
) | const |
bGrowBox | true means grow box |
bool ON_BezierSurface::GetBoundingBox | ( | ON_BoundingBox & | bbox, |
int | bGrowBox | ||
) | const |
bool ON_BezierSurface::GetClosestPoint | ( | ON_3dPoint | P, |
double * | s, | ||
double * | t, | ||
double | maximum_distance = 0.0 , |
||
const ON_Interval * | sub_domain0 = 0 , |
||
const ON_Interval * | sub_domain1 = 0 |
||
) | const |
Description: Get the parameters of the point on the bezier surface that is closest to the point P. Parameters: P - [in] s - [out] t - [out] Closest point parameters. maximum_distance - [in] If maximum_distance > 0.0, then an answer is returned only if the distance from the bezier surface to P is <= maximum_distance. If maximum_distance <= 0.0, then maximum_distance is ignored. sub_domain0 - [in] If not nullptr, the search is confined to "s" parameters in the intersection of the sub_domain0 interval and (0,1). sub_domain1 - [in] If not nullptr, the search is confined to "t" parameters in the intersection of the sub_domain1 interval and (0,1). Returns: True if a point is found. See Also: ON_SurfaceTreeNode::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 surface tree and use it. See the ON_BezierSurface::GetClosestPoint code for an example.
bool ON_BezierSurface::GetCV | ( | int | , |
int | , | ||
ON::point_style | , | ||
double * | |||
) | const |
bool ON_BezierSurface::GetCV | ( | int | , |
int | , | ||
ON_3dPoint & | |||
) | const |
bool ON_BezierSurface::GetCV | ( | int | , |
int | , | ||
ON_4dPoint & | |||
) | const |
bool ON_BezierSurface::GetLocalClosestPoint | ( | ON_3dPoint | P, |
double | s_seed, | ||
double | t_seed, | ||
double * | s, | ||
double * | t, | ||
const ON_Interval * | sub_domain0 = 0 , |
||
const ON_Interval * | sub_domain1 = 0 |
||
) | const |
Description: Get the parameter of the point on the bezier surface that is locally closest to the point P when the search begins at (s_seed,t_seed). Parameters: P - [in] s_seed - [in] t_seed - [in] Parameters where the search begins. s - [out] t - [out] Closest point parameter. sub_domain0 - [in] If not nullptr, the search is confined to "s" parameters in the intersection of the sub_domain0 interval and (0,1). sub_domain1 - [in] If not nullptr, the search is confined to "t" parameters in the intersection of the sub_domain1 interval and (0,1). Returns: True if a point is found.
int ON_BezierSurface::GetNurbForm | ( | ON_NurbsSurface & | ) | const |
Returns: 0 = failure. 1 = success.
bool ON_BezierSurface::GetSurfaceSize | ( | double * | width, |
double * | height | ||
) | const |
Description: Get an estimate of the size of the rectangle that would be created if the 3d surface where flattened into a rectangle. Parameters: width - [out] (corresponds to the first surface parameter) height - [out] (corresponds to the first surface parameter) Returns: true if successful.
|
static |
Interpolate arectangular grid of points so that bez(i/(point_count0 - 1), i/(point_count1 - 1))) = point_grid[i][j]. The returned bezier has order (point_count0,point_count1). Be aware that interpolation of irregular grids can create surfaces with extreme oscillations.
point_grid | Grid points |
dim | dimension of grid points and returned bezier surface (dim >= 1) |
point_count0 | Number of grid points in the "i" direction. |
point_count1 | Number of grid points in the "j" direction. |
point_stride0 | "i" direction stride in doubles. |
point_stride1 | "j" direction stride in doubles. |
dest | If dest is not nullptr, then the bezier will be created in this instance. Otherwise new ON_BezierSurface(dim,0,point_count0,point_count1) will be used to allocate a bezier. |
|
static |
Interpolate arectangular grid of 3d points so that bez(i/(point_count0 - 1), i/(point_count1 - 1))) = point_grid[i][j]
point_grid | Grid points |
point_count0 | Number of grid points "i" direction. |
///
point_count1 | Number of grid points in the "j" direction. |
point_stride0 | "i" direction stride in ON_3dPoints. |
point_stride1 | "j" direction stride in ON_3dPoints. |
dest | If dest is not nullptr, then the bezier will be created in this instance. Otherwise new ON_BezierSurface(dim,0,point_count0,point_count1) will be used to allocate a bezier. |
ON_BezierCurve* ON_BezierSurface::IsoCurve | ( | int | dir, |
double | c, | ||
ON_BezierCurve * | iso = nullptr |
||
) | const |
returns the isocurve.
dir | 0 first parameter varies and second parameter is constant |
c | e.g., point on IsoCurve(0,c) at t is srf(t,c) 1 first parameter is constant and second parameter varies e.g., point on IsoCurve(1,c) at t is srf(c,t) value of constant parameter |
iso | When nullptr result is constructed on the heap. |
bool ON_BezierSurface::IsRational | ( | ) | const |
true if NURBS curve is rational
bool ON_BezierSurface::IsSingular | ( | int | ) | const |
bool ON_BezierSurface::IsValid | ( | ) | const |
bool ON_BezierSurface::Loft | ( | const ON_ClassArray< ON_BezierCurve > & | curve_list | ) |
Description: Loft a bezier surface through a list of bezier curves. Parameters: curve_list - [in] list of curves that have the same degree. Returns: True if successful.
bool ON_BezierSurface::Loft | ( | int | count, |
const ON_BezierCurve *const * | curve_list | ||
) |
Description: Loft a bezier surface through a list of bezier curves. Parameters: curve_count - [in] number of curves in curve_list curve_list - [in] array of pointers to curves that have the same degree. Returns: True if successful.
bool ON_BezierSurface::MakeNonRational | ( | ) |
bool ON_BezierSurface::MakeRational | ( | ) |
|
static |
Description: Given a set of bicubic bezier surfaces that share a vertex P, and form a complete ring around V, with common edges having identical control points, adjust the control points at and adjacent to V so that the normals at V are all N, and the angle between normals along common edges is minimized. Parameters: BezArray - [in, out] The input bezier surfaces. The do not have to be in order around the common vertex. They will be adjusted in place. P - [in] The desired location of the common vertex N - [in] The desired normal at the vertex. pMaxAngleDeviation - [out] max angle between normals along a shared edge (degrees). Returns: true if successful. false if the input beziers do not meet the criterion or if there are other failures. Note: Since only the control points at or adjacent to the vertex are changed, The normals and locations along the edges opposite the vertex do not change.
bool ON_BezierSurface::Morph | ( | const ON_SpaceMorph & | morph | ) |
ON_BezierSurface& ON_BezierSurface::operator= | ( | const ON_BezierSurface & | ) |
ON_BezierSurface& ON_BezierSurface::operator= | ( | const ON_PolynomialSurface & | ) |
int ON_BezierSurface::Order | ( | int | ) | const |
= IsRational() ? Dim()+1 : Dim()
ON_3dPoint ON_BezierSurface::PointAt | ( | double | s, |
double | t | ||
) | const |
bool ON_BezierSurface::ReserveCVCapacity | ( | int | ) |
Tools for managing CV and knot memory.
bool ON_BezierSurface::Reverse | ( | int | ) |
reverse parameterizatrion Domain changes from [a,b] to [-b,-a]
bool ON_BezierSurface::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_BezierSurface::Transform() function to calculate the result.
bool ON_BezierSurface::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_BezierSurface::Transform() function to calculate the result.
bool ON_BezierSurface::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_BezierSurface::Transform() function to calculate the result.
bool ON_BezierSurface::SetCV | ( | int | , |
int | , | ||
const ON_3dPoint & | |||
) |
bool ON_BezierSurface::SetCV | ( | int | , |
int | , | ||
const ON_4dPoint & | |||
) |
bool ON_BezierSurface::SetCV | ( | int | , |
int | , | ||
ON::point_style | , | ||
const double * | |||
) |
bool ON_BezierSurface::SetWeight | ( | int | , |
int | , | ||
double | |||
) |
bool ON_BezierSurface::Split | ( | int | , |
double | , | ||
ON_BezierSurface & | , | ||
ON_BezierSurface & | |||
) | const |
bool ON_BezierSurface::Transform | ( | const ON_Xform & | ) |
bool ON_BezierSurface::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_BezierSurface::Transform() function to calculate the result.
bool ON_BezierSurface::Transpose | ( | ) |
transpose surface parameterization (swap "s" and "t")
bool ON_BezierSurface::Trim | ( | int | dir, |
const ON_Interval & | domain | ||
) |
double ON_BezierSurface::Weight | ( | int | , |
int | |||
) | const |
bool ON_BezierSurface::ZeroCVs | ( | ) |
zeros control vertices and, if rational, sets weights to 1
double* ON_BezierSurface::m_cv |
int ON_BezierSurface::m_cv_capacity |
if 0, then destructor does not free m_cv
int ON_BezierSurface::m_cv_stride[2] |
int ON_BezierSurface::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. >= 1
int ON_BezierSurface::m_is_rat |
0 = no, 1 = yes
int ON_BezierSurface::m_order[2] |
order = degree+1 >= 2