math.geom2d.domain
Class BoundaryPolyCurve2D<T extends ContinuousOrientedCurve2D>

java.lang.Object
  extended by math.geom2d.curve.CurveArray2D<T>
      extended by math.geom2d.curve.PolyCurve2D<T>
          extended by math.geom2d.domain.PolyOrientedCurve2D<T>
              extended by math.geom2d.domain.BoundaryPolyCurve2D<T>
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<T>, ContinuousCurve2D, Curve2D, CurveSet2D<T>, Boundary2D, ContinuousOrientedCurve2D, Contour2D, OrientedCurve2D, GeometricObject2D, Shape2D, ShapeSet2D<T>

public class BoundaryPolyCurve2D<T extends ContinuousOrientedCurve2D>
extends PolyOrientedCurve2D<T>
implements Contour2D

A single continuous oriented curve, which defines the boundary of a planar domain. The boundary curve is composed of several continuous and oriented curves linked together to form a continuous curve. The resulting boundary curve is either a closed curve, or an infinite curve at both ends.

Author:
dlegland

Field Summary
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY
 
Constructor Summary
BoundaryPolyCurve2D()
          Creates an empty BoundaryPolyCurve2D.
BoundaryPolyCurve2D(java.util.Collection<? extends T> curves)
          Creates a BoundaryPolyCurve2D from the specified set of curves.
BoundaryPolyCurve2D(int n)
          Creates a BoundaryPolyCurve2D by reserving space for n curves.
BoundaryPolyCurve2D(T... curves)
          Creates a BoundaryPolyCurve2D from the specified set of curves.
 
Method Summary
 java.util.Collection<BoundaryPolyCurve2D<T>> continuousCurves()
          Returns a collection of PolyCurve2D that contains only this instance.
static
<T extends ContinuousOrientedCurve2D>
BoundaryPolyCurve2D<T>
create(java.util.Collection<T> curves)
          Static factory for creating a new BoundaryPolyCurve2D from a collection of curves.
static
<T extends ContinuousOrientedCurve2D>
BoundaryPolyCurve2D<T>
create(T... curves)
          Static factory for creating a new BoundaryPolyCurve2D from an array of curves.
 Domain2D domain()
          Returns the domain delimited by this boundary.
 void fill(java.awt.Graphics2D g2)
          Fills the interior of the boundary, using the Graphics current Paint.
 boolean isClosed()
          Overrides the isClosed() in the following way: return true if all curves are bounded.
 BoundaryPolyCurve2D<? extends ContinuousOrientedCurve2D> reverse()
          Returns the reverse curve of this PolyCurve2D.
 BoundaryPolyCurve2D<ContinuousOrientedCurve2D> transform(AffineTransform2D trans)
          Transforms each smooth piece in this PolyCurve2D and returns a new instance of PolyCurve2D.
 
Methods inherited from class math.geom2d.domain.PolyOrientedCurve2D
clip, create, create, createClosed, equals, isInside, signedDistance, signedDistance, subCurve, windingAngle
 
Methods inherited from class math.geom2d.curve.PolyCurve2D
appendPath, asPolyline, curvature, draw, getGeneralPath, leftTangent, rightTangent, setClosed, smoothPieces
 
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.domain.Boundary2D
isInside
 
Methods inherited from interface math.geom2d.domain.ContinuousOrientedCurve2D
clip, subCurve
 
Methods inherited from interface math.geom2d.curve.ContinuousCurve2D
appendPath, asPolyline, curvature, leftTangent, rightTangent, smoothPieces
 
Methods inherited from interface math.geom2d.domain.OrientedCurve2D
signedDistance, signedDistance, windingAngle
 
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

BoundaryPolyCurve2D

public BoundaryPolyCurve2D()
Creates an empty BoundaryPolyCurve2D.


BoundaryPolyCurve2D

public BoundaryPolyCurve2D(int n)
Creates a BoundaryPolyCurve2D by reserving space for n curves.

Parameters:
n - the number of curves to store

BoundaryPolyCurve2D

public BoundaryPolyCurve2D(T... curves)
Creates a BoundaryPolyCurve2D from the specified set of curves.


BoundaryPolyCurve2D

public BoundaryPolyCurve2D(java.util.Collection<? extends T> curves)
Creates a BoundaryPolyCurve2D from the specified set of curves.

Method Detail

create

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

Since:
0.8.1

create

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

Since:
0.8.1

isClosed

public boolean isClosed()
Overrides the isClosed() in the following way: return true if all curves are bounded. If at least one curve is unbounded, return false.

Specified by:
isClosed in interface ContinuousCurve2D
Overrides:
isClosed in class PolyCurve2D<T extends ContinuousOrientedCurve2D>

continuousCurves

public java.util.Collection<BoundaryPolyCurve2D<T>> continuousCurves()
Description copied from class: PolyCurve2D
Returns a collection of PolyCurve2D that contains only this instance.

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

domain

public Domain2D domain()
Description copied from interface: Boundary2D
Returns the domain delimited by this boundary.

Specified by:
domain in interface Boundary2D
Returns:
the domain delimited by this boundary

fill

public void fill(java.awt.Graphics2D g2)
Description copied from interface: Boundary2D
Fills the interior of the boundary, using the Graphics current Paint.

Specified by:
fill in interface Boundary2D
Parameters:
g2 - the Graphics to fill on

reverse

public BoundaryPolyCurve2D<? extends ContinuousOrientedCurve2D> reverse()
Description copied from class: PolyCurve2D
Returns the reverse curve of this PolyCurve2D.

Specified by:
reverse in interface ContinuousCurve2D
Specified by:
reverse in interface Curve2D
Specified by:
reverse in interface Boundary2D
Specified by:
reverse in interface ContinuousOrientedCurve2D
Specified by:
reverse in interface Contour2D
Specified by:
reverse in interface OrientedCurve2D
Overrides:
reverse in class PolyOrientedCurve2D<T extends ContinuousOrientedCurve2D>

transform

public BoundaryPolyCurve2D<ContinuousOrientedCurve2D> transform(AffineTransform2D trans)
Description copied from class: PolyCurve2D
Transforms each smooth piece in this PolyCurve2D and returns a new instance of PolyCurve2D.

Specified by:
transform in interface ContinuousCurve2D
Specified by:
transform in interface Curve2D
Specified by:
transform in interface CurveSet2D<T extends ContinuousOrientedCurve2D>
Specified by:
transform in interface Boundary2D
Specified by:
transform in interface ContinuousOrientedCurve2D
Specified by:
transform in interface Contour2D
Specified by:
transform in interface OrientedCurve2D
Specified by:
transform in interface Shape2D
Overrides:
transform in class PolyOrientedCurve2D<T extends ContinuousOrientedCurve2D>
Parameters:
trans - an affine transform
Returns:
the transformed shape