|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.orsay.lri.varna.models.CubicBezierCurve
public class CubicBezierCurve
This class implements a cubic Bezier curve with a constant speed parametrization. The Bezier curve is approximated by a sequence of n straight lines, where the n+1 points between the lines are { B(k/n), k=0,1,...,n } where B is the standard parametrization given here: http://en.wikipedia.org/wiki/Bezier_curve#Cubic_B.C3.A9zier_curves You can then use the constant speed parametrization over this sequence of straight lines.
Field Summary | |
---|---|
private double[] |
lengths
Array of length n. |
private int |
n
|
private Point2D.Double |
P0
The four points defining the curve. |
private Point2D.Double |
P1
The four points defining the curve. |
private Point2D.Double |
P2
The four points defining the curve. |
private Point2D.Double |
P3
The four points defining the curve. |
private Point2D.Double[] |
points
The n+1 points between the n lines. |
private Point2D.Double[] |
unitVectors
Array of length n. |
Constructor Summary | |
---|---|
CubicBezierCurve(Point2D.Double P0,
Point2D.Double P1,
Point2D.Double P2,
Point2D.Double P3,
int n)
A Bezier curve can be defined by four points, see http://en.wikipedia.org/wiki/Bezier_curve#Cubic_B.C3.A9zier_curves Here we give this four points and a integer to say in how many line segments we want to cut the Bezier curve (if n is bigger the computation takes longer but the precision is better). |
Method Summary | |
---|---|
private void |
computeData()
|
double |
getApproxCurveLength()
Get the (exact) length of the approximation curve. |
int |
getN()
The number of lines approximating the Bezier curve. |
Point2D.Double |
getP0()
|
Point2D.Double |
getP1()
|
Point2D.Double |
getP2()
|
Point2D.Double |
getP3()
|
private double |
lineLength(Point2D.Double P1,
Point2D.Double P2)
|
Point2D.Double |
standardParam(double t)
The standard exact cubic Bezier curve parametrization. |
Point2D.Double[] |
uniformParam(double[] t)
Uniform approximated parametrization. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Point2D.Double P0
private Point2D.Double P1
private Point2D.Double P2
private Point2D.Double P3
private int n
private Point2D.Double[] points
private double[] lengths
private Point2D.Double[] unitVectors
Constructor Detail |
---|
public CubicBezierCurve(Point2D.Double P0, Point2D.Double P1, Point2D.Double P2, Point2D.Double P3, int n)
Method Detail |
---|
public int getN()
public double getApproxCurveLength()
public Point2D.Double standardParam(double t)
public Point2D.Double[] uniformParam(double[] t)
private void computeData()
private double lineLength(Point2D.Double P1, Point2D.Double P2)
public Point2D.Double getP0()
public Point2D.Double getP1()
public Point2D.Double getP2()
public Point2D.Double getP3()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |