Panda3D

Classes | Public Member Functions | Public Attributes | List of all members
NurbsCurveResult Class Reference

The result of a NurbsCurveEvaluator. More...

`#include "nurbsCurveResult.h"`

Inheritance diagram for NurbsCurveResult:

## Public Member Functions
| NurbsCurveResult (const NurbsBasisVector &basis, const LVecBase4 vecs[], const NurbsVertex *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. More...
void | adaptive_sample (PN_stdfloat tolerance)
| Determines the set of subdivisions necessary to approximate the curve with a set of linear segments, no point of which is farther than tolerance units from the actual curve. More...
PN_stdfloat | eval_extended_point (PN_stdfloat t, int d)
| Evaluates the curve in n-dimensional space according to the extended vertices associated with the curve in the indicated dimension. More...
bool | eval_extended_points (PN_stdfloat t, int d, PN_stdfloat result[], int num_values)
| Simultaneously performs eval_extended_point on a contiguous sequence of dimensions. More...
bool | eval_point (PN_stdfloat t, LVecBase3 &point)
| Computes the point on the curve corresponding to the indicated value in parametric time. More...
PN_stdfloat | eval_segment_extended_point (int segment, PN_stdfloat t, int d) const
| Evaluates the curve in n-dimensional space according to the extended vertices associated with the curve in the indicated dimension. More...
void | eval_segment_extended_points (int segment, PN_stdfloat t, int d, PN_stdfloat result[], int num_values) const
| Simultaneously performs eval_extended_point on a contiguous sequence of dimensions. More...
void | eval_segment_point (int segment, PN_stdfloat t, LVecBase3 &point) const
| Evaluates the point on the curve corresponding to the indicated value in parametric time within the indicated curve segment. More...
void | eval_segment_tangent (int segment, PN_stdfloat t, LVecBase3 &tangent) const
| As eval_segment_point, but computes the tangent to the curve at the indicated point. More...
bool | eval_tangent (PN_stdfloat t, LVecBase3 &tangent)
| Computes the tangent to the curve at the indicated point in parametric time. More...
PN_stdfloat | get_end_t () const
| Returns the last legal value of t on the curve. More...
int | get_num_samples () const
int | get_num_segments () const
| Returns the number of piecewise continuous segments within the curve. More...
const LPoint3 & | get_sample_point (int n) const
PN_stdfloat | get_sample_t (int n) const
PN_stdfloat | get_segment_t (int segment, PN_stdfloat 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()). More...
PN_stdfloat | get_start_t () const
| Returns the first legal value of t on the curve. More...
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object. More...
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
void | ref () const
| Explicitly increments the reference count. More...
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero. More...
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus. More...
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
virtual bool | unref () const
| Explicitly decrements the reference count. More...
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one. More...
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object. More...
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object. More...
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)

## Public Attributes
| get_num_samples
| Returns the number of sample points generated by the previous call to adaptive_sample(). More...
| get_sample_point
| Returns the point on the curve of the nth sample point generated by the previous call to adaptive_sample(). More...
| get_sample_t
| Returns the t value of the nth sample point generated by the previous call to adaptive_sample(). More...
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count. More...

## Additional Inherited Members
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()

## Detailed Description

The result of a NurbsCurveEvaluator.

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, 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 35 of file nurbsCurveResult.h.

## Constructor & Destructor Documentation

## ◆ NurbsCurveResult()

NurbsCurveResult::NurbsCurveResult | ( | const NurbsBasisVector & | basis,
|  | const LVecBase4 | vecs[],
|  | const NurbsVertex * | 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.

Definition at line 23 of file nurbsCurveResult.cxx.

References NurbsBasisVector::get_num_segments(), and NurbsBasisVector::get_order().

## Member Function Documentation

## ◆ adaptive_sample()

void NurbsCurveResult::adaptive_sample | ( | PN_stdfloat | tolerance | ) |

Determines the set of subdivisions necessary to approximate the curve with a set of linear segments, no point of which is farther than tolerance units from the actual curve.

After this call, you may walk through the resulting set of samples with get_num_samples(), get_sample_t(), and get_sample_point().

Definition at line 188 of file nurbsCurveResult.cxx.

References eval_segment_point(), NurbsBasisVector::get_from(), and NurbsBasisVector::get_num_segments().

## ◆ eval_extended_point()

PN_stdfloat NurbsCurveResult::eval_extended_point | ( | PN_stdfloat | t,
|  | int | d
| ) |  |
| inline

Evaluates the curve in n-dimensional space according to the extended vertices associated with the curve in the indicated dimension.

Definition at line 72 of file nurbsCurveResult.I.

## ◆ eval_extended_points()

bool NurbsCurveResult::eval_extended_points | ( | PN_stdfloat | t,
|  | int | d,
|  | PN_stdfloat | result[],
|  | int | num_values
| ) |  |
| inline

Simultaneously performs eval_extended_point on a contiguous sequence of dimensions.

The dimensions evaluated are d through (d + num_values - 1); the results are filled into the num_values elements in the indicated result array.

Definition at line 88 of file nurbsCurveResult.I.

## ◆ eval_point()

bool NurbsCurveResult::eval_point | ( | PN_stdfloat | t,
|  | LVecBase3 & | point
| ) |  |
| inline

Computes the point on the curve corresponding to the indicated value in parametric time.

Returns true if the t value is valid, false otherwise.

Definition at line 41 of file nurbsCurveResult.I.

## ◆ eval_segment_extended_point()

PN_stdfloat NurbsCurveResult::eval_segment_extended_point | ( | int | segment,
|  | PN_stdfloat | t,
|  | int | d
| ) |  | const

Evaluates the curve in n-dimensional space according to the extended vertices associated with the curve in the indicated dimension.

Definition at line 102 of file nurbsCurveResult.cxx.

## ◆ eval_segment_extended_points()

void NurbsCurveResult::eval_segment_extended_points | ( | int | segment,
|  | PN_stdfloat | t,
|  | int | d,
|  | PN_stdfloat | result[],
|  | int | num_values
| ) |  | const

Simultaneously performs eval_extended_point on a contiguous sequence of dimensions.

The dimensions evaluated are d through (d + num_values - 1); the results are filled into the num_values elements in the indicated result array.

Definition at line 143 of file nurbsCurveResult.cxx.

## ◆ eval_segment_point()

void NurbsCurveResult::eval_segment_point | ( | int | segment,
|  | PN_stdfloat | t,
|  | LVecBase3 & | point
| ) |  | const

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 71 of file nurbsCurveResult.cxx.

Referenced by adaptive_sample().

## ◆ eval_segment_tangent()

void NurbsCurveResult::eval_segment_tangent | ( | int | segment,
|  | PN_stdfloat | t,
|  | LVecBase3 & | tangent
| ) |  | const

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 88 of file nurbsCurveResult.cxx.

## ◆ eval_tangent()

bool NurbsCurveResult::eval_tangent | ( | PN_stdfloat | t,
|  | LVecBase3 & | tangent
| ) |  |
| inline

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 57 of file nurbsCurveResult.I.

## ◆ get_end_t()

PN_stdfloat NurbsCurveResult::get_end_t | ( |  | ) | const
| inline

Returns the last legal value of t on the curve.

Definition at line 32 of file nurbsCurveResult.I.

## ◆ get_num_segments()

int NurbsCurveResult::get_num_segments | ( |  | ) | const
| inline

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 105 of file nurbsCurveResult.I.

## ◆ get_segment_t()

PN_stdfloat NurbsCurveResult::get_segment_t | ( | int | segment,
|  | PN_stdfloat | t
| ) |  | const
| inline

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 115 of file nurbsCurveResult.I.

## ◆ get_start_t()

PN_stdfloat NurbsCurveResult::get_start_t | ( |  | ) | const
| inline

Returns the first legal value of t on the curve.

Usually this is 0.0.

Definition at line 24 of file nurbsCurveResult.I.

## Member Data Documentation

## ◆ get_num_samples

int NurbsCurveResult::get_num_samples
| inline

Returns the number of sample points generated by the previous call to adaptive_sample().

Definition at line 65 of file nurbsCurveResult.h.

## ◆ get_sample_point

const LPoint3 & NurbsCurveResult::get_sample_point
| inline

Returns the point on the curve of the nth sample point generated by the previous call to adaptive_sample().

For tangents, or extended points, you should use get_sample_t() and pass it into eval_tangent() or eval_extended_point().

Definition at line 66 of file nurbsCurveResult.h.

## ◆ get_sample_t

PN_stdfloat NurbsCurveResult::get_sample_t
| inline

Returns the t value of the nth sample point generated by the previous call to adaptive_sample().

Definition at line 65 of file nurbsCurveResult.h.

The documentation for this class was generated from the following files:

- panda/src/parametrics/nurbsCurveResult.h
- panda/src/parametrics/nurbsCurveResult.cxx
- panda/src/parametrics/nurbsCurveResult.I