|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object math.geom2d.curve.CurveArray2D<T> math.geom2d.curve.PolyCurve2D<T>
public class PolyCurve2D<T extends ContinuousCurve2D>
A PolyCurve2D is a set of piecewise smooth curve arcs, such that the end of a curve is the beginning of the next curve, and such that they do not intersect nor self-intersect.
Field Summary |
---|
Fields inherited from interface math.geom2d.Shape2D |
---|
ACCURACY |
Constructor Summary | |
---|---|
PolyCurve2D()
Empty constructor. |
|
PolyCurve2D(java.util.Collection<? extends T> curves)
Creates a new PolyCurve2D from the specified collection of curves. |
|
PolyCurve2D(java.util.Collection<? extends T> curves,
boolean closed)
Creates a new PolyCurve2D from the specified collection of curves. |
|
PolyCurve2D(int n)
Constructor that reserves space for the specified number of inner curves. |
|
PolyCurve2D(T... curves)
Creates a new PolyCurve2D from the specified list of curves. |
|
PolyCurve2D(T[] curves,
boolean closed)
Creates a new closed PolyCurve2D from the specified list of curves. |
Method Summary | ||
---|---|---|
java.awt.geom.GeneralPath |
appendPath(java.awt.geom.GeneralPath path)
Append the path of the curve to the given path. |
|
Polyline2D |
asPolyline(int n)
Converts this PolyCurve2D into a polyline with the given number of edges. |
|
CurveSet2D<? extends ContinuousCurve2D> |
clip(Box2D box)
Clip the PolyCurve2D by a box. |
|
java.util.Collection<? extends PolyCurve2D<?>> |
continuousCurves()
Returns a collection of PolyCurve2D that contains only this instance. |
|
static
|
create(java.util.Collection<T> curves)
Static factory for creating a new PolyCurve2D from a collection of curves. |
|
static
|
create(java.util.Collection<T> curves,
boolean closed)
Static factory for creating a new PolyCurve2D from a collection of curves and a flag indicating if the curve is closed or not. |
|
static
|
create(T... curves)
Static factory for creating a new PolyCurve2D from an array of curves. |
|
static
|
create(T[] curves,
boolean closed)
Static factory for creating a new PolyCurve2D from an array of curves and a flag indicating if the curve is closed or not. |
|
static
|
createClosed(T... curves)
Static factory for creating a new closed PolyCurve2D from an array of curves. |
|
double |
curvature(double t)
Computes the curvature at the given position. |
|
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. |
|
java.awt.geom.GeneralPath |
getGeneralPath()
|
|
boolean |
isClosed()
Returns true if the PolyCurve2D is closed. |
|
Vector2D |
leftTangent(double t)
Computes the left tangent at the given position. |
|
PolyCurve2D<? extends ContinuousCurve2D> |
reverse()
Returns the reverse curve of this PolyCurve2D. |
|
Vector2D |
rightTangent(double t)
Computes the right tangent at the given position. |
|
void |
setClosed(boolean b)
Toggle the 'closed' flag of this polycurve. |
|
java.util.Collection<? extends SmoothCurve2D> |
smoothPieces()
Returns a collection containing only instances of SmoothCurve2D. |
|
PolyCurve2D<? extends ContinuousCurve2D> |
subCurve(double t0,
double t1)
Returns an instance of PolyCurve2D. |
|
PolyCurve2D<? extends ContinuousCurve2D> |
transform(AffineTransform2D trans)
Transforms each smooth piece in this PolyCurve2D and returns a new instance of PolyCurve2D. |
Methods inherited from class math.geom2d.curve.CurveArray2D |
---|
add, add, almostEquals, asAwtShape, boundingBox, childCurve, clear, clone, contains, contains, contains, curveIndex, curves, distance, distance, firstCurve, firstPoint, get, getT0, getT1, globalPosition, indexOf, intersections, isBounded, isEmpty, isSingular, iterator, lastCurve, lastPoint, localPosition, point, position, project, remove, remove, singularPoints, size, t0, t1, vertices |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface math.geom2d.curve.Curve2D |
---|
asAwtShape, clone, firstPoint, getT0, getT1, intersections, isSingular, lastPoint, point, position, project, singularPoints, t0, t1, vertices |
Methods inherited from interface math.geom2d.Shape2D |
---|
boundingBox, contains, contains, distance, distance, isBounded, isEmpty |
Methods inherited from interface math.geom2d.GeometricObject2D |
---|
almostEquals |
Constructor Detail |
---|
public PolyCurve2D()
public PolyCurve2D(int n)
public PolyCurve2D(T... curves)
curves
- the curves that constitutes this PolyCurve2Dpublic PolyCurve2D(T[] curves, boolean closed)
curves
- the curves that constitutes this PolyCurve2Dpublic PolyCurve2D(java.util.Collection<? extends T> curves)
curves
- the curves that constitutes this PolyCurve2Dpublic PolyCurve2D(java.util.Collection<? extends T> curves, boolean closed)
curves
- the curves that constitutes this PolyCurve2DMethod Detail |
---|
public static <T extends ContinuousCurve2D> PolyCurve2D<T> create(java.util.Collection<T> curves)
public static <T extends ContinuousCurve2D> PolyCurve2D<T> create(T... curves)
public static <T extends ContinuousCurve2D> PolyCurve2D<T> createClosed(T... curves)
public static <T extends ContinuousCurve2D> PolyCurve2D<T> create(java.util.Collection<T> curves, boolean closed)
public static <T extends ContinuousCurve2D> PolyCurve2D<T> create(T[] curves, boolean closed)
public void setClosed(boolean b)
public Vector2D leftTangent(double t)
ContinuousCurve2D
t
, the result is the
same as the tangent computed for the corresponding smooth curve, and
is equal to the result of rightTangent(double).
If the position t
corresponds to a singular point, the
tangent of the smooth portion before t
is computed.
leftTangent
in interface ContinuousCurve2D
t
- the position on the curve
public Vector2D rightTangent(double t)
ContinuousCurve2D
t
, the result is the
same as the tangent computed for the corresponding smooth curve, and
is equal to the result of leftTangent(double).
If the position t
corresponds to a singular point, the
tangent of the smooth portion after t
is computed.
rightTangent
in interface ContinuousCurve2D
t
- the position on the curve
public double curvature(double t)
ContinuousCurve2D
t
that correspond to smooth parts, and is
infinite for singular points.
curvature
in interface ContinuousCurve2D
t
- the position on the curve
public boolean isClosed()
isClosed
in interface ContinuousCurve2D
public Polyline2D asPolyline(int n)
asPolyline
in interface ContinuousCurve2D
n
- the number of edges of the result polyline
n
line segments.Polyline2D
public java.util.Collection<? extends SmoothCurve2D> smoothPieces()
smoothPieces
in interface ContinuousCurve2D
public java.util.Collection<? extends PolyCurve2D<?>> continuousCurves()
continuousCurves
in interface Curve2D
continuousCurves
in class CurveArray2D<T extends ContinuousCurve2D>
public PolyCurve2D<? extends ContinuousCurve2D> reverse()
reverse
in interface ContinuousCurve2D
reverse
in interface Curve2D
reverse
in class CurveArray2D<T extends ContinuousCurve2D>
public PolyCurve2D<? extends ContinuousCurve2D> subCurve(double t0, double t1)
subCurve
in interface ContinuousCurve2D
subCurve
in interface Curve2D
subCurve
in class CurveArray2D<T extends ContinuousCurve2D>
t0
- position of the start of the sub-curvet1
- position of the end of the sub-curve
public CurveSet2D<? extends ContinuousCurve2D> clip(Box2D box)
clip
in interface ContinuousCurve2D
clip
in interface Curve2D
clip
in interface Shape2D
clip
in class CurveArray2D<T extends ContinuousCurve2D>
box
- the clipping box
public PolyCurve2D<? extends ContinuousCurve2D> transform(AffineTransform2D trans)
transform
in interface ContinuousCurve2D
transform
in interface Curve2D
transform
in interface CurveSet2D<T extends ContinuousCurve2D>
transform
in interface Shape2D
transform
in class CurveArray2D<T extends ContinuousCurve2D>
trans
- an affine transform
public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
ContinuousCurve2D
appendPath
in interface ContinuousCurve2D
path
- a path to modify
public java.awt.geom.GeneralPath getGeneralPath()
getGeneralPath
in class CurveArray2D<T extends ContinuousCurve2D>
public void draw(java.awt.Graphics2D g2)
Curve2D
draw
in interface Curve2D
draw
in interface Shape2D
draw
in class CurveArray2D<T extends ContinuousCurve2D>
g2
- the graphics to draw the curve inpublic boolean equals(java.lang.Object obj)
CurveArray2D
equals
in class CurveArray2D<T extends ContinuousCurve2D>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |