hmi.math
Class Bezier2f

java.lang.Object
  extended by hmi.math.Bezier2f

public class Bezier2f
extends Object


Field Summary
private static float EPS
           
private  float high
           
private  float low
           
private  int np
           
private  int nseg
           
private  Bezier1f xspline
           
private  Bezier1f yspline
           
 
Constructor Summary
Bezier2f(float[] points)
          Creates a new Bezier2f object, where the x and y coordinates of the bezier points and control points are specified in a single float array, alternating between x and y coordinates.
Bezier2f(float[][] points, float[][] controlPoints)
          Create a new Bezier curve with interpolated points "points" which is an array of Vec2f elements, that is, every points[i] must be a float[2] array.
Bezier2f(float[] xcoords, float[] ycoords)
          Creates a new Bezier2f object, where the x and y coordinates of the bezier points and control points are specified in two separate float arrays, of equal length.
 
Method Summary
static Bezier2f bezier2fFromPointsVectorsSingleWeights(float[][] points2f, float[][] vectors2f, float[] weights)
          Like bezier2fFromPointsVectorsWeights, except that the number of weight must be equal to the number of interpolated points.
static Bezier2f bezier2fFromPointsVectorsWeights(float[][] points2f, float[][] vectors2f, float[] weights)
          Creates a ne Bezier2f object from an array of Vec2f points that are interpolated, an array of Vec2f tangent vectors, and a float array containing weights.
 float[] eval(float[] result, float u)
          Evaluates the Bezier curve and puts the result in a float[2] array result, which is also returned as result value.
 float evalFX(float x)
          Asssuming that our Bezier curve is a functional relation of the form y = f(x) finds the function value f(x) for the specified x, provided x is within the range [ p[0][0] ; p[n-1].[0] ], where n denotes the number of points, and p[0][0] = x value of point 0, etc.
 float evalFX(float x, float low, float high)
          Asssuming that our Bezier curve is a functional relation of the form y = f(x) for parameter values u within the interval [low, high], evalFX(x) finds the function value y = f(x) The x coordinates are allowed to be either monotoneously increasing or decreasing over the specified interval.
 void setRange(float low, float high)
          Sets the interpolation range for the eval method: for an u value low we are at the first point, for u= high we are at the last point.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xspline

private Bezier1f xspline

yspline

private Bezier1f yspline

low

private float low

high

private float high

np

private int np

nseg

private int nseg

EPS

private static final float EPS
See Also:
Constant Field Values
Constructor Detail

Bezier2f

public Bezier2f(float[][] points,
                float[][] controlPoints)
Create a new Bezier curve with interpolated points "points" which is an array of Vec2f elements, that is, every points[i] must be a float[2] array. and a similar array of "controlPoints", also Vec2f elements. The coordinates can be copied, when copy == true, or else they are referenced


Bezier2f

public Bezier2f(float[] points)
Creates a new Bezier2f object, where the x and y coordinates of the bezier points and control points are specified in a single float array, alternating between x and y coordinates.


Bezier2f

public Bezier2f(float[] xcoords,
                float[] ycoords)
Creates a new Bezier2f object, where the x and y coordinates of the bezier points and control points are specified in two separate float arrays, of equal length.

Method Detail

bezier2fFromPointsVectorsWeights

public static Bezier2f bezier2fFromPointsVectorsWeights(float[][] points2f,
                                                        float[][] vectors2f,
                                                        float[] weights)
Creates a ne Bezier2f object from an array of Vec2f points that are interpolated, an array of Vec2f tangent vectors, and a float array containing weights. The points and vectors array should have equal length, and each individual array element should be an hmi.math.Vec2f element, that is, a float[2] array. The weights array should have length twice the length of the points or vectors array -2. A Vec2f point Pi, Vec2f vector Vi and two consecutive weights w0, w1 determine two control points Ci0 = Pi - w0*Vi, Ci1 = Pi + w1*Vi, wehere we imagine that these ly around point Pi, except for the first point (where C00 is omitted) and the last point (where Cn1 is omitted). This then defines an alternating sequence of points and control points, as usual: P0 C01 C10 P1 C11 C20 P2 C21 .... Cn0 Pn


bezier2fFromPointsVectorsSingleWeights

public static Bezier2f bezier2fFromPointsVectorsSingleWeights(float[][] points2f,
                                                              float[][] vectors2f,
                                                              float[] weights)
Like bezier2fFromPointsVectorsWeights, except that the number of weight must be equal to the number of interpolated points. Each of these weight is used both for the control point before and the control point after each interpolated point. (So the situation is "symmetric" around each interpolated point).


setRange

public void setRange(float low,
                     float high)
Sets the interpolation range for the eval method: for an u value low we are at the first point, for u= high we are at the last point. The default settings are low=0.0f, high = 1.0f


toString

public String toString()
Overrides:
toString in class Object

eval

public float[] eval(float[] result,
                    float u)
Evaluates the Bezier curve and puts the result in a float[2] array result, which is also returned as result value.


evalFX

public float evalFX(float x)
Asssuming that our Bezier curve is a functional relation of the form y = f(x) finds the function value f(x) for the specified x, provided x is within the range [ p[0][0] ; p[n-1].[0] ], where n denotes the number of points, and p[0][0] = x value of point 0, etc.


evalFX

public float evalFX(float x,
                    float low,
                    float high)
Asssuming that our Bezier curve is a functional relation of the form y = f(x) for parameter values u within the interval [low, high], evalFX(x) finds the function value y = f(x) The x coordinates are allowed to be either monotoneously increasing or decreasing over the specified interval.