|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object math.geom2d.curve.CurveArray2D<T>
public class CurveArray2D<T extends Curve2D>
A parameterized set of curves. A curve cannot be included twice in a CurveArray2D.
The k-th curve contains points with positions between 2*k and 2*k+1. This allows to differentiate extremities of contiguous curves. The points with positions t between 2*k+1 and 2*k+2 belong to the curve k if t<2*k+1.5, or to the curve k+1 if t>2*k+1.5
Field Summary |
---|
Fields inherited from interface math.geom2d.Shape2D |
---|
ACCURACY |
Constructor Summary | |
---|---|
CurveArray2D()
Empty constructor. |
|
CurveArray2D(java.util.Collection<? extends T> curves)
Constructor from a collection of curves. |
|
CurveArray2D(int n)
Empty constructor. |
|
CurveArray2D(T... curves)
Constructor from an array of curves. |
Method Summary | ||
---|---|---|
void |
add(int index,
T curve)
Inserts the specified shape at the specified position in this set (optional operation). |
|
boolean |
add(T curve)
Adds the curve to the curve set, if it does not already belongs to the set. |
|
boolean |
almostEquals(GeometricObject2D obj,
double eps)
Checks if the two objects are similar up to a given threshold value. |
|
java.awt.Shape |
asAwtShape()
|
|
Box2D |
boundingBox()
Returns bounding box for the CurveArray2D. |
|
T |
childCurve(double t)
Returns the child curve corresponding to a given position. |
|
void |
clear()
Clears the inner curve collection. |
|
CurveSet2D<? extends Curve2D> |
clip(Box2D box)
Clips a curve, and return a CurveArray2D. |
|
CurveArray2D<? extends Curve2D> |
clone()
Overrides Object declaration to ensure Curve2D implementation are cloned as Curve2D. |
|
boolean |
contains(double x,
double y)
Returns true if one of the curves contains the point |
|
boolean |
contains(Point2D p)
Returns true if one of the curves contains the point |
|
boolean |
contains(T curve)
Checks if the curve set contains the given curve. |
|
java.util.Collection<? extends ContinuousCurve2D> |
continuousCurves()
Returns the collection of continuous curves which constitute this curve. |
|
static
|
create(java.util.Collection<T> curves)
Static factory for creating a new CurveArray2D from a collection of curves. |
|
static
|
create(T... curves)
Static factory for creating a new CurveArray2D from an array of curves. |
|
int |
curveIndex(double t)
Returns the index of the curve corresponding to a given position. |
|
java.util.Collection<T> |
curves()
Returns the collection of curves |
|
double |
distance(double x,
double y)
Returns the distance of the shape to the given point, specified by x and y, or the distance of point to the frontier of the shape in the case of a plain (i.e. fillable) shape. |
|
double |
distance(Point2D p)
Returns the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape. |
|
void |
draw(java.awt.Graphics2D g2)
Draws the curve on the given Graphics2D object. |
|
boolean |
equals(java.lang.Object obj)
Returns true if obj is a CurveArray2D with the same number of curves, and such that each curve belongs to both objects. |
|
T |
firstCurve()
Returns the first curve of the collection if it exists, null otherwise. |
|
Point2D |
firstPoint()
Returns the first point of the curve. |
|
T |
get(int index)
Returns the inner curve corresponding to the given index. |
|
java.awt.geom.GeneralPath |
getGeneralPath()
|
|
double |
getT0()
Deprecated. replaced by t0() (since 0.11.1). |
|
double |
getT1()
Deprecated. replaced by t1() (since 0.11.1). |
|
double |
globalPosition(int i,
double t)
Converts a position on a curve (between t0 and t1 of the curve) to the position on the curve set (between 0 and 2*Nc-1). |
|
int |
indexOf(T curve)
Returns index of the given curve within the inner array. |
|
java.util.Collection<Point2D> |
intersections(LinearShape2D line)
Returns the intersection points of the curve with the specified line. |
|
boolean |
isBounded()
return true, if all curve pieces are bounded |
|
boolean |
isEmpty()
Returns true if the CurveSet does not contain any curve. |
|
boolean |
isSingular(double pos)
Checks if a point is singular. |
|
java.util.Iterator<T> |
iterator()
|
|
T |
lastCurve()
Returns the last curve of the collection if it exists, null otherwise. |
|
Point2D |
lastPoint()
Returns the last point of the curve. |
|
double |
localPosition(double t)
Converts the position on the curve set, which is comprised between 0 and 2*Nc-1 with Nc being the number of curves, to the position on the curve which contains the position. |
|
Point2D |
point(double t)
Returns the point located at the given position on the curve. |
|
double |
position(Point2D point)
Computes the position of the point on the curve. |
|
double |
project(Point2D point)
Returns the position of the closest orthogonal projection of the point on the curve, or of the closest singular point. |
|
T |
remove(int index)
Removes the shape at the specified position in this set (optional operation). |
|
boolean |
remove(T curve)
Removes the specified curve from the curve set. |
|
Curve2D |
reverse()
Returns the curve with same trace on the plane with parameterization in reverse order. |
|
java.util.Collection<Point2D> |
singularPoints()
Computes the set of singular points as the set of singular points of each curve, plus the extremities of each curve. |
|
int |
size()
Returns the number of curves in the collection |
|
CurveSet2D<? extends Curve2D> |
subCurve(double t0,
double t1)
Return an instance of CurveArray2D. |
|
double |
t0()
Returns 0. |
|
double |
t1()
Get value of parameter t for the last point of the curve. |
|
CurveArray2D<? extends Curve2D> |
transform(AffineTransform2D trans)
Transforms each curve, and build a new CurveArray2D with the set of transformed curves. |
|
java.util.Collection<Point2D> |
vertices()
Implementation of getVertices() for curve returns the same result as the method getSingularPoints(). |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CurveArray2D()
public CurveArray2D(int n)
public CurveArray2D(T... curves)
curves
- the array of curves in the setpublic CurveArray2D(java.util.Collection<? extends T> curves)
curves
- the collection of curves to add to the setMethod Detail |
---|
public static <T extends Curve2D> CurveArray2D<T> create(java.util.Collection<T> curves)
public static <T extends Curve2D> CurveArray2D<T> create(T... curves)
public double localPosition(double t)
localPosition
in interface CurveSet2D<T extends Curve2D>
t
- the position on the curve set
globalPosition(int, double)
,
curveIndex(double)
public double globalPosition(int i, double t)
globalPosition
in interface CurveSet2D<T extends Curve2D>
i
- the index of the curve to considert
- the position on the curve
localPosition(double)
,
curveIndex(double)
public int curveIndex(double t)
curveIndex
in interface CurveSet2D<T extends Curve2D>
t
- the position on the set of curves, between 0 and twice the
number of curves minus 1
public boolean add(T curve)
add
in interface ShapeSet2D<T extends Curve2D>
curve
- the curve to addpublic void add(int index, T curve)
ShapeSet2D
add
in interface ShapeSet2D<T extends Curve2D>
public boolean remove(T curve)
remove
in interface ShapeSet2D<T extends Curve2D>
curve
- the curve to removepublic T remove(int index)
ShapeSet2D
remove
in interface ShapeSet2D<T extends Curve2D>
public boolean contains(T curve)
contains
in interface CurveSet2D<T extends Curve2D>
contains
in interface ShapeSet2D<T extends Curve2D>
public int indexOf(T curve)
indexOf
in interface ShapeSet2D<T extends Curve2D>
public void clear()
clear
in interface ShapeSet2D<T extends Curve2D>
public java.util.Collection<T> curves()
curves
in interface CurveSet2D<T extends Curve2D>
public T get(int index)
get
in interface CurveSet2D<T extends Curve2D>
get
in interface ShapeSet2D<T extends Curve2D>
index
- index of the curve
public T childCurve(double t)
childCurve
in interface CurveSet2D<T extends Curve2D>
t
- the position on the set of curves, between 0 and twice the
number of curves
public T firstCurve()
firstCurve
in interface CurveSet2D<T extends Curve2D>
public T lastCurve()
lastCurve
in interface CurveSet2D<T extends Curve2D>
public int size()
size
in interface ShapeSet2D<T extends Curve2D>
public boolean isEmpty()
isEmpty
in interface Shape2D
public java.util.Collection<Point2D> intersections(LinearShape2D line)
Curve2D
intersections
in interface Curve2D
public double t0()
t0
in interface Curve2D
@Deprecated public double getT0()
getT0
in interface Curve2D
public double t1()
Curve2D
t1
in interface Curve2D
@Deprecated public double getT1()
getT1
in interface Curve2D
public Point2D point(double t)
Curve2D
point
in interface Curve2D
public Point2D firstPoint()
firstPoint
in interface Curve2D
Curve2D.t0()
,
Curve2D.point(double)
public Point2D lastPoint()
lastPoint
in interface Curve2D
Curve2D.t1()
,
Curve2D.point(double)
public java.util.Collection<Point2D> singularPoints()
singularPoints
in interface Curve2D
vertices()
public java.util.Collection<Point2D> vertices()
vertices
in interface Curve2D
singularPoints()
public boolean isSingular(double pos)
Curve2D
isSingular
in interface Curve2D
pos
- the position of the point on the curve
public double position(Point2D point)
Curve2D
point(double)
method.
position
in interface Curve2D
point
- a point belonging to the curve
Curve2D.point(double)
public double project(Point2D point)
Curve2D
project
in interface Curve2D
point
- a point to project
public Curve2D reverse()
Curve2D
reverse
in interface Curve2D
public CurveSet2D<? extends Curve2D> subCurve(double t0, double t1)
subCurve
in interface Curve2D
t0
- position of the start of the sub-curvet1
- position of the end of the sub-curve
public double distance(Point2D p)
Shape2D
distance
in interface Shape2D
public double distance(double x, double y)
Shape2D
distance
in interface Shape2D
public boolean isBounded()
isBounded
in interface Shape2D
public CurveSet2D<? extends Curve2D> clip(Box2D box)
clip
in interface Curve2D
clip
in interface Shape2D
box
- the clipping box
public Box2D boundingBox()
boundingBox
in interface Shape2D
public CurveArray2D<? extends Curve2D> transform(AffineTransform2D trans)
transform
in interface Curve2D
transform
in interface CurveSet2D<T extends Curve2D>
transform
in interface Shape2D
trans
- an affine transform
public java.util.Collection<? extends ContinuousCurve2D> continuousCurves()
Curve2D
continuousCurves
in interface Curve2D
public boolean contains(Point2D p)
contains
in interface Shape2D
public boolean contains(double x, double y)
contains
in interface Shape2D
public java.awt.geom.GeneralPath getGeneralPath()
public java.awt.Shape asAwtShape()
asAwtShape
in interface Curve2D
public void draw(java.awt.Graphics2D g2)
Curve2D
draw
in interface Curve2D
draw
in interface Shape2D
g2
- the graphics to draw the curve inpublic boolean almostEquals(GeometricObject2D obj, double eps)
GeometricObject2D
almostEquals
in interface GeometricObject2D
obj
- the object to compareeps
- a threshold value, for example the minimal coordinate difference
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public CurveArray2D<? extends Curve2D> clone()
Curve2D
clone
in interface Curve2D
clone
in class java.lang.Object
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T extends Curve2D>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |