Package com.kitfox.svg.animation
Class Bezier
- java.lang.Object
-
- com.kitfox.svg.animation.Bezier
-
public class Bezier extends java.lang.Object
http://mathworld.wolfram.com/BezierCurve.html
-
-
Constructor Summary
Constructors Constructor Description Bezier(double sx, double sy, double[] coords, int numCoords)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private double
bernstein(int numKnots, int knotNo, double param)
Calculates the bernstein polynomial for evaluating parametric bezierprivate void
calcLength()
private int
choose(int num, int denom)
java.awt.geom.Point2D.Double
eval(double param, java.awt.geom.Point2D.Double point)
java.awt.geom.Point2D.Double
getFinalPoint(java.awt.geom.Point2D.Double point)
double
getLength()
Retuns aproximation of the length of the bezierprivate double
lineLength(double x1, double y1, double x2, double y2)
void
setCoords(double sx, double sy, double[] coords, int numCoords)
-
-
-
Method Detail
-
setCoords
public void setCoords(double sx, double sy, double[] coords, int numCoords)
-
getLength
public double getLength()
Retuns aproximation of the length of the bezier
-
calcLength
private void calcLength()
-
lineLength
private double lineLength(double x1, double y1, double x2, double y2)
-
getFinalPoint
public java.awt.geom.Point2D.Double getFinalPoint(java.awt.geom.Point2D.Double point)
-
eval
public java.awt.geom.Point2D.Double eval(double param, java.awt.geom.Point2D.Double point)
-
bernstein
private double bernstein(int numKnots, int knotNo, double param)
Calculates the bernstein polynomial for evaluating parametric bezier- Parameters:
numKnots
- - one less than number of knots in this curve hullknotNo
- - knot we are evaluating Bernstein forparam
- - Parametric value we are evaluating at
-
choose
private int choose(int num, int denom)
-
-