org.wilmascope.view
Class SplineMethods

java.lang.Object
  extended by org.wilmascope.view.SplineMethods

public class SplineMethods
extends java.lang.Object

Author:
dwyer Methods for drawing spline curves

Constructor Summary
SplineMethods()
           
 
Method Summary
static java.awt.geom.Point2D.Float evalBezier(java.awt.geom.Point2D.Float[] arr, float t)
          evaluates a bezier defined by the control polygon which points are given in the array at the value t returns the point on the curve (which is also returned in the first point in the input array, the line from that point to the second point in the array gives a tangent vector)
static java.awt.geom.Point2D.Float interpolate(java.awt.geom.Point2D.Float p0, java.awt.geom.Point2D.Float p1, float t)
          This method and the next together implement The de-Casteljau Algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SplineMethods

public SplineMethods()
Method Detail

interpolate

public static java.awt.geom.Point2D.Float interpolate(java.awt.geom.Point2D.Float p0,
                                                      java.awt.geom.Point2D.Float p1,
                                                      float t)
This method and the next together implement The de-Casteljau Algorithm. I've modelled them on the example code at: this site Thanks!

Returns:
the linear interpolation of two points

evalBezier

public static java.awt.geom.Point2D.Float evalBezier(java.awt.geom.Point2D.Float[] arr,
                                                     float t)
evaluates a bezier defined by the control polygon which points are given in the array at the value t returns the point on the curve (which is also returned in the first point in the input array, the line from that point to the second point in the array gives a tangent vector)