|
|
|
A Nonuniform Rational B-Spline.
More...
#include "nurbsCurve.h"
List of all members.
Classes |
| class | CV |
Public Member Functions |
| | NurbsCurve (const ParametricCurve &pc) |
| | Constructs a NURBS curve equivalent to the indicated (possibly non-NURBS) curve.
|
| | NurbsCurve (int order, int num_cvs, const float knots[], const LVecBase4f cvs[]) |
| | Constructs a NURBS curve according to the indicated NURBS parameters.
|
| virtual bool | convert_to_nurbs (ParametricCurve *nc) const |
| | Stores in the indicated NurbsCurve a NURBS representation of an equivalent curve.
|
|
virtual TypeHandle | force_init_type () |
| CubicCurveseg * | get_curveseg (int ti) |
| | Returns the curve segment corresponding to the given index.
|
| virtual LVecBase4f | get_cv (int n) const |
| | Returns the position in homogeneous space of the indicated CV.
|
| virtual float | get_knot (int n) const |
| | Retrieves the value of the indicated knot.
|
|
virtual int | get_num_cvs () const |
| virtual int | get_num_knots () const |
| | Returns the number of knots on the curve.
|
| virtual NurbsCurveInterface * | get_nurbs_interface () |
| | Returns a pointer to the object as a NurbsCurveInterface object if it happens to be a NURBS-style curve; otherwise, returns NULL.
|
|
virtual int | get_order () const |
|
virtual TypeHandle | get_type () const |
| virtual bool | insert_cv (float t) |
| | Inserts a new CV into the middle of the curve at the indicated parametric value.
|
| virtual PandaNode * | make_copy () const |
| | Returns a newly-allocated PandaNode that is a shallow copy of this one.
|
| virtual bool | rebuild_curveseg (int rtype0, float t0, const LVecBase4f &v0, int rtype1, float t1, const LVecBase4f &v1, int rtype2, float t2, const LVecBase4f &v2, int rtype3, float t3, const LVecBase4f &v3) |
| | Rebuilds the current curve segment (as selected by the most recent call to find_curve()) according to the specified properties (see CubicCurveseg::compute_seg).
|
| virtual bool | recompute () |
| | Recalculates the curve basis according to the latest position of the CV's, knots, etc.
|
| virtual void | remove_all_cvs () |
| | Removes all CV's from the curve.
|
| virtual bool | remove_cv (int n) |
| | Removes the indicated CV from the curve.
|
| virtual bool | set_cv (int n, const LVecBase4f &v) |
| | Repositions the indicated CV.
|
| virtual bool | set_knot (int n, float t) |
| | Sets the value of the indicated knot.
|
| virtual void | set_order (int order) |
| | Changes the order of the curve.
|
| virtual bool | stitch (const ParametricCurve *a, const ParametricCurve *b) |
| | Regenerates this curve as one long curve: the first curve connected end-to-end with the second one.
|
|
virtual void | write (ostream &out, int indent_level=0) const |
Static Public Member Functions |
|
static TypeHandle | get_class_type () |
|
static void | init_type () |
| static void | register_with_read_factory () |
| | Initializes the factory for reading these things from Bam files.
|
Protected Member Functions |
| virtual int | append_cv_impl (const LVecBase4f &v) |
| | Adds a new CV to the end of the curve.
|
| void | fillin (DatagramIterator &scan, BamReader *manager) |
| | Function that reads out of the datagram (or asks manager to read) all of the data that is needed to re-create this object and stores it in the appropiate place.
|
| int | find_cv (float t) |
| | Finds the first knot whose value is >= t, or -1 if t is beyond the end of the curve.
|
| virtual bool | format_egg (ostream &out, const string &name, const string &curve_type, int indent_level) const |
| | Formats the curve as an egg structure to write to the indicated stream.
|
| virtual void | write_datagram (BamWriter *manager, Datagram &me) |
| | Function to write the important information in the particular object to a Datagram.
|
Static Protected Member Functions |
| static TypedWritable * | make_NurbsCurve (const FactoryParams ¶ms) |
| | Factory method to generate an object of this type.
|
Protected Attributes |
|
pvector< CV > | _cvs |
|
int | _order |
Detailed Description
A Nonuniform Rational B-Spline.
This class is actually implemented as a PiecewiseCurve made up of several CubicCurvesegs, each of which is created using the nurbs_basis() method. The list of CV's and knots is kept here, within the NurbsCurve class.
This class is the original Panda-native implementation of a NURBS curve. It is typedeffed as "NurbsCurve" and performs all NURBS curve functions if we do not have the NURBS++ library available.
However, if we *do* have the NURBS++ library, another class exists, the NurbsPPCurve, which is a wrapper around that library and provides some additional functionality. In that case, the other class is typedeffed to "NurbsCurve" instead of this one, and performs most of the NURBS curve functions. This class then becomes vestigial.
Definition at line 47 of file nurbsCurve.h.
Constructor & Destructor Documentation
| NurbsCurve::NurbsCurve |
( |
int |
order, |
|
|
int |
num_cvs, |
|
|
const float |
knots[], |
|
|
const LVecBase4f |
cvs[] |
|
) |
| |
Member Function Documentation
| int NurbsCurve::append_cv_impl |
( |
const LVecBase4f & |
v | ) |
[protected, virtual] |
| int NurbsCurve::find_cv |
( |
float |
t | ) |
[protected] |
Finds the first knot whose value is >= t, or -1 if t is beyond the end of the curve.
Definition at line 540 of file nurbsCurve.cxx.
Referenced by insert_cv().
| bool NurbsCurve::format_egg |
( |
ostream & |
out, |
|
|
const string & |
name, |
|
|
const string & |
curve_type, |
|
|
int |
indent_level |
|
) |
| const [protected, virtual] |
Formats the curve as an egg structure to write to the indicated stream.
Returns true on success, false on failure.
Reimplemented from NurbsCurveInterface.
Definition at line 528 of file nurbsCurve.cxx.
| LVecBase4f NurbsCurve::get_cv |
( |
int |
n | ) |
const [virtual] |
| float NurbsCurve::get_knot |
( |
int |
n | ) |
const [virtual] |
| int NurbsCurve::get_num_knots |
( |
| ) |
const [virtual] |
| bool NurbsCurve::insert_cv |
( |
float |
t | ) |
[virtual] |
Inserts a new CV into the middle of the curve at the indicated parametric value.
This doesn't change the shape or timing of the curve; however, it is irreversible: if the new CV is immediately removed, the curve will be changed. Returns true if successful, false otherwise.
Implements NurbsCurveInterface.
Definition at line 158 of file nurbsCurve.cxx.
References find_cv(), and get_knot().
| PandaNode * NurbsCurve::make_copy |
( |
| ) |
const [virtual] |
Returns a newly-allocated PandaNode that is a shallow copy of this one.
It will be a different pointer, but its internal data may or may not be shared with that of the original PandaNode. No children will be copied.
Reimplemented from PandaNode.
Definition at line 97 of file nurbsCurve.cxx.
| bool NurbsCurve::rebuild_curveseg |
( |
int |
rtype0, |
|
|
float |
t0, |
|
|
const LVecBase4f & |
v0, |
|
|
int |
rtype1, |
|
|
float |
t1, |
|
|
const LVecBase4f & |
v1, |
|
|
int |
rtype2, |
|
|
float |
t2, |
|
|
const LVecBase4f & |
v2, |
|
|
int |
rtype3, |
|
|
float |
t3, |
|
|
const LVecBase4f & |
v3 |
|
) |
| [virtual] |
| bool NurbsCurve::recompute |
( |
| ) |
[virtual] |
| void NurbsCurve::register_with_read_factory |
( |
| ) |
[static] |
| void NurbsCurve::remove_all_cvs |
( |
| ) |
[virtual] |
| bool NurbsCurve::remove_cv |
( |
int |
n | ) |
[virtual] |
| bool NurbsCurve::set_cv |
( |
int |
n, |
|
|
const LVecBase4f & |
v |
|
) |
| [virtual] |
| bool NurbsCurve::set_knot |
( |
int |
n, |
|
|
float |
t |
|
) |
| [virtual] |
Sets the value of the indicated knot.
There are get_num_cvs() + _order knot values, but the first _order - 1 and the last 1 knot values cannot be changed. It is also an error to set a knot value outside the range of its neighbors.
Implements NurbsCurveInterface.
Definition at line 274 of file nurbsCurve.cxx.
References get_num_knots().
Referenced by NurbsCurve().
| void NurbsCurve::set_order |
( |
int |
order | ) |
[virtual] |
Changes the order of the curve.
Must be a value from 1 to 4. Can only be done when there are no cv's.
Implements NurbsCurveInterface.
Definition at line 108 of file nurbsCurve.cxx.
Regenerates this curve as one long curve: the first curve connected end-to-end with the second one.
Either a or b may be the same as 'this'.
Returns true if successful, false on failure or if the curve type does not support stitching.
Reimplemented from ParametricCurve.
Definition at line 425 of file nurbsCurve.cxx.
References recompute().
| void NurbsCurve::write_datagram |
( |
BamWriter * |
manager, |
|
|
Datagram & |
me |
|
) |
| [protected, virtual] |
The documentation for this class was generated from the following files:
| | |