HDK
|
Bezier basis classes which maintain knot vectors. More...
#include <GA_BezBasis.h>
Public Member Functions | |
GA_BezBasis (int length=-1, int order=-1) | |
GA_BezBasis (fpreal start, fpreal step, int length, int order=-1) | |
GA_BezBasis (const GA_BezBasis &src) | |
bool | isEqual (const GA_Basis &basis) const override |
Test to see if two bases are equal. More... | |
bool | operator== (const GA_BezBasis &a) const |
bool | operator!= (const GA_BezBasis &a) const |
void | reset () override |
Re-initializes the basis to default values. More... | |
GA_BASIS_TYPE | getType () const override |
Return the type of the basis. More... | |
const char * | getTypeName () const override |
Return the name of the basis. More... | |
int | getDimension () const override |
bool | getValidInterval (int &a, int &b) const override |
Get the boundaries of the valid evaluation interval (as indices) More... | |
void | evalInterval (fpreal u, int offset, int deriv, fpreal64 *vals) const override |
void | evalInterval (fpreal u, int offset, int deriv, fpreal32 *vals) const override |
void | evalDerivativeMatrix (fpreal u, int offset, int deriv, fpreal64 bmatx[][GA_MAXORDER]) const override |
Evaluate all the derivatives of the basis from 0 to deriv (inclusive). More... | |
void | evalDerivativeMatrix (fpreal u, int offset, int deriv, fpreal32 bmatx[][GA_MAXORDER]) const override |
int | findStartOffset (fpreal u, int uoffset) const override |
Return the first break-point. Returns -1 on an error. More... | |
fpreal | computeBValue (int index, fpreal u) const override |
int | getBreakCount () const override |
int | knotToBreakpoint (int &kidx, int a, int b) const override |
int | getBreakpoints (GA_KnotVector &a, fpreal tol=theBasisTolerance) const override |
int | getMultiplicity (fpreal u, int &uidx) const override |
int | getEndMultiplicity () const override |
Return the expected multiplicity of the end knots (1 by default): More... | |
void | getCvRangeOfDomain (int ustartidx, int ustopidx, int &start_cv, int &end_cv) const override |
void | getCvRangeOfDomain (fpreal ustart, fpreal ustop, int &start_cv, int &end_cv) const override |
void | getCvRangeOfBreakpoint (int bkp, int &startcv, int &stopcv) const override |
bool | saveH9 (std::ostream &os, bool wrapped, bool binary) const override |
I/O functions for houdini9 format. More... | |
bool | loadH9 (UT_IStream &is, int cvs, bool wrapped) override |
bool | import (int order, const UT_FloatArray &knots) |
bool | validate (int adapt=GA_Basis::GA_BASIS_ADAPT_NONE) override |
bool | checkValid (int cv_len, int b_len, bool does_wrap) const override |
fpreal | getGreville (int idx, bool clamp=true, bool wrap=false) const override |
int | grow (bool wrapped=false) override |
int | shrink (bool wrapped=false) override |
bool | attach (const GA_Basis &b, bool overlap=true, bool spread=false) override |
void | setWrapping (bool wrap) override |
void | reverse (bool wrapped) override |
Reverse the breakpoints in the basis. More... | |
int | findOffset (fpreal k, int start_idx=0) const override |
Find index in the knot vector for the break point corresponding to k. More... | |
void | rebuild (fpreal ustart=0, fpreal ustep=1) override |
Rebuild the basis as a uniform sequence with a given step. More... | |
void | makeUniform (fpreal ustep=1) override |
Make the basis uniform of just find out if it is uniform: More... | |
void | chord (UT_Vector4Array &cvs) override |
bool | slideRange (fpreal umin, fpreal umax, fpreal ubias=0.5) override |
Public Member Functions inherited from GA_Basis | |
GA_Basis () | |
The default constructor will initialize order=0 and length=0. More... | |
GA_Basis (const GA_Basis &src) | |
virtual | ~GA_Basis () |
Destructor. More... | |
int | getOrder () const |
Return the order of the basis. More... | |
int | getLength () const |
Return the length of the knot vector. More... | |
bool | getValidRange (fpreal &a, fpreal &b) const |
Get the boundaries of the valid range of evaluation. More... | |
int | getMultiplicities (UT_IntArray &arr) const |
bool | testForNan () const |
Returns true if any NANs snuck into this vector. More... | |
bool | jsonSave (UT_JSONWriter &w) const |
bool | jsonSave (UT_JSONValue &v) const |
Save to a JSON value. More... | |
bool | jsonLoad (UT_JSONParser &p) |
Load basis from a JSON parser. More... | |
bool | jsonLoad (UT_JSONParser &p, const UT_JSONValue &v) |
Load basis from a JSON value. More... | |
virtual bool | copyFrom (const GA_Basis &b, bool compatible=false) |
bool | checkValid (int cvLen, bool doesWrap) const |
Convenience method to check validity using the basis's length. More... | |
fpreal | unitToReal (fpreal u_unit, bool valid_interval=true) const |
fpreal | realToUnit (fpreal u_real, bool valid_interval=true) const |
int | append (fpreal v) |
Append a knot value to the end of the knot vector. More... | |
int | insertKnot (fpreal v, int i) |
int | remove (int i) |
Remove a knot value (by index) More... | |
bool | merge (const GA_Basis &b) |
bool | merge (GA_Basis &b) |
int | findMaxSpan (int start, int stop) const |
void | normalize (fpreal scale=0, const fpreal *neworig=0) |
Convenience method to normalize this basis. More... | |
void | map (const GA_Basis &b) |
void | map (fpreal newlen=1, const fpreal *neworig=0) |
int | map (const GA_Basis &b, fpreal &u, int uoffset=0) const |
void | setOrder (int ord) |
bool | findClosest (fpreal val, int &idx, int startidx, int endidx) const |
int | findApproximate (fpreal val, int startidx, fpreal tol=theBasisTolerance) const |
void | computeRaiseOrderAlphas (int increment, fpreal bezalfs[][GA_MAXORDER]) const |
void | resize (int sz) |
virtual int64 | getMemoryUsage (bool inclusive) const |
Return the amount of memory used. More... | |
const GA_KnotVector & | getVector () const |
GA_KnotVector & | getVector () |
const GA_KnotVector & | getKnotVector () const |
GA_KnotVector & | getKnotVector () |
Additional Inherited Members | |
Public Types inherited from GA_Basis | |
enum | { GA_BASIS_ADAPT_NONE, GA_BASIS_ADAPT_FLAGS, GA_BASIS_ADAPT_KNOTS } |
Static Public Member Functions inherited from GA_Basis | |
static GA_Basis * | newSpecies (GA_BASIS_TYPE type) |
static void | map (GA_KnotVector &knots, const GA_KnotVector &src, fpreal newlen=1, const fpreal *neworig=0) |
Static Public Attributes inherited from GA_Basis | |
static const fpreal | theBasisTolerance |
static const fpreal | theBinomial [GA_MAXORDER][GA_MAXORDER] |
Table of binomial coefficients. More... | |
Protected Member Functions inherited from GA_Basis | |
const GA_KnotFloat * | getData () const |
Static Protected Member Functions inherited from GA_Basis | |
static void | doMerge (GA_KnotVector &avec, const GA_KnotVector &bvec, GA_KnotVector *inserts=0) |
Protected Attributes inherited from GA_Basis | |
GA_KnotVector | myData |
int | myOrder |
Bezier basis classes which maintain knot vectors.
The GA_BezBasis class maintains the knot vectors for Bezier splines. The basis consists of:
Definition at line 37 of file GA_BezBasis.h.
The default constructor will choose length/order based on the defaults for the basis type. default: order=4, length=2
GA_BezBasis::GA_BezBasis | ( | const GA_BezBasis & | src | ) |
|
overridevirtual |
Attach another basis to us and grow our basis as a result. The bases must have the same type and order. If "overlap" is true, we overlap the beginning of b with our end. Spreading makes sense when you can have multiple knots in the basis, and causes identical knots to be spread within range of the neighbouring knots.
Implements GA_Basis.
The checkValid() methods test to see whether th basis is valid given a curve with
Implements GA_Basis.
|
overridevirtual |
Reparameterize the basis using the chord-length method, and clamp it to the valid interval. The origin and length of the valid domain remains unchanged.
Implements GA_Basis.
Compute one basis function (ie. the one with the given index) value at u.
Implements GA_Basis.
|
overridevirtual |
Evaluate all the derivatives of the basis from 0 to deriv (inclusive).
Implements GA_Basis.
|
overridevirtual |
Implements GA_Basis.
|
overridevirtual |
Evaluate on a specific domain interval, on which at least one basis function is non-zero given domain point u.
Implements GA_Basis.
|
overridevirtual |
Implements GA_Basis.
Find index in the knot vector for the break point corresponding to k.
Implements GA_Basis.
Return the first break-point. Returns -1 on an error.
Implements GA_Basis.
|
overridevirtual |
Return the number of breakpoints (ie. unique knots) in the knot vector, in the valid interval.
Implements GA_Basis.
|
overridevirtual |
Compute an array of breakpoints (i.e. unique knots) in the valid interval and return their number. The tolerance is used to differentiate between close knots.
Implements GA_Basis.
|
overridevirtual |
Given valid breakpoint index, compute the range of CVs that have a non-zero influence at the knot of the breakpoint. Since the basis doesn't know about wrapping, the endcv index might be higher than the spline's number of CVs.
Implements GA_Basis.
|
overridevirtual |
Given a domain range in the valid interval, compute the range of CVs that will be involved in the evaluation of the curve in that range. Since the basis doesn't know about wrapping, the endcv index might be higher than the spline's number of CVs.
Implements GA_Basis.
|
overridevirtual |
Implements GA_Basis.
|
overridevirtual |
Return the dimension of the basis. For Beziers the dimension is equivalent to the length of the knot vector.
Implements GA_Basis.
|
overridevirtual |
Return the expected multiplicity of the end knots (1 by default):
Reimplemented from GA_Basis.
|
overridevirtual |
Compute the idx'th greville abscissa of the domain vector. Clamping to the valid interval is optional and might not make any difference for some spline types.
Implements GA_Basis.
Return the multiplicity of a domain point or -1 if outside the domain. "uidx" is the index of the largest breakpoint <= u.
Implements GA_Basis.
|
overridevirtual |
Return the type of the basis.
Implements GA_Basis.
|
overridevirtual |
Return the name of the basis.
Implements GA_Basis.
Get the boundaries of the valid evaluation interval (as indices)
Implements GA_Basis.
|
overridevirtual |
Grow the length of the basis by one, and set the value of the new entry to last knot+1. The method returns the index of the appended element.
Implements GA_Basis.
bool GA_BezBasis::import | ( | int | order, |
const UT_FloatArray & | knots | ||
) |
Transitional method while we might need to import data from a GB_Basis. Be careful calling this method as the order must be appropriate for the number of knots. TODO: Remove when no longer necessary.
|
overridevirtual |
Test to see if two bases are equal.
Implements GA_Basis.
Given the index of a knot (kidx) and two bounds in the knot sequence (a and b) find out the index of the breakpoint that the knot represents, and possibly adjust kidx so that knot[kidx+1] > knot[kidx]. Return -1 if not found.
Implements GA_Basis.
|
overridevirtual |
Implements GA_Basis.
Make the basis uniform of just find out if it is uniform:
Implements GA_Basis.
|
inline |
Definition at line 50 of file GA_BezBasis.h.
bool GA_BezBasis::operator== | ( | const GA_BezBasis & | a | ) | const |
Rebuild the basis as a uniform sequence with a given step.
Implements GA_Basis.
|
overridevirtual |
Re-initializes the basis to default values.
Implements GA_Basis.
|
overridevirtual |
Reverse the breakpoints in the basis.
Implements GA_Basis.
|
overridevirtual |
I/O functions for houdini9 format.
Implements GA_Basis.
|
overridevirtual |
Change the size of the basis (and maybe some of its values too) to make it a valid basis for wrapped splines.
Implements GA_Basis.
|
overridevirtual |
Shrink the basis by one. The basis should not shrink beyond a valid length. Return the new length.
Implements GA_Basis.
Slide the knots found in the given range left or right by an amount at most as large as the distance to the nearest knot outside the range. The bias is a percentage value of the left-right distance, its default value is 0.5 (i.e. don't change anything), and is clamped to [0,1].
Implements GA_Basis.
|
overridevirtual |
The validate() method will force the basis to be valid (if possible). The adapt enum can be used to control the behaviour of this method.
Implements GA_Basis.