public class CatmullRomSpline
extends java.lang.Object
Constructor and Description |
---|
CatmullRomSpline(java.util.List<java.awt.Point> points)
Creates a new spline.
|
CatmullRomSpline(java.util.List<java.awt.Point> points,
int interpolation)
Creates a new spline.
|
CatmullRomSpline(java.awt.Point[] points)
Creates a new spline.
|
CatmullRomSpline(java.awt.Point[] points,
int interpolation)
Creates a new spline.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int x,
int y)
Checks if the given point is onto the curve.
|
boolean |
contains(int x,
int y,
int tolerance)
Checks if the given point is onto the curve.
|
boolean |
contains(java.awt.Point p)
Checks if the given point is onto the curve.
|
boolean |
contains(java.awt.Point p,
int tolerance)
Checks if the given point is onto the curve.
|
java.awt.geom.GeneralPath |
getPath()
Gets the display path of the spline.
|
java.awt.geom.Point2D.Float[] |
getPoints()
Gets all points of the curve.
|
SplineIntersectionPoint |
intersect(CatmullRomSpline spline)
Checks if this spline and the specified one intersect.
|
java.util.List<SplineIntersectionPoint> |
intersectMulti(CatmullRomSpline spline)
Checks whether this spline intersects the specified one multiple times.
|
public CatmullRomSpline(java.util.List<java.awt.Point> points) throws java.lang.IllegalArgumentException
points
- the control points crossed by the curvejava.lang.IllegalArgumentException
- points.size() < 2
public CatmullRomSpline(java.awt.Point[] points) throws java.lang.IllegalArgumentException
points
- the control points crossed by the curvejava.lang.IllegalArgumentException
- points.length < 2
public CatmullRomSpline(java.awt.Point[] points, int interpolation) throws java.lang.IllegalArgumentException
points
- the control points crossed by the curveinterpolation
- the interpolation factor that means the number of intermediate points between two control pointsjava.lang.IllegalArgumentException
- points.length < 2
< 1
public CatmullRomSpline(java.util.List<java.awt.Point> points, int interpolation) throws java.lang.IllegalArgumentException
points
- the control points crossed by the curveinterpolation
- the interpolation factor that means the number of intermediate points between two control pointsjava.lang.IllegalArgumentException
- points.size() < 2
< 1
public java.awt.geom.GeneralPath getPath()
public boolean contains(java.awt.Point p) throws java.lang.IllegalArgumentException
p
- the pointtrue
if the point is onto the spline otherwise false
java.lang.IllegalArgumentException
- public boolean contains(java.awt.Point p, int tolerance) throws java.lang.IllegalArgumentException
p
- the pointtolerance
- the tolerance for the distance check to the curve (example: tolerance = 2, that means the point must not be exactly onto the curve but in a distance of 2 pixel)true
if the point is onto the spline otherwise false
java.lang.IllegalArgumentException
- public boolean contains(int x, int y)
x
- the x position of the pointy
- the y poisition of the pointtrue
if the point is onto the spline otherwise false
public boolean contains(int x, int y, int tolerance)
x
- the x position of the pointy
- the y poisition of the pointtolerance
- the tolerance for the distance check to the curve (example: tolerance = 2, that means the point must not be exactly onto the curve but in a distance of 2 pixel)true
if the point is onto the spline otherwise false
public java.awt.geom.Point2D.Float[] getPoints()
public SplineIntersectionPoint intersect(CatmullRomSpline spline) throws java.lang.IllegalArgumentException
spline
- the spline that should be checked for intersectionnull
if there is no intersectionjava.lang.IllegalArgumentException
- public java.util.List<SplineIntersectionPoint> intersectMulti(CatmullRomSpline spline) throws java.lang.IllegalArgumentException
spline
- the spline that should be checked for intersectionjava.lang.IllegalArgumentException
-