math.geom2d.circulinear
Class CirculinearCurveArray2D<T extends CirculinearCurve2D>

java.lang.Object
  extended by math.geom2d.curve.CurveArray2D<T>
      extended by math.geom2d.circulinear.CirculinearCurveArray2D<T>
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<T>, CirculinearCurve2D, CirculinearCurveSet2D<T>, CirculinearShape2D, Curve2D, CurveSet2D<T>, GeometricObject2D, Shape2D, ShapeSet2D<T>

public class CirculinearCurveArray2D<T extends CirculinearCurve2D>
extends CurveArray2D<T>
implements CirculinearCurveSet2D<T>

A specialization of CurveArray2D that accepts only instances of CirculinearCurve2D.

 // create two orthogonal lines
 StraightLine2D line1 = new StraightLine2D(origin, v1);
 StraightLine2D line2 = new StraightLine2D(origin, v2);
	
 // put lines in a set
 CirculinearCurveSet2D<StraightLine2D> set = 
     CirculinearCurveArray2D.create(line1, line2);
 
 

Author:
dlegland

Field Summary
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY
 
Constructor Summary
CirculinearCurveArray2D()
          Empty constructor.
CirculinearCurveArray2D(java.util.Collection<? extends T> curves)
          Constructor from a collection of curves.
CirculinearCurveArray2D(int n)
          Empty constructor.
CirculinearCurveArray2D(T... curves)
          Constructor from an array of curves.
 
Method Summary
 CirculinearDomain2D buffer(double dist)
          Computes the buffer of the shape, formed by the set of points located at a distance from the shape that is lower or equal to d.
 CirculinearCurveArray2D<? extends CirculinearCurve2D> clip(Box2D box)
          Clips a curve, and return a CurveArray2D.
 java.util.Collection<? extends CirculinearContinuousCurve2D> continuousCurves()
          Returns the collection of continuous curves which constitute this curve.
static
<T extends CirculinearCurve2D>
CirculinearCurveArray2D<T>
create(java.util.Collection<T> curves)
          Static factory for creating a new CirculinearCurveArray2D from a collection of curves.
static
<T extends CirculinearCurve2D>
CirculinearCurveArray2D<T>
create(T... curves)
          Static factory for creating a new CirculinearCurveArray2D from an array of curves.
 double length()
           
 double length(double pos)
           
 CirculinearCurve2D parallel(double d)
          Creates a new curve, formed by the points with parameterization: p(t) = c(t) + d*n(t)/|n(t)|, with p(t) being a point of the original curve, n(t) the normal of the curve, and |n| being the norm of n.
 double position(double length)
           
 CirculinearCurveArray2D<? extends CirculinearCurve2D> reverse()
          Returns the curve with same trace on the plane with parameterization in reverse order.
 CirculinearCurveArray2D<? extends CirculinearCurve2D> subCurve(double t0, double t1)
          Return an instance of CurveArray2D.
 CirculinearCurveArray2D<CirculinearCurve2D> transform(CircleInversion2D inv)
          Transforms the shape by a circle inversion.
 
Methods inherited from class math.geom2d.curve.CurveArray2D
add, add, almostEquals, asAwtShape, boundingBox, childCurve, clear, clone, contains, contains, contains, curveIndex, curves, distance, distance, draw, equals, firstCurve, firstPoint, get, getGeneralPath, getT0, getT1, globalPosition, indexOf, intersections, isBounded, isEmpty, isSingular, iterator, lastCurve, lastPoint, localPosition, point, position, project, remove, remove, singularPoints, size, t0, t1, transform, vertices
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface math.geom2d.curve.CurveSet2D
childCurve, contains, curveIndex, curves, firstCurve, get, globalPosition, lastCurve, localPosition, transform
 
Methods inherited from interface math.geom2d.ShapeSet2D
add, add, clear, indexOf, remove, remove, size
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface math.geom2d.curve.Curve2D
asAwtShape, clone, draw, 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

CirculinearCurveArray2D

public CirculinearCurveArray2D()
Empty constructor. Initializes an empty array of curves.


CirculinearCurveArray2D

public CirculinearCurveArray2D(int n)
Empty constructor. Initializes an empty array of curves, with a given size for allocating memory.


CirculinearCurveArray2D

public CirculinearCurveArray2D(T... curves)
Constructor from an array of curves.

Parameters:
curves - the array of curves in the set

CirculinearCurveArray2D

public CirculinearCurveArray2D(java.util.Collection<? extends T> curves)
Constructor from a collection of curves. The curves are added to the inner collection of curves.

Parameters:
curves - the collection of curves to add to the set
Method Detail

create

public static <T extends CirculinearCurve2D> CirculinearCurveArray2D<T> create(java.util.Collection<T> curves)
Static factory for creating a new CirculinearCurveArray2D from a collection of curves.

Since:
0.8.1

create

public static <T extends CirculinearCurve2D> CirculinearCurveArray2D<T> create(T... curves)
Static factory for creating a new CirculinearCurveArray2D from an array of curves.

Since:
0.8.1

length

public double length()
Specified by:
length in interface CirculinearCurve2D
Returns:
the length of the curve

length

public double length(double pos)
Specified by:
length in interface CirculinearCurve2D
Returns:
the length from the beginning to the position given by pos

position

public double position(double length)
Specified by:
position in interface CirculinearCurve2D
Returns:
the position located at a given geodesic distance from the origin

buffer

public CirculinearDomain2D buffer(double dist)
Description copied from interface: CirculinearShape2D
Computes the buffer of the shape, formed by the set of points located at a distance from the shape that is lower or equal to d.

Specified by:
buffer in interface CirculinearShape2D
Parameters:
dist - the maximal distance between a point of the buffer and the shape
Returns:
the buffer of the shape

parallel

public CirculinearCurve2D parallel(double d)
Description copied from interface: CirculinearCurve2D
Creates a new curve, formed by the points with parameterization: p(t) = c(t) + d*n(t)/|n(t)|, with p(t) being a point of the original curve, n(t) the normal of the curve, and |n| being the norm of n.
In the case of a continuous curve formed by several smooth circulinear elements, the parallels of contiguous elements are joined by a circle arc.

Specified by:
parallel in interface CirculinearCurve2D
Parameters:
d - the distance between the original curve and he parallel curve.
Returns:
the parallel curve

transform

public CirculinearCurveArray2D<CirculinearCurve2D> transform(CircleInversion2D inv)
Description copied from interface: CirculinearShape2D
Transforms the shape by a circle inversion. The result is still an instance a CirculinearShape2D.

Specified by:
transform in interface CirculinearCurve2D
Specified by:
transform in interface CirculinearShape2D
Parameters:
inv - the circle inversion
Returns:
the transformed shape

continuousCurves

public java.util.Collection<? extends CirculinearContinuousCurve2D> continuousCurves()
Description copied from interface: Curve2D
Returns the collection of continuous curves which constitute this curve.

Specified by:
continuousCurves in interface CirculinearCurve2D
Specified by:
continuousCurves in interface Curve2D
Overrides:
continuousCurves in class CurveArray2D<T extends CirculinearCurve2D>
Returns:
a collection of continuous curves.

clip

public CirculinearCurveArray2D<? extends CirculinearCurve2D> clip(Box2D box)
Description copied from class: CurveArray2D
Clips a curve, and return a CurveArray2D. If the curve is totally outside the box, return a CurveArray2D with 0 curves inside. If the curve is totally inside the box, return a CurveArray2D with only one curve, which is the original curve.

Specified by:
clip in interface CirculinearCurve2D
Specified by:
clip in interface CirculinearCurveSet2D<T extends CirculinearCurve2D>
Specified by:
clip in interface Curve2D
Specified by:
clip in interface Shape2D
Overrides:
clip in class CurveArray2D<T extends CirculinearCurve2D>
Parameters:
box - the clipping box
Returns:
the clipped shape

subCurve

public CirculinearCurveArray2D<? extends CirculinearCurve2D> subCurve(double t0,
                                                                      double t1)
Description copied from class: CurveArray2D
Return an instance of CurveArray2D.

Specified by:
subCurve in interface CirculinearCurve2D
Specified by:
subCurve in interface CirculinearCurveSet2D<T extends CirculinearCurve2D>
Specified by:
subCurve in interface Curve2D
Overrides:
subCurve in class CurveArray2D<T extends CirculinearCurve2D>
Parameters:
t0 - position of the start of the sub-curve
t1 - position of the end of the sub-curve
Returns:
the portion of original curve comprised between t0 and t1.

reverse

public CirculinearCurveArray2D<? extends CirculinearCurve2D> reverse()
Description copied from interface: Curve2D
Returns the curve with same trace on the plane with parameterization in reverse order.

Specified by:
reverse in interface CirculinearCurve2D
Specified by:
reverse in interface CirculinearCurveSet2D<T extends CirculinearCurve2D>
Specified by:
reverse in interface Curve2D
Overrides:
reverse in class CurveArray2D<T extends CirculinearCurve2D>