org.graphstream.ui.swingViewer.util
Class CubicCurve

java.lang.Object
  extended by org.graphstream.ui.swingViewer.util.CubicCurve

public class CubicCurve
extends Object

Utility methods to deal with cubic Bézier curves.


Constructor Summary
CubicCurve()
           
 
Method Summary
static double derivative(double x0, double x1, double x2, double x3, double t)
          Derivative of a cubic Bézier curve according to control points `x0`, `x1`, `x2` and `x3` at parametric position `t` of the curve.
static Point2 derivative(Point2 p0, Point2 p1, Point2 p2, Point3 p3, double t)
          Derivative point of a cubic Bézier curve according to control points `x0`, `x1`, `x2` and `x3` at parametric position `t` of the curve.
static Point2 derivative(Point2 p0, Point2 p1, Point2 p2, Point3 p3, double t, Point2 result)
          Store in `result` the derivative point of a cubic Bézier curve according to control points `x0`, `x1`, `x2` and `x3` at parametric position `t` of the curve.
static double eval(double x0, double x1, double x2, double x3, double t)
          Evaluate a cubic Bézier curve according to control points `x0`, `x1`, `x2` and `x3` and return the position at parametric position `t` of the curve.
static Point2D.Double eval(Point2D.Double p0, Point2D.Double p1, Point2D.Double p2, Point2D.Double p3, double t)
          Evaluate a cubic Bézier curve according to control points `p0`, `p1`, `p2` and `p3` and return the position at parametric position `t` of the curve.
static Point2 eval(Point2 p0, Point2 p1, Point2 p2, Point2 p3, double t)
          Evaluate a cubic Bézier curve according to control points `p0`, `p1`, `p2` and `p3` and return the position at parametric position `t` of the curve.
static Point2 eval(Point2 p0, Point2 p1, Point2 p2, Point2 p3, double t, Point2 result)
          Evaluate a cubic Bézier curve according to control points `p0`, `p1`, `p2` and `p3` and store the position at parametric position `t` of the curve in `result`.
static Point2D.Double perpendicular(Point2D.Double p0, Point2D.Double p1, Point2D.Double p2, Point2D.Double p3, double t)
          The perpendicular vector to the curve defined by control points `p0`, `p1`, `p2` and `p3` at parametric position `t`.
static Vector2 perpendicular(Point2 p0, Point2 p1, Point2 p2, Point2 p3, double t)
          The perpendicular vector to the curve defined by control points `p0`, `p1`, `p2` and `p3` at parametric position `t`.
static Vector2 perpendicular(Point2 p0, Point2 p1, Point2 p2, Point2 p3, double t, Vector2 result)
          Store in `result` the perpendicular vector to the curve defined by control points `p0`, `p1`, `p2` and `p3` at parametric position `t`.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CubicCurve

public CubicCurve()
Method Detail

eval

public static double eval(double x0,
                          double x1,
                          double x2,
                          double x3,
                          double t)
Evaluate a cubic Bézier curve according to control points `x0`, `x1`, `x2` and `x3` and return the position at parametric position `t` of the curve.

Returns:
The coordinate at parametric position `t` on the curve.

eval

public static Point2 eval(Point2 p0,
                          Point2 p1,
                          Point2 p2,
                          Point2 p3,
                          double t)
Evaluate a cubic Bézier curve according to control points `p0`, `p1`, `p2` and `p3` and return the position at parametric position `t` of the curve.

Returns:
The point at parametric position `t` on the curve.

eval

public static Point2D.Double eval(Point2D.Double p0,
                                  Point2D.Double p1,
                                  Point2D.Double p2,
                                  Point2D.Double p3,
                                  double t)
Evaluate a cubic Bézier curve according to control points `p0`, `p1`, `p2` and `p3` and return the position at parametric position `t` of the curve.

Returns:
The point at parametric position `t` on the curve.

eval

public static Point2 eval(Point2 p0,
                          Point2 p1,
                          Point2 p2,
                          Point2 p3,
                          double t,
                          Point2 result)
Evaluate a cubic Bézier curve according to control points `p0`, `p1`, `p2` and `p3` and store the position at parametric position `t` of the curve in `result`.

Returns:
the given reference to `result`.

derivative

public static double derivative(double x0,
                                double x1,
                                double x2,
                                double x3,
                                double t)
Derivative of a cubic Bézier curve according to control points `x0`, `x1`, `x2` and `x3` at parametric position `t` of the curve.

Returns:
The derivative at parametric position `t` on the curve.

derivative

public static Point2 derivative(Point2 p0,
                                Point2 p1,
                                Point2 p2,
                                Point3 p3,
                                double t)
Derivative point of a cubic Bézier curve according to control points `x0`, `x1`, `x2` and `x3` at parametric position `t` of the curve.

Returns:
The derivative point at parametric position `t` on the curve.

derivative

public static Point2 derivative(Point2 p0,
                                Point2 p1,
                                Point2 p2,
                                Point3 p3,
                                double t,
                                Point2 result)
Store in `result` the derivative point of a cubic Bézier curve according to control points `x0`, `x1`, `x2` and `x3` at parametric position `t` of the curve.

Returns:
the given reference to `result`.

perpendicular

public static Vector2 perpendicular(Point2 p0,
                                    Point2 p1,
                                    Point2 p2,
                                    Point2 p3,
                                    double t)
The perpendicular vector to the curve defined by control points `p0`, `p1`, `p2` and `p3` at parametric position `t`.

Returns:
A vector perpendicular to the curve at position `t`.

perpendicular

public static Vector2 perpendicular(Point2 p0,
                                    Point2 p1,
                                    Point2 p2,
                                    Point2 p3,
                                    double t,
                                    Vector2 result)
Store in `result` the perpendicular vector to the curve defined by control points `p0`, `p1`, `p2` and `p3` at parametric position `t`.

Returns:
the given reference to `result`.

perpendicular

public static Point2D.Double perpendicular(Point2D.Double p0,
                                           Point2D.Double p1,
                                           Point2D.Double p2,
                                           Point2D.Double p3,
                                           double t)
The perpendicular vector to the curve defined by control points `p0`, `p1`, `p2` and `p3` at parametric position `t`.

Returns:
A vector perpendicular to the curve at position `t`.


Copyright © 2013. All Rights Reserved.