HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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)
 
virtual bool isEqual (const GA_Basis &basis) const
 Test to see if two bases are equal. More...
 
bool operator== (const GA_BezBasis &a) const
 
bool operator!= (const GA_BezBasis &a) const
 
virtual void reset ()
 Re-initializes the basis to default values. More...
 
virtual GA_BASIS_TYPE getType () const
 Return the type of the basis. More...
 
virtual const char * getTypeName () const
 Return the name of the basis. More...
 
virtual int getDimension () const
 
virtual bool getValidInterval (int &a, int &b) const
 Get the boundaries of the valid evaluation interval (as indices) More...
 
virtual void evalInterval (fpreal u, int offset, int deriv, fpreal64 *vals) const
 
virtual void evalInterval (fpreal u, int offset, int deriv, fpreal32 *vals) const
 
virtual void evalDerivativeMatrix (fpreal u, int offset, int deriv, fpreal64 bmatx[][GA_MAXORDER]) const
 Evaluate all the derivatives of the basis from 0 to deriv (inclusive). More...
 
virtual void evalDerivativeMatrix (fpreal u, int offset, int deriv, fpreal32 bmatx[][GA_MAXORDER]) const
 
virtual int findStartOffset (fpreal u, int uoffset) const
 Return the first break-point. Returns -1 on an error. More...
 
virtual fpreal computeBValue (int index, fpreal u) const
 
virtual int getBreakCount () const
 
virtual int knotToBreakpoint (int &kidx, int a, int b) const
 
virtual int getBreakpoints (GA_KnotVector &a, fpreal tol=theBasisTolerance) const
 
virtual int getMultiplicity (fpreal u, int &uidx) const
 
virtual int getEndMultiplicity () const
 Return the expected multiplicity of the end knots (1 by default): More...
 
virtual void getCvRangeOfDomain (int ustartidx, int ustopidx, int &start_cv, int &end_cv) const
 
virtual void getCvRangeOfDomain (fpreal ustart, fpreal ustop, int &start_cv, int &end_cv) const
 
virtual void getCvRangeOfBreakpoint (int bkp, int &startcv, int &stopcv) const
 
virtual bool saveH9 (std::ostream &os, bool wrapped, bool binary) const
 I/O functions for houdini9 format. More...
 
virtual bool loadH9 (UT_IStream &is, int cvs, bool wrapped)
 
bool import (int order, const UT_FloatArray &knots)
 
virtual bool validate (int adapt=GA_Basis::GA_BASIS_ADAPT_NONE)
 
virtual bool checkValid (int cvLen, int bLen, bool doesWrap) const
 
virtual fpreal getGreville (int idx, bool clamp=true, bool wrap=false) const
 
virtual int grow (bool wrapped=false)
 
virtual int shrink (bool wrapped=false)
 
virtual bool attach (const GA_Basis &b, bool overlap=true, bool spread=false)
 
virtual void setWrapping (bool wrap)
 
virtual void reverse (bool wrapped)
 Reverse the breakpoints in the basis. More...
 
virtual int findOffset (fpreal k, int startIdx=0) const
 Find index in the knot vector for the break point corresponding to k. More...
 
virtual void rebuild (fpreal ustart=0, fpreal ustep=1)
 Rebuild the basis as a uniform sequence with a given step. More...
 
virtual void makeUniform (fpreal ustep=1)
 Make the basis uniform of just find out if it is uniform: More...
 
virtual void chord (UT_Vector4Array &cvs)
 
virtual bool slideRange (fpreal umin, fpreal umax, fpreal ubias=0.5)
 
- 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

virtual bool GA_BezBasis::attach ( const GA_Basis b,
bool  overlap = true,
bool  spread = false 
)
virtual

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.

virtual bool GA_BezBasis::checkValid ( int  cvLen,
int  bLen,
bool  doesWrap 
) const
virtual

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

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

Implements GA_Basis.

virtual void GA_BezBasis::chord ( UT_Vector4Array cvs)
virtual

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.

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

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

Implements GA_Basis.

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

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

Implements GA_Basis.

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

Implements GA_Basis.

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

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

Implements GA_Basis.

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

Implements GA_Basis.

virtual int GA_BezBasis::findOffset ( fpreal  k,
int  startIdx = 0 
) const
virtual

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

Implements GA_Basis.

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

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

Implements GA_Basis.

virtual int GA_BezBasis::getBreakCount ( ) const
virtual

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

Implements GA_Basis.

virtual int GA_BezBasis::getBreakpoints ( GA_KnotVector a,
fpreal  tol = theBasisTolerance 
) const
virtual

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.

virtual void GA_BezBasis::getCvRangeOfBreakpoint ( int  bkp,
int startcv,
int stopcv 
) const
virtual

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.

virtual void GA_BezBasis::getCvRangeOfDomain ( int  ustartidx,
int  ustopidx,
int start_cv,
int end_cv 
) const
virtual

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.

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

Implements GA_Basis.

virtual int GA_BezBasis::getDimension ( ) const
virtual

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

Implements GA_Basis.

virtual int GA_BezBasis::getEndMultiplicity ( ) const
virtual

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

Reimplemented from GA_Basis.

virtual fpreal GA_BezBasis::getGreville ( int  idx,
bool  clamp = true,
bool  wrap = false 
) const
virtual

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.

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

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.

virtual GA_BASIS_TYPE GA_BezBasis::getType ( ) const
virtual

Return the type of the basis.

Implements GA_Basis.

virtual const char* GA_BezBasis::getTypeName ( ) const
virtual

Return the name of the basis.

Implements GA_Basis.

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

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

Implements GA_Basis.

virtual int GA_BezBasis::grow ( bool  wrapped = false)
virtual

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.

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

Test to see if two bases are equal.

Implements GA_Basis.

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

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.

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

Implements GA_Basis.

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

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
virtual void GA_BezBasis::rebuild ( fpreal  ustart = 0,
fpreal  ustep = 1 
)
virtual

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

Implements GA_Basis.

virtual void GA_BezBasis::reset ( )
virtual

Re-initializes the basis to default values.

Implements GA_Basis.

virtual void GA_BezBasis::reverse ( bool  wrapped)
virtual

Reverse the breakpoints in the basis.

Implements GA_Basis.

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

I/O functions for houdini9 format.

Implements GA_Basis.

virtual void GA_BezBasis::setWrapping ( bool  wrap)
virtual

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.

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

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

Implements GA_Basis.

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

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.

virtual bool GA_BezBasis::validate ( int  adapt = GA_Basis::GA_BASIS_ADAPT_NONE)
virtual

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: