hmi.math
Class Bezier1f

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

public class Bezier1f
extends Object


Field Summary
private static float EPS
           
private  float high
           
private  org.slf4j.Logger logger
           
private  float low
           
private  int np
           
private  int nseg
           
private  float[] p
          A Bezier curve is specified by 3n+1 points, alternatiing interpolated points P and (non-interpolated) control points C, like: P C C P C C P C C P Internally we complement this by an extra conrol point at the begin and the end of this seqiuence: C P C C P C C P C C P C in order to facilitate concatenation of Bezier curves.
 
Constructor Summary
Bezier1f(float[] points)
          Create a new Bezier1f curve, by specyfying interpolated values and control points in a single array.
Bezier1f(float[] points, int offset, int stride)
          Create a new Bezier1f curve, by specyfying interpolated values and control points in a single array, where the first value is found at points[offset], and where values are separated by a distance equal to stride.
 
Method Summary
 float eval(float u)
          Evaluates the Bezier curve for parameter value u
protected  float eval4(int i, float b0, float b1, float b2, float b3)
           
 float evalInverse(float x)
          Asssuming that our Bezier curve is an invertible function x = f(u) evalInverse returns u = f^{-1}(x)
 void setRange(float ulow, float uhigh)
          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

logger

private org.slf4j.Logger logger

p

private float[] p
A Bezier curve is specified by 3n+1 points, alternatiing interpolated points P and (non-interpolated) control points C, like: P C C P C C P C C P Internally we complement this by an extra conrol point at the begin and the end of this seqiuence: C P C C P C C P C C P C in order to facilitate concatenation of Bezier curves. (In that case, we need two control points between the end point from the first, and the start point of the second curve.) * points (px[i], py[i]), for i=0, ... , n-1 control points (cx[j], cy[j]), for j = 0, ..., 2n-1


np

private int np

nseg

private int nseg

low

private float low

high

private float high

EPS

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

Bezier1f

public Bezier1f(float[] points)
Create a new Bezier1f curve, by specyfying interpolated values and control points in a single array. The interpolated points P and control points C alternate like the following pattern: P C C P C C P .... P C C P


Bezier1f

public Bezier1f(float[] points,
                int offset,
                int stride)
Create a new Bezier1f curve, by specyfying interpolated values and control points in a single array, where the first value is found at points[offset], and where values are separated by a distance equal to stride. (When values are tightly packed, i.e. without gaps, set offset == 0 and stride == 1) The interpolated points P and control points C alternate like the following pattern: P C C P C C P .... P C C P

Method Detail

setRange

public void setRange(float ulow,
                     float uhigh)
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 u)
Evaluates the Bezier curve for parameter value u


eval4

protected float eval4(int i,
                      float b0,
                      float b1,
                      float b2,
                      float b3)

evalInverse

public float evalInverse(float x)
Asssuming that our Bezier curve is an invertible function x = f(u) evalInverse returns u = f^{-1}(x)