public class ConvexArea extends AbstractConvexHyperplaneBoundedRegion<Vector2D,LineConvexSubset> implements BoundarySource2D
AbstractConvexHyperplaneBoundedRegion.ConvexRegionBoundaryBuilder<P extends Point<P>,S extends HyperplaneConvexSubset<P>>
Modifier | Constructor and Description |
---|---|
protected |
ConvexArea(List<LineConvexSubset> boundaries)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
Stream<LineConvexSubset> |
boundaryStream() |
static ConvexArea |
convexPolygonFromPath(LinePath path)
Construct a convex polygon from a line path.
|
static ConvexArea |
convexPolygonFromVertices(Collection<Vector2D> vertices,
Precision.DoubleEquivalence precision)
Construct a convex polygon from the given vertices.
|
static ConvexArea |
fromBounds(Iterable<Line> bounds)
Create a convex area formed by the intersection of the negative half-spaces of the
given bounding lines.
|
static ConvexArea |
fromBounds(Line... bounds)
Create a convex area formed by the intersection of the negative half-spaces of the
given bounding lines.
|
static ConvexArea |
full()
Return an instance representing the full 2D area.
|
List<LinePath> |
getBoundaryPaths()
Get the connected line subset paths comprising the boundary of the area.
|
Vector2D |
getCentroid() |
double |
getSize() |
List<Vector2D> |
getVertices()
Get the vertices for the area in a counter-clockwise order.
|
Split<ConvexArea> |
split(Hyperplane<Vector2D> splitter) |
RegionBSPTree2D |
toTree()
Return a BSP tree representing the same region as this instance.
|
ConvexArea |
transform(Transform<Vector2D> transform)
Return a new instance transformed by the argument.
|
LineConvexSubset |
trim(HyperplaneConvexSubset<Vector2D> convexSubset) |
classify, getBoundaries, getBoundarySize, isEmpty, isFull, project, splitInternal, swapsInsideOutside, toString, transformInternal
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBounds, linecast, linecastFirst, of, of, toList
linecast, linecastFirst
isFinite, isInfinite
protected ConvexArea(List<LineConvexSubset> boundaries)
boundaries
- the boundaries of the convex areapublic Stream<LineConvexSubset> boundaryStream()
boundaryStream
in interface BoundarySource<LineConvexSubset>
public List<LinePath> getBoundaryPaths()
public List<Vector2D> getVertices()
It is important to note that, in general, the list of vertices returned by this method is not sufficient to completely characterize the area. For example, a simple triangle has 3 vertices, but an infinite area constructed from two parallel lines and two lines that intersect between them will also have 3 vertices. It is also possible for non-empty areas to contain no vertices at all. For example, an area with no boundaries (representing the full space), an area with a single boundary, or an area with two parallel boundaries will not contain any vertices.
public ConvexArea transform(Transform<Vector2D> transform)
transform
- transform to applypublic LineConvexSubset trim(HyperplaneConvexSubset<Vector2D> convexSubset)
trim
in class AbstractConvexHyperplaneBoundedRegion<Vector2D,LineConvexSubset>
public Vector2D getCentroid()
getCentroid
in interface Region<Vector2D>
public Split<ConvexArea> split(Hyperplane<Vector2D> splitter)
split
in interface Splittable<Vector2D,HyperplaneBoundedRegion<Vector2D>>
public RegionBSPTree2D toTree()
toTree
in interface BoundarySource2D
RegionBSPTree2D.partitionedRegionBuilder()
public static ConvexArea full()
public static ConvexArea convexPolygonFromVertices(Collection<Vector2D> vertices, Precision.DoubleEquivalence precision)
vertices
- vertices to use to construct the polygonprecision
- precision context used for floating point comparisonsIllegalStateException
- if vertices
contains only a single unique vertexIllegalArgumentException
- if the constructed path does not define a closed, convex polygonLinePath.fromVertexLoop(Collection, Precision.DoubleEquivalence)
public static ConvexArea convexPolygonFromPath(LinePath path)
path
- path to construct the polygon fromIllegalArgumentException
- if the path does not define a closed, convex polygonpublic static ConvexArea fromBounds(Line... bounds)
bounds
- lines used to define the convex areaIllegalArgumentException
- if the given set of bounding lines do not form a convex area,
meaning that there is no region that is on the minus side of all of the bounding lines.public static ConvexArea fromBounds(Iterable<Line> bounds)
bounds
- lines used to define the convex areaIllegalArgumentException
- if the given set of bounding lines do not form a convex area,
meaning that there is no region that is on the minus side of all of the bounding lines.Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.