de.grogra.math
Class BSpline

java.lang.Object
  extended by de.grogra.math.BSpline

public final class BSpline
extends java.lang.Object


Nested Class Summary
static interface BSpline.BezierPatchVisitor
           
static interface BSpline.BezierSegmentVisitor
           
 
Field Summary
static EnumerationType SPLINE_PLANE_TYPE
           
 
Method Summary
static void calculateBasisFunctions(float[] out, int p, KnotVector knots, int kd, int span, float u, GraphState gs, float[] left, float[] right)
           
static void calculateDerivatives(float[] out, int p, KnotVector knots, int kd, int span, float u, int n, GraphState gs, float[] left, float[] right, float[] ndu)
          Computes B-Spline basis functions and their derivatives at a given parameter value.
static void calculateKnotsAndParameters(float[] points, int n, int d, int p, boolean centripetal, KnotVectorImpl knots, float[] params)
           
static void decompose(BSpline.BezierPatchVisitor v, BSplineSurface surface, boolean normalizeUV, GraphState state, VertexGridImpl controlPointsOut)
           
static void decompose(BSpline.BezierSegmentVisitor v, BSplineCurve curve, boolean normalizeU, GraphState gs)
           
static void decomposeSplineConnection(BSpline.BezierSegmentVisitor v, BSplineCurve curve, Pool pool2, GraphState gs)
           
static void evaluate(float[] out, BSplineCurve curve, float u, GraphState gs)
           
static void evaluate(float[] out, BSplineSurface surface, float u, float v, GraphState gs)
           
static int findSpan(int n, int p, float u, KnotVector knots, int kd, GraphState gs)
          Determines the knot span index i for B-Spline basis functions.
static float getDefaultKnot(int size, int degree, boolean periodic, boolean bezier, int index)
           
static void interpolate(float[] points, int n, int d, int p, KnotVectorImpl knots, float[] params, float[] tmp, float[] left, float[] right)
           
static boolean isValid(BSplineCurve curve, GraphState gs)
           
static boolean isValid(BSplineSurface surface, GraphState gs)
           
static int[] makeCompatible(FloatList out, BSplineCurveList curves, float knotEps, int dimension, boolean makeRational, GraphState gs)
           
static void makeDefaultKnotVector(float[] knots, int offset, int size, int degree, boolean periodic)
           
static void raiseDegreeInsertKnots(BSplineCurve curve, boolean leftclamped, int[] multiplicity, int resDegree, float[] resKnots, int[] resMultiplicity, float[] verticesOut, GraphState gs, float[] tmp)
           
static void refineKnotVector(BSplineCurve curve, float[] newKnots, float[] knotsOut, int ki, float[] verticesOut, int vi, GraphState gs, float[] tmp)
           
static int set(float[] out, float c0, float c1)
           
static int set(float[] out, float c0, float c1, float c2)
           
static int set(float[] out, float c0, float c1, float c2, float c3)
           
static int set(float[] out, float c0, float c1, float c2, float c3, float c4, float c5)
           
static int set(float[] out, float c0, float c1, float c2, float c3, float c4, float c5, float c6)
           
static void set(Tuple4f out, float[] in, int n, boolean w)
           
static void set(Tuple4f out, float[] in, int offset, int n, boolean w)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPLINE_PLANE_TYPE

public static final EnumerationType SPLINE_PLANE_TYPE
Method Detail

calculateBasisFunctions

public static void calculateBasisFunctions(float[] out,
                                           int p,
                                           KnotVector knots,
                                           int kd,
                                           int span,
                                           float u,
                                           GraphState gs,
                                           float[] left,
                                           float[] right)

calculateDerivatives

public static void calculateDerivatives(float[] out,
                                        int p,
                                        KnotVector knots,
                                        int kd,
                                        int span,
                                        float u,
                                        int n,
                                        GraphState gs,
                                        float[] left,
                                        float[] right,
                                        float[] ndu)
Computes B-Spline basis functions and their derivatives at a given parameter value. The computed values are written to out: The k-th derivative of the r-th basis function is written to the component with index k * (p + 1) + (r + p - span). Note that only the basis functions with span - p <= r <= span are computed (because the others are zero).

Parameters:
out - the computed basis functions and derivates are written to this array
p - the degree of the basis functions
knots - the knot vector
kd - the dimension-argument for the knot vector
span - the span index of the knot vector
u - the parameter
n - compute up to the n-th derivative
gs - the GraphState context
left - a temporary array, minimal size is p + 1
right - a temporary array, minimal size is p + 1
ndu - a temporary array, minimal size is (p + 1)2

calculateKnotsAndParameters

public static void calculateKnotsAndParameters(float[] points,
                                               int n,
                                               int d,
                                               int p,
                                               boolean centripetal,
                                               KnotVectorImpl knots,
                                               float[] params)

decompose

public static void decompose(BSpline.BezierPatchVisitor v,
                             BSplineSurface surface,
                             boolean normalizeUV,
                             GraphState state,
                             VertexGridImpl controlPointsOut)

decompose

public static void decompose(BSpline.BezierSegmentVisitor v,
                             BSplineCurve curve,
                             boolean normalizeU,
                             GraphState gs)

decomposeSplineConnection

public static void decomposeSplineConnection(BSpline.BezierSegmentVisitor v,
                                             BSplineCurve curve,
                                             Pool pool2,
                                             GraphState gs)

evaluate

public static void evaluate(float[] out,
                            BSplineCurve curve,
                            float u,
                            GraphState gs)

evaluate

public static void evaluate(float[] out,
                            BSplineSurface surface,
                            float u,
                            float v,
                            GraphState gs)

findSpan

public static int findSpan(int n,
                           int p,
                           float u,
                           KnotVector knots,
                           int kd,
                           GraphState gs)
Determines the knot span index i for B-Spline basis functions. It is determined such that ti <= u < ti+1, where t is the knot vector.

Parameters:
n - the number of control points minus one
p - the degree of the basis functions.
u - the parameter
knots - the knot vector
kd - the dimension-argument for the knot vector
gs - the GraphState context
Returns:
the span index i`

getDefaultKnot

public static float getDefaultKnot(int size,
                                   int degree,
                                   boolean periodic,
                                   boolean bezier,
                                   int index)

interpolate

public static void interpolate(float[] points,
                               int n,
                               int d,
                               int p,
                               KnotVectorImpl knots,
                               float[] params,
                               float[] tmp,
                               float[] left,
                               float[] right)

isValid

public static boolean isValid(BSplineCurve curve,
                              GraphState gs)

isValid

public static boolean isValid(BSplineSurface surface,
                              GraphState gs)

makeCompatible

public static int[] makeCompatible(FloatList out,
                                   BSplineCurveList curves,
                                   float knotEps,
                                   int dimension,
                                   boolean makeRational,
                                   GraphState gs)

makeDefaultKnotVector

public static void makeDefaultKnotVector(float[] knots,
                                         int offset,
                                         int size,
                                         int degree,
                                         boolean periodic)

raiseDegreeInsertKnots

public static void raiseDegreeInsertKnots(BSplineCurve curve,
                                          boolean leftclamped,
                                          int[] multiplicity,
                                          int resDegree,
                                          float[] resKnots,
                                          int[] resMultiplicity,
                                          float[] verticesOut,
                                          GraphState gs,
                                          float[] tmp)

refineKnotVector

public static void refineKnotVector(BSplineCurve curve,
                                    float[] newKnots,
                                    float[] knotsOut,
                                    int ki,
                                    float[] verticesOut,
                                    int vi,
                                    GraphState gs,
                                    float[] tmp)

set

public static int set(float[] out,
                      float c0,
                      float c1)

set

public static int set(float[] out,
                      float c0,
                      float c1,
                      float c2)

set

public static int set(float[] out,
                      float c0,
                      float c1,
                      float c2,
                      float c3)

set

public static int set(float[] out,
                      float c0,
                      float c1,
                      float c2,
                      float c3,
                      float c4,
                      float c5)

set

public static int set(float[] out,
                      float c0,
                      float c1,
                      float c2,
                      float c3,
                      float c4,
                      float c5,
                      float c6)

set

public static void set(Tuple4f out,
                       float[] in,
                       int n,
                       boolean w)

set

public static void set(Tuple4f out,
                       float[] in,
                       int offset,
                       int n,
                       boolean w)