Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.monte.media
Class BezierInterpolator

    java.lang.Object
      org.monte.media.Interpolator
          org.monte.media.AbstractSplineInterpolator
              org.monte.media.BezierInterpolator

    public class BezierInterpolator

extends AbstractSplineInterpolator

A bezier interpolator for use in conjunction with an Animator object.

This class interpolates fractional values using a Bezier spline. The anchor points for the spline are assumed to be (0, 0) and (1, 1). Control points should all be in the range [0, 1].

FIXME - This interpolator does not work!

Version:
  $Id: BezierInterpolator.java 156 2012-01-28 16:08:21Z werner $
Author:
  Werner Randelshofer

Constructor Summary
`BezierInterpolator(double[][] controlPoints)` Interpolates between the specified control points.
`BezierInterpolator(double[][] controlPoints, boolean reverse, long timespan)` Interpolates between the specified control points.
`BezierInterpolator(float x1, float y1, float x2, float y2)` Creates a new instance of SplineInterpolator with the control points defined by (x1, y1) and (x2, y2).
`BezierInterpolator(float x1, float y1, float x2, float y2, boolean reverse, long timespan)` Creates a new instance of SplineInterpolator with the control points defined by (x1, y1) and (x2, y2).
`BezierInterpolator(float x1, float y1, float x2, float y2, long timespan)` Creates a new instance of SplineInterpolator with the control points defined by (x1, y1) and (x2, y2).

Method Summary
`java.awt.geom.Point2D.Float` | `getXY(float t, java.awt.geom.Point2D.Float xy)` Evaluates the bezier function and returns a 2D point.
`float` | `getY(float t)` Evaluates the bezier function and returns a 2D point.

Methods inherited from class org.monte.media.AbstractSplineInterpolator
`getFraction, update, updateFractions`

Methods inherited from class org.monte.media.Interpolator
`finish, initialize, interpolate, isElapsed, isFinished, isSequential, replaces, setTimespan`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BezierInterpolator

    public BezierInterpolator(float x1,
                              float y1,
                              float x2,
                              float y2)

  Creates a new instance of SplineInterpolator with the control points defined by (x1, y1) and (x2, y2). The anchor points are implicitly defined as (0, 0) and (1, 1).

  The interpolator runs for one second.

  Parameters:
    `x1` - The x coordinate for the first bezier control point.
    `y1` - The y coordinate for the first bezier control point.
    `x2` - The x coordinate for the second bezier control point.
    `y2` - The x coordinate for the second bezier control point.
  Throws:
    `java.lang.IllegalArgumentException` - This exception is thrown when values beyond the allowed [0,1] range are passed in

### BezierInterpolator

    public BezierInterpolator(float x1,
                              float y1,
                              float x2,
                              float y2,
                              long timespan)

  Creates a new instance of SplineInterpolator with the control points defined by (x1, y1) and (x2, y2). The anchor points are implicitly defined as (0, 0) and (1, 1).

  The interpolator runs for the specified time span.

  Parameters:
    `x1` - The x coordinate for the first bezier control point.
    `y1` - The y coordinate for the first bezier control point.
    `x2` - The x coordinate for the second bezier control point.
    `y2` - The x coordinate for the second bezier control point.
    `timespan` - The time span in milliseconds.
  Throws:
    `java.lang.IllegalArgumentException` - This exception is thrown when values beyond the allowed [0,1] range are passed in

### BezierInterpolator

    public BezierInterpolator(float x1,
                              float y1,
                              float x2,
                              float y2,
                              boolean reverse,
                              long timespan)

  Creates a new instance of SplineInterpolator with the control points defined by (x1, y1) and (x2, y2). The anchor points are implicitly defined as (0, 0) and (1, 1).

  The interpolator runs for the specified time span.

  Parameters:
    `x1` - The x coordinate for the first bezier control point.
    `y1` - The y coordinate for the first bezier control point.
    `x2` - The x coordinate for the second bezier control point.
    `y2` - The x coordinate for the second bezier control point.
    `reverse` - Run interpolator in the reverse direction.
    `timespan` - The time span in milliseconds.
  Throws:
    `java.lang.IllegalArgumentException` - This exception is thrown when values beyond the allowed [0,1] range are passed in

### BezierInterpolator

    public BezierInterpolator(double[][] controlPoints)

  Interpolates between the specified control points.

  Parameters:
    `controlPoints` - The control points of the bezier path. Must include the first and the last control point. The curve must be in the range [0,1].

### BezierInterpolator

    public BezierInterpolator(double[][] controlPoints,
                              boolean reverse,
                              long timespan)

  Interpolates between the specified control points.

  Parameters:
    `controlPoints` - The control points of the bezier path. Must include the first and the last control point. The curve must be in the range [0,1].

Method Detail

### getXY

    public java.awt.geom.Point2D.Float getXY(float t,
                                             java.awt.geom.Point2D.Float xy)

  Evaluates the bezier function and returns a 2D point.

  Specified by:
    `getXY` in class `AbstractSplineInterpolator`
  Returns:
    A point, with x- and y-coordinates for time t.

### getY

    public float getY(float t)

  Evaluates the bezier function and returns a 2D point.

  Specified by:
    `getY` in class `AbstractSplineInterpolator`
  Returns:
    A point, with x- and y-coordinates for time t.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD