HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_BezBasis Class Reference

Bezier basis classes which maintain knot vectors. More...

#include <GA_BezBasis.h>

+ Inheritance diagram for GA_BezBasis:

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_KnotVectorgetVector () const
 
GA_KnotVectorgetVector ()
 
const GA_KnotVectorgetKnotVector () const
 
GA_KnotVectorgetKnotVector ()
 

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_BasisnewSpecies (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_KnotFloatgetData () 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
 

Detailed Description

Bezier basis classes which maintain knot vectors.

The GA_BezBasis class maintains the knot vectors for Bezier splines. The basis consists of:

  1. The order of the basis (degree+1)
  2. The knot vector (an array of doubles)

Definition at line 37 of file GA_BezBasis.h.

Constructor & Destructor Documentation

GA_BezBasis::GA_BezBasis ( int  length = -1,
int  order = -1 
)

The default constructor will choose length/order based on the defaults for the basis type. default: order=4, length=2

GA_BezBasis::GA_BezBasis ( fpreal  start,
fpreal  step,
int  length,
int  order = -1 
)
GA_BezBasis::GA_BezBasis ( const GA_BezBasis src)

Member Function Documentation

bool GA_BezBasis::attach ( const GA_Basis b,
bool  overlap = true,
bool  spread = false 
)
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.

bool GA_BezBasis::checkValid ( int  cv_len,
int  b_len,
bool  does_wrap 
) const
overridevirtual

The checkValid() methods test to see whether th basis is valid given a curve with

  1. cvLen vertices
  2. A basis length of b_len
  3. Periodicity determined by doesWrap

Implements GA_Basis.

void GA_BezBasis::chord ( UT_Vector4Array cvs)
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.

fpreal GA_BezBasis::computeBValue ( int  index,
fpreal  u 
) const
overridevirtual

Compute one basis function (ie. the one with the given index) value at u.

Implements GA_Basis.

void GA_BezBasis::evalDerivativeMatrix ( fpreal  u,
int  offset,
int  deriv,
fpreal64  bmatx[][GA_MAXORDER] 
) const
overridevirtual

Evaluate all the derivatives of the basis from 0 to deriv (inclusive).

Implements GA_Basis.

void GA_BezBasis::evalDerivativeMatrix ( fpreal  u,
int  offset,
int  deriv,
fpreal32  bmatx[][GA_MAXORDER] 
) const
overridevirtual

Implements GA_Basis.

void GA_BezBasis::evalInterval ( fpreal  u,
int  offset,
int  deriv,
fpreal64 vals 
) const
overridevirtual

Evaluate on a specific domain interval, on which at least one basis function is non-zero given domain point u.

Implements GA_Basis.

void GA_BezBasis::evalInterval ( fpreal  u,
int  offset,
int  deriv,
fpreal32 vals 
) const
overridevirtual

Implements GA_Basis.

int GA_BezBasis::findOffset ( fpreal  k,
int  start_idx = 0 
) const
overridevirtual

Find index in the knot vector for the break point corresponding to k.

Implements GA_Basis.

int GA_BezBasis::findStartOffset ( fpreal  u,
int  uoffset 
) const
overridevirtual

Return the first break-point. Returns -1 on an error.

Implements GA_Basis.

int GA_BezBasis::getBreakCount ( ) const
overridevirtual

Return the number of breakpoints (ie. unique knots) in the knot vector, in the valid interval.

Implements GA_Basis.

int GA_BezBasis::getBreakpoints ( GA_KnotVector a,
fpreal  tol = theBasisTolerance 
) const
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.

void GA_BezBasis::getCvRangeOfBreakpoint ( int  bkp,
int startcv,
int stopcv 
) const
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.

void GA_BezBasis::getCvRangeOfDomain ( int  ustartidx,
int  ustopidx,
int start_cv,
int end_cv 
) const
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.

void GA_BezBasis::getCvRangeOfDomain ( fpreal  ustart,
fpreal  ustop,
int start_cv,
int end_cv 
) const
overridevirtual

Implements GA_Basis.

int GA_BezBasis::getDimension ( ) const
overridevirtual

Return the dimension of the basis. For Beziers the dimension is equivalent to the length of the knot vector.

Implements GA_Basis.

int GA_BezBasis::getEndMultiplicity ( ) const
overridevirtual

Return the expected multiplicity of the end knots (1 by default):

Reimplemented from GA_Basis.

fpreal GA_BezBasis::getGreville ( int  idx,
bool  clamp = true,
bool  wrap = false 
) const
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.

int GA_BezBasis::getMultiplicity ( fpreal  u,
int uidx 
) const
overridevirtual

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.

GA_BASIS_TYPE GA_BezBasis::getType ( ) const
overridevirtual

Return the type of the basis.

Implements GA_Basis.

const char* GA_BezBasis::getTypeName ( ) const
overridevirtual

Return the name of the basis.

Implements GA_Basis.

bool GA_BezBasis::getValidInterval ( int a,
int b 
) const
overridevirtual

Get the boundaries of the valid evaluation interval (as indices)

Implements GA_Basis.

int GA_BezBasis::grow ( bool  wrapped = false)
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.

bool GA_BezBasis::isEqual ( const GA_Basis basis) const
overridevirtual

Test to see if two bases are equal.

Implements GA_Basis.

int GA_BezBasis::knotToBreakpoint ( int kidx,
int  a,
int  b 
) const
overridevirtual

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.

bool GA_BezBasis::loadH9 ( UT_IStream is,
int  cvs,
bool  wrapped 
)
overridevirtual

Implements GA_Basis.

void GA_BezBasis::makeUniform ( fpreal  ustep = 1)
overridevirtual

Make the basis uniform of just find out if it is uniform:

Implements GA_Basis.

bool GA_BezBasis::operator!= ( const GA_BezBasis a) const
inline

Definition at line 50 of file GA_BezBasis.h.

bool GA_BezBasis::operator== ( const GA_BezBasis a) const
void GA_BezBasis::rebuild ( fpreal  ustart = 0,
fpreal  ustep = 1 
)
overridevirtual

Rebuild the basis as a uniform sequence with a given step.

Implements GA_Basis.

void GA_BezBasis::reset ( )
overridevirtual

Re-initializes the basis to default values.

Implements GA_Basis.

void GA_BezBasis::reverse ( bool  wrapped)
overridevirtual

Reverse the breakpoints in the basis.

Implements GA_Basis.

bool GA_BezBasis::saveH9 ( std::ostream &  os,
bool  wrapped,
bool  binary 
) const
overridevirtual

I/O functions for houdini9 format.

Implements GA_Basis.

void GA_BezBasis::setWrapping ( bool  wrap)
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.

int GA_BezBasis::shrink ( bool  wrapped = false)
overridevirtual

Shrink the basis by one. The basis should not shrink beyond a valid length. Return the new length.

Implements GA_Basis.

bool GA_BezBasis::slideRange ( fpreal  umin,
fpreal  umax,
fpreal  ubias = 0.5 
)
overridevirtual

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.

bool GA_BezBasis::validate ( int  adapt = GA_Basis::GA_BASIS_ADAPT_NONE)
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.


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