All Packages  This Package  Class Hierarchy  Class Search  Index

Class acg.stuttgart.rich.spline.CatmullRomSpline3D
java.lang.Object
   |
   +----acg.stuttgart.rich.spline.Spline3D
           |
           +----acg.stuttgart.rich.spline.CatmullRomSpline3D

  Summary

public class  CatmullRomSpline3D
     extends acg.stuttgart.rich.spline.Spline3D
{
          // Fields 9
     protected final int KNOT_ADDED;
     protected final int READY;
     protected final int UNDEFINED;
     protected Vector knotVect;
     protected int numKnots;
     protected CatmullRomSpline3D.HermiteTreeNode root;
     protected float smoothness;
     protected float splineLength;
     protected int splineState;

          // Constructors 2
     public CatmullRomSpline3D();
     public CatmullRomSpline3D(float);

          // Methods 14
     public void addKnot(Vector3D);
     public void addKnot(Vector3D, float) throws SplineException;
     protected void calculateTangents();
     public Vector3D evaluate(float) throws SplineException;
     public void evaluate(float, Vector3D) throws SplineException;
     protected void internalBuildTree(int, int);
     protected void internalUpdateTree(int, int, CatmullRomSpline3D.HermiteTreeNode);
     public void sample(Vector3D[], float, float) throws SplineException;
     public void sample(Vector3D[], int, int, float, float) throws SplineException;
     public Vector3D[] sample(int, float, float) throws SplineException;
     public String toString();
     protected void updateHermiteTree();
     public void updateKnots(Vector3D[]) throws SplineException;
     public void updateKnots(Vector3D[], int) throws SplineException;

          // Inner Classes 2
     protected class CatmullRomSpline3D.Knot
     protected class CatmullRomSpline3D.HermiteTreeNode
}

The CatmullRomSpline3D class is an interpolating 3D spline with Catmull-Rom continuity at the knots. Tangents at the beginning and end of the spline are defined by the first two and last two knots respectively.


  Cross Reference

Extended By:
CatmullRomSplineLoop3D, FastCRSpline3D





  Fields

· UNDEFINED

Summary  |  Top
   protected final int UNDEFINED


· KNOT_ADDED

Summary  |  Top
   protected final int KNOT_ADDED


· READY

Summary  |  Top
   protected final int READY


· root

Summary  |  Top
   protected CatmullRomSpline3D.HermiteTreeNode root


· splineState

Summary  |  Top
   protected int splineState


· numKnots

Summary  |  Top
   protected int numKnots


· splineLength

Summary  |  Top
   protected float splineLength


· smoothness

Summary  |  Top
   protected float smoothness


· knotVect

Summary  |  Top
   protected Vector knotVect


  Constructors

· CatmullRomSpline3D

Summary  |  Top

   public CatmullRomSpline3D(float smoothness) 

The CatmullRomSpline3D constructor takes no arguments, and produces an "empty" spline containing no knots. At least three knots must be added before the spline can be evaluated.



· CatmullRomSpline3D

Summary  |  Top
   public CatmullRomSpline3D() 


  Methods

· addKnot

Summary  |  Top
   public void addKnot(Vector3D p) 

The addKnot method adds a new knot to the spline.



· addKnot

Summary  |  Top
   public void addKnot(Vector3D p, 
                       float l)  throws SplineException

The addKnot method adds a new knot to the spline. This form allows you to specify the parametric length of the segment associated with the knot.



· updateKnots

Summary  |  Top
   public void updateKnots(Vector3D[] newKnots)  throws SplineException

The updateKnots method replaces the current spline knots with an array of new knots. The length of the array must be the same as the number of knots.



· updateKnots

Summary  |  Top
   public void updateKnots(Vector3D[] newKnots, 
                           int offset)  throws SplineException

The updateKnots method replaces the current spline knots with an array of new knots. This version takes as a prameter an offset into an array. If the offset plus the current number of knots is greater than the length of the array, an exception is signaled.



· evaluate

Summary  |  Top
   public Vector3D evaluate(float s)  throws SplineException

The evaluate method is the core method of the class. You call evaluate with a single parameter, a number between zero and one. This will return a point in 3D space coresponding to f(s), where f is the vector-valued function representing the spline. In a spline with three knots, f(0) gives you the first knot, f(0.5) gives you the second, and f(0.25) gives you a spline-interpolated point between the *first and second knots.

Overrides:
evaluate in class Spline3D


· evaluate

Summary  |  Top
   public void evaluate(float s, 
                        Vector3D val)  throws SplineException

Evaluate the spline in-place.



· sample

Summary  |  Top
   public void sample(Vector3D[] samples, 
                      float min, 
                      float range)  throws SplineException

The sample method operates in-place to fill an array with regularly spaced samples between f(min) and f(min+range). Ordinarily, min=0 and range=1.



· sample

Summary  |  Top
   public void sample(Vector3D[] samples, 
                      int number, 
                      int offset, 
                      float min, 
                      float range)  throws SplineException

The sample method operates in-place to fill an array with regularly spaced samples between f(min) and f(min+range). This version of sample takes two addtional parameters specifying the number of samples to be taken and an offset into the array. The purpose of this is to allow many splines to be sampled into the same array of vectors, which can then be transformed as a unit. Ordinarily, min=0 and range=1.



· sample

Summary  |  Top
   public Vector3D[] sample(int numSamples, 
                            float min, 
                            float range)  throws SplineException

This version of sample returns a new vector containing the requested number of samples



· toString

Summary  |  Top
   public String toString() 

The toString method does not provide any useful information at this time.

Overrides:
toString in class Object


· updateHermiteTree

Summary  |  Top
   protected void updateHermiteTree() 

This method constructs a tree of hermite spline nodes, allowing rapid evaluation of the spline (log(n) comparisons).



· calculateTangents

Summary  |  Top
   protected void calculateTangents() 

The calculateTangents method calculates tangents and spline length for updateHermiteTree and updateKnots.



· internalBuildTree

Summary  |  Top
   protected void internalBuildTree(int min, 
                                    int max) 

This method recursively constructs the spline tree.



· internalUpdateTree

Summary  |  Top
   protected void internalUpdateTree(int min, 
                                     int max, 
                                     CatmullRomSpline3D.HermiteTreeNode node) 

This method recursively updates the spline tree.



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7