math.geom2d.domain
Class BoundarySet2D<T extends ContinuousBoundary2D>

Package class diagram package BoundarySet2D
java.lang.Object
  extended by math.geom2d.curve.CurveSet2D<T>
      extended by math.geom2d.curve.CurveArray2D<T>
          extended by math.geom2d.domain.BoundarySet2D<T>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Curve2D, Boundary2D, OrientedCurve2D, Shape2D
Direct Known Subclasses:
CirculinearBoundarySet2D, Hyperbola2D

public class BoundarySet2D<T extends ContinuousBoundary2D>
extends CurveArray2D<T>
implements Boundary2D

A BoundarySet2D is a set of continuous oriented curves. Each curve of the set defines its own domain.

Author:
dlegland
See Also:
Serialized Form

Field Summary
 
Fields inherited from class math.geom2d.curve.CurveSet2D
curves
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY
 
Constructor Summary
BoundarySet2D()
           
BoundarySet2D(Collection<? extends T> curves)
           
BoundarySet2D(int size)
           
BoundarySet2D(T curve)
           
BoundarySet2D(T[] curves)
           
 
Method Summary
 CurveSet2D<? extends ContinuousOrientedCurve2D> clip(Box2D box)
          Clip the curve by a box.
static
<T extends ContinuousBoundary2D>
BoundarySet2D<T>
create(Collection<T> curves)
          Static factory for creating a new PolyCurve2D from a collection of curves.
static
<T extends ContinuousBoundary2D>
BoundarySet2D<T>
create(T[] curves)
          Static factory for creating a new PolyCurve2D from an array of curves.
 void fill(Graphics2D g2)
           
 Collection<ContinuousBoundary2D> getBoundaryCurves()
          Returns the different continuous curves composing the boundary
 Domain2D getDomain()
          Returns the domain delimited by this boundary.
 BoundarySet2D<? extends ContinuousBoundary2D> getReverseCurve()
          Returns the curve with same trace on the plane with parametrization in reverse order.
 double getSignedDistance(double x, double y)
          The same as getSignedDistance(Point2D), but by passing 2 double as arguments.
 double getSignedDistance(Point2D p)
          Get the signed distance of the curve to the given point: this distance is positive if the point lies outside the shape, and is negative if the point lies inside the shape.
 CurveSet2D<? extends ContinuousOrientedCurve2D> getSubCurve(double t0, double t1)
          Return an instance of CurveArray2D.
 double getWindingAngle(Point2D point)
          Return the angle portion that the curve turn around the given point.
 boolean isInside(Point2D point)
          Returns true if the point is 'inside' the domain bounded by the curve.
 BoundarySet2D<? extends ContinuousBoundary2D> transform(AffineTransform2D trans)
          Transforms each curve, and build a new CurveArray2D with the set of transformed curves.
 
Methods inherited from class math.geom2d.curve.CurveArray2D
addCurve, clearCurves, clone, contains, contains, containsCurve, draw, equals, getAsAWTShape, getBoundingBox, getChildCurve, getContinuousCurves, getCurve, getCurveIndex, getCurveNumber, getCurves, getDistance, getDistance, getFirstCurve, getFirstPoint, getGeneralPath, getGlobalPosition, getIntersections, getLastCurve, getLastPoint, getLocalPosition, getPoint, getPosition, getSingularPoints, getT0, getT1, isBounded, isEmpty, isSingular, iterator, project, removeCurve
 
Methods inherited from class math.geom2d.curve.CurveSet2D
fromUnitSegment, toUnitSegment
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface math.geom2d.curve.Curve2D
clone, draw, getAsAWTShape, getContinuousCurves, getFirstPoint, getIntersections, getLastPoint, getPoint, getPosition, getSingularPoints, getT0, getT1, isSingular, project
 
Methods inherited from interface math.geom2d.Shape2D
contains, contains, getBoundingBox, getDistance, getDistance, isBounded, isEmpty
 

Constructor Detail

BoundarySet2D

public BoundarySet2D()

BoundarySet2D

public BoundarySet2D(int size)

BoundarySet2D

public BoundarySet2D(T[] curves)

BoundarySet2D

public BoundarySet2D(Collection<? extends T> curves)

BoundarySet2D

public BoundarySet2D(T curve)
Method Detail

create

public static <T extends ContinuousBoundary2D> BoundarySet2D<T> create(Collection<T> curves)
Static factory for creating a new PolyCurve2D from a collection of curves.

Since:
0.8.1

create

public static <T extends ContinuousBoundary2D> BoundarySet2D<T> create(T[] curves)
Static factory for creating a new PolyCurve2D from an array of curves.

Since:
0.8.1

getBoundaryCurves

public Collection<ContinuousBoundary2D> getBoundaryCurves()
Description copied from interface: Boundary2D
Returns the different continuous curves composing the boundary

Specified by:
getBoundaryCurves in interface Boundary2D

getDomain

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

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

fill

public void fill(Graphics2D g2)
Specified by:
fill in interface Boundary2D

getWindingAngle

public double getWindingAngle(Point2D point)
Description copied from interface: OrientedCurve2D
Return the angle portion that the curve turn around the given point. Result is a signed angle.

Specified by:
getWindingAngle in interface OrientedCurve2D
Parameters:
point - a point of the plane
Returns:
a signed angle

getSignedDistance

public double getSignedDistance(Point2D p)
Description copied from interface: OrientedCurve2D
Get the signed distance of the curve to the given point: this distance is positive if the point lies outside the shape, and is negative if the point lies inside the shape. In this case, absolute value of distance is equals to the distance to the border of the shape.

Specified by:
getSignedDistance in interface OrientedCurve2D
Parameters:
p - a point of the plane
Returns:
the signed distance to the curve

getSignedDistance

public double getSignedDistance(double x,
                                double y)
Description copied from interface: OrientedCurve2D
The same as getSignedDistance(Point2D), but by passing 2 double as arguments.

Specified by:
getSignedDistance in interface OrientedCurve2D
Parameters:
x - x-coord of a point
y - y-coord of a point
Returns:
the signed distance of the point (x,y) to the curve

isInside

public boolean isInside(Point2D point)
Description copied from interface: Boundary2D
Returns true if the point is 'inside' the domain bounded by the curve.

Specified by:
isInside in interface Boundary2D
Specified by:
isInside in interface OrientedCurve2D
Parameters:
point - a point in the plane
Returns:
true if the point is on the left side of the curve.

getReverseCurve

public BoundarySet2D<? extends ContinuousBoundary2D> getReverseCurve()
Description copied from interface: Curve2D
Returns the curve with same trace on the plane with parametrization in reverse order.

Specified by:
getReverseCurve in interface Curve2D
Specified by:
getReverseCurve in interface Boundary2D
Specified by:
getReverseCurve in interface OrientedCurve2D
Overrides:
getReverseCurve in class CurveArray2D<T extends ContinuousBoundary2D>

getSubCurve

public CurveSet2D<? extends ContinuousOrientedCurve2D> getSubCurve(double t0,
                                                                   double t1)
Description copied from class: CurveArray2D
Return an instance of CurveArray2D.

Specified by:
getSubCurve in interface Curve2D
Overrides:
getSubCurve in class CurveArray2D<T extends ContinuousBoundary2D>
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.

clip

public CurveSet2D<? extends ContinuousOrientedCurve2D> clip(Box2D box)
Clip the curve by a box. The result is an instance of CurveSet2D, which contains only instances of ContinuousOrientedCurve2D. If the curve is not clipped, the result is an instance of CurveSet2D which contains 0 curves.

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

transform

public BoundarySet2D<? extends ContinuousBoundary2D> transform(AffineTransform2D trans)
Description copied from class: CurveArray2D
Transforms each curve, and build a new CurveArray2D with the set of transformed curves.

Specified by:
transform in interface Curve2D
Specified by:
transform in interface Boundary2D
Specified by:
transform in interface OrientedCurve2D
Specified by:
transform in interface Shape2D
Overrides:
transform in class CurveArray2D<T extends ContinuousBoundary2D>
Parameters:
trans - an affine transform
Returns:
the transformed shape


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.