#include <nurbsCurveResult.h>
Inheritance diagram for NurbsCurveResult:
Public Member Functions | |
NurbsCurveResult (const NurbsMatrixVector &basis, int order, const LVecBase4f verts[], int num_vertices) | |
The constructor automatically builds up the result as the product of the indicated set of basis matrices and the indicated table of control vertex positions. | |
~NurbsCurveResult () | |
float | get_start_t () const |
Returns the first legal value of t on the curve. | |
float | get_end_t () const |
Returns the last legal value of t on the curve. | |
bool | eval_point (float t, LVecBase3f &point) |
Computes the point on the curve corresponding to the indicated value in parametric time. | |
bool | eval_tangent (float t, LVecBase3f &tangent) |
Computes the tangent to the curve at the indicated point in parametric time. | |
int | get_num_segments () const |
Returns the number of piecewise continuous segments within the curve. | |
void | eval_segment_point (int segment, float t, LVecBase3f &point) const |
Evaluates the point on the curve corresponding to the indicated value in parametric time within the indicated curve segment. | |
void | eval_segment_tangent (int segment, float t, LVecBase3f &tangent) const |
As eval_segment_point, but computes the tangent to the curve at the indicated point. | |
float | get_segment_t (int segment, float t) const |
Accepts a t value in the range [0, 1], and assumed to be relative to the indicated segment (as in eval_segment_point()), and returns the corresponding t value in the entire curve (as in eval_point()). | |
int | get_ref_count () const |
Returns the current reference count. | |
int | ref () const |
Explicitly increments the reference count. | |
int | unref () const |
Explicitly decrements the reference count. | |
void | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
Static Public Member Functions | |
TypeHandle | get_class_type () |
void | init_type () |
Private Member Functions | |
int | find_segment (float t) |
Returns the index of the segment that contains the indicated value of t, or -1 if no segment contains this value. | |
int | r_find_segment (float t, int top, int bot) const |
Recursively searches for the segment that contains the indicated value of t by performing a binary search. | |
Private Attributes | |
NurbsMatrixVector | _prod |
int | _last_segment |
float | _last_from |
float | _last_to |
This object represents a curve in a particular coordinate space. It can return the point and/or tangent to the curve at any point.
This is not related to NurbsCurve, ClassicNurbsCurve, CubicCurveseg or any of the ParametricCurve-derived objects in this module. It is a completely parallel implementation of NURBS curves, and will probably eventually replace the whole ParametricCurve class hierarchy.
Definition at line 56 of file nurbsCurveResult.h.
|
The constructor automatically builds up the result as the product of the indicated set of basis matrices and the indicated table of control vertex positions.
Definition at line 38 of file nurbsCurveResult.cxx. |
|
Definition at line 31 of file nurbsCurveResult.I. References _prod, NurbsMatrixVector::get_start_t(), and INLINE. |
|
Computes the point on the curve corresponding to the indicated value in parametric time. Returns true if the t value is value, false otherwise. Definition at line 75 of file nurbsCurveResult.I. References _prod, eval_segment_tangent(), find_segment(), INLINE, NurbsMatrixVector::scale_t(), and t. |
|
Evaluates the point on the curve corresponding to the indicated value in parametric time within the indicated curve segment. t should be in the range [0, 1]. The curve is internally represented as a number of connected (or possibly unconnected) piecewise continuous segments. The exact number of segments for a particular curve depends on the knot vector, and is returned by get_num_segments(). Normally, eval_point() is used to evaluate a point along the continuous curve, but when you care more about local continuity, you can use eval_segment_point() to evaluate the points along each segment. Definition at line 100 of file nurbsCurveResult.cxx. Referenced by get_end_t(). |
|
As eval_segment_point, but computes the tangent to the curve at the indicated point. The tangent vector will not necessarily be normalized, and could be zero, particularly at the endpoints. Definition at line 124 of file nurbsCurveResult.cxx. References _last_from, _last_segment, _last_to, _prod, NurbsMatrixVector::get_from(), and NurbsMatrixVector::get_to(). Referenced by eval_point(). |
|
Computes the tangent to the curve at the indicated point in parametric time. This tangent vector will not necessarily be normalized, and could be zero. See also eval_point(). Definition at line 100 of file nurbsCurveResult.I. References _prod, NurbsMatrixVector::get_from(), NurbsMatrixVector::get_to(), INLINE, and t. |
|
Returns the index of the segment that contains the indicated value of t, or -1 if no segment contains this value.
Definition at line 146 of file nurbsCurveResult.cxx. Referenced by eval_point(), and get_end_t(). |
|
|
Returns the last legal value of t on the curve.
Definition at line 58 of file nurbsCurveResult.I. References _prod, eval_segment_point(), find_segment(), NurbsMatrixVector::scale_t(), and t. |
|
Returns the number of piecewise continuous segments within the curve. This number is usually not important unless you plan to call eval_segment_point(). Definition at line 125 of file nurbsCurveResult.I. |
|
Returns the current reference count.
Definition at line 183 of file referenceCount.I. Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture(). |
|
Accepts a t value in the range [0, 1], and assumed to be relative to the indicated segment (as in eval_segment_point()), and returns the corresponding t value in the entire curve (as in eval_point()).
Definition at line 144 of file nurbsCurveResult.I. |
|
Returns the first legal value of t on the curve. Usually this is 0.0. Definition at line 45 of file nurbsCurveResult.I. References _prod, NurbsMatrixVector::get_end_t(), and INLINE. |
|
|
Recursively searches for the segment that contains the indicated value of t by performing a binary search. This assumes the segments are stored in increasing order of t, and they don't overlap. Definition at line 185 of file nurbsCurveResult.cxx. |
|
Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 225 of file referenceCount.I. Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering(). |
|
Does some easy checks to make sure that the reference count isn't completely bogus.
Definition at line 328 of file referenceCount.I. References INLINE. Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount(). |
|
Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is the new reference count. Definition at line 293 of file referenceCount.I. References INLINE. Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds(). |
|
Definition at line 82 of file nurbsCurveResult.h. Referenced by eval_segment_tangent(). |
|
Definition at line 81 of file nurbsCurveResult.h. Referenced by eval_segment_tangent(). |
|
Definition at line 83 of file nurbsCurveResult.h. Referenced by eval_segment_tangent(). |
|
Definition at line 79 of file nurbsCurveResult.h. Referenced by eval_point(), eval_segment_tangent(), eval_tangent(), get_end_t(), get_start_t(), and ~NurbsCurveResult(). |