j3d.org Code

org.j3d.geom.spline
Class BSplineUtils

java.lang.Object
  extended by org.j3d.geom.spline.BSplineUtils

public class BSplineUtils
extends java.lang.Object

Utility functionality useful for working with BSpline curves and surfaces.

Version:
$Revision: 1.1 $
Author:
Justin Couch

Constructor Summary
BSplineUtils()
           
 
Method Summary
static int getKnotMultiplicity(float[] knots, float k)
          Convenience method to return the current multiplicity of the given knot value in the knot array.
static int getKnotMultiplicity(float[] knots, int numKnots, float k)
          Convenience method to return the current multiplicity of the given knot value in the knot array.
static void insertKnot(BSplineCurveData inputCurve, float knot, BSplineCurveData outputCurve)
          Insert a new knot value into the curve.
static void insertKnot(BSplineCurveData inputCurve, float knot, int times, BSplineCurveData outputCurve)
          Insert a new knot value multiple times into the curve.
static void interpolatePoint(BSplineCurveData inputCurve, float t, float[] point)
          Given the curve data, evaluate the exact point point on the curve in 3D space for the given value of t.
static void subdivide(BSplineCurveData inputCurve, float fraction, BSplineCurveData outputCurve1, BSplineCurveData outputCurve2)
          Subdivide the input curve into two curves, represented by the two output curve functions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BSplineUtils

public BSplineUtils()
Method Detail

getKnotMultiplicity

public static int getKnotMultiplicity(float[] knots,
                                      float k)
Convenience method to return the current multiplicity of the given knot value in the knot array. If the knot does not exist in the array, the multiplicity is given as zero.

Parameters:
knots - The array of current knot values
k - The target knot value
Returns:
The multiplicity of the given knot

getKnotMultiplicity

public static int getKnotMultiplicity(float[] knots,
                                      int numKnots,
                                      float k)
Convenience method to return the current multiplicity of the given knot value in the knot array. If the knot does not exist in the array, the multiplicity is given as zero.

Parameters:
knots - The array of current knot values
numKnots - The number of valid knot values in the array
k - The target knot value
Returns:
The multiplicity of the given knot

interpolatePoint

public static void interpolatePoint(BSplineCurveData inputCurve,
                                    float t,
                                    float[] point)
Given the curve data, evaluate the exact point point on the curve in 3D space for the given value of t.

Parameters:
inputCurve - The definition of the curve to interpolate along
t - The position on the curve to calculate for
point - An array to return the positional data in

insertKnot

public static void insertKnot(BSplineCurveData inputCurve,
                              float knot,
                              BSplineCurveData outputCurve)
                       throws java.lang.IllegalArgumentException
Insert a new knot value into the curve. The code will attempt to reuse the arrays already constructed in the output curve, but will reallocated to a large-enough size if needed. If the knot value is outside the range of the current knots, an exception will be generated.

Parameters:
inputCurve - The definition of the curve to add the knot to
knot - The value of the knot to insert
outputCurve - Reference to the definition to put the output in
Throws:
java.lang.IllegalArgumentException - The knot value is out of range

insertKnot

public static void insertKnot(BSplineCurveData inputCurve,
                              float knot,
                              int times,
                              BSplineCurveData outputCurve)
                       throws java.lang.IllegalArgumentException
Insert a new knot value multiple times into the curve. The code will attempt to reuse the arrays already constructed in the output curve, but will reallocated to a large-enough size if needed. If the knot value is outside the range of the current knots, an exception will be generated.

Parameters:
inputCurve - The definition of the curve to add the knot to
knot - The value of the knot to insert
times - The number of times to insert the knot
outputCurve - Reference to the definition to put the output in
Throws:
java.lang.IllegalArgumentException - The knot value is out of range or the multiplicity is <= 0

subdivide

public static void subdivide(BSplineCurveData inputCurve,
                             float fraction,
                             BSplineCurveData outputCurve1,
                             BSplineCurveData outputCurve2)
                      throws java.lang.IllegalArgumentException
Subdivide the input curve into two curves, represented by the two output curve functions. If the fraction is not (0,1) complain

Throws:
java.lang.IllegalArgumentException

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org