Class ConvexArea2S
java.lang.Object
org.apache.commons.geometry.core.partitioning.AbstractConvexHyperplaneBoundedRegion<Point2S,GreatArc>
org.apache.commons.geometry.spherical.twod.ConvexArea2S
- All Implemented Interfaces:
BoundarySource<GreatArc>, HyperplaneBoundedRegion<Point2S>, Splittable<Point2S, HyperplaneBoundedRegion<Point2S>>, Region<Point2S>, Sized, BoundarySource2S
public final class ConvexArea2S
extends AbstractConvexHyperplaneBoundedRegion<Point2S,GreatArc>
implements BoundarySource2S
Class representing a convex area in 2D spherical space. The boundaries of this
area, if any, are composed of convex great circle arcs.
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractConvexHyperplaneBoundedRegion
AbstractConvexHyperplaneBoundedRegion.ConvexRegionBoundaryBuilder<P,S> -
Method Summary
Modifier and TypeMethodDescriptionReturn a stream containing the boundaries for this instance.static ConvexArea2SfromBounds(Iterable<GreatCircle> bounds) Create a convex area formed by the intersection of the negative half-spaces of the given bounding great circles.static ConvexArea2SfromBounds(GreatCircle... bounds) Create a convex area formed by the intersection of the negative half-spaces of the given bounding great circles.static ConvexArea2SfromPath(GreatArcPath path) Construct a convex area from an arc path.static ConvexArea2SfromVertexLoop(Collection<Point2S> vertices, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Construct a convex area by creating great circles between adjacent vertices.static ConvexArea2SfromVertices(Collection<Point2S> vertices, boolean close, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Construct a convex area from great circles between adjacent vertices.static ConvexArea2SfromVertices(Collection<Point2S> vertices, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Construct a convex area by creating great circles between adjacent vertices.static ConvexArea2Sfull()Return an instance representing the full spherical 2D space.Get a path instance representing the boundary of the area.Get the centroid, or geometric center, of the region or null if no centroid exists or one exists but is not unique.double[]Get an array of interior angles for the area.doublegetSize()Get the size of the instance.split(Hyperplane<Point2S> splitter) Split this instance with the given hyperplane.toTree()Return a BSP tree representing the same region as this instance.Return a new instance transformed by the argument.Trim the given hyperplane subset to the portion contained inside this instance.Methods inherited from class AbstractConvexHyperplaneBoundedRegion
classify, getBoundaries, getBoundarySize, isEmpty, isFull, project, splitInternal, swapsInsideOutside, toString, transformInternalMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface BoundarySource2S
toListMethods inherited from interface Sized
isFinite, isInfinite
-
Method Details
-
boundaryStream
Return a stream containing the boundaries for this instance.- Specified by:
boundaryStreamin interfaceBoundarySource<GreatArc>- Returns:
- a stream containing the boundaries for this instance
-
getBoundaryPath
Get a path instance representing the boundary of the area. The path is oriented so that the minus sides of the arcs lie on the inside of the area.- Returns:
- the boundary path of the area
-
getInteriorAngles
Get an array of interior angles for the area. An empty array is returned if there are no boundary intersections (ie, it has only one boundary or no boundaries at all).The order of the angles corresponds with the order of the boundaries returned by
AbstractConvexHyperplaneBoundedRegion.getBoundaries(): ifiis an index into the boundaries list, thenangles[i]is the angle between boundariesiand(i+1) % boundariesSize.- Returns:
- an array of interior angles for the area
-
getSize
-
getCentroid
Get the centroid, or geometric center, of the region or null if no centroid exists or one exists but is not unique. A centroid will not exist for empty or infinite regions.The centroid of a geometric object is defined as the mean position of all points in the object, including interior points, vertices, and other points lying on the boundary. If a physical object has a uniform density, then its center of mass is the same as its geometric centroid.
- Specified by:
getCentroidin interfaceRegion<Point2S>- Returns:
- the centroid of the region or null if no unique centroid exists
- See Also:
-
split
Split this instance with the given hyperplane.- Specified by:
splitin interfaceSplittable<Point2S, HyperplaneBoundedRegion<Point2S>>- Parameters:
splitter- the hyperplane to split this object with.- Returns:
- result of the split operation
-
toTree
Return a BSP tree representing the same region as this instance.- Specified by:
toTreein interfaceBoundarySource2S- Returns:
- a BSP tree constructed from the boundaries in this instance
-
transform
Return a new instance transformed by the argument.- Parameters:
transform- transform to apply- Returns:
- a new instance transformed by the argument
-
trim
Trim the given hyperplane subset to the portion contained inside this instance.- Overrides:
trimin classAbstractConvexHyperplaneBoundedRegion<Point2S,GreatArc> - Parameters:
sub- hyperplane subset to trim. Null is returned if the subset does not intersect the instance.- Returns:
- portion of the argument that lies entirely inside the region represented by this instance, or null if it does not intersect.
-
full
Return an instance representing the full spherical 2D space.- Returns:
- an instance representing the full spherical 2D space.
-
fromVertices
public static ConvexArea2S fromVertices(Collection<Point2S> vertices, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Construct a convex area by creating great circles between adjacent vertices. The vertices must be given in a counter-clockwise around order the interior of the shape. If the area is intended to be closed, the beginning point must be repeated at the end of the path.- Parameters:
vertices- vertices to use to construct the areaprecision- precision context used to create new great circle instances- Returns:
- a convex area constructed using great circles between adjacent vertices
- See Also:
-
fromVertexLoop
public static ConvexArea2S fromVertexLoop(Collection<Point2S> vertices, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Construct a convex area by creating great circles between adjacent vertices. An implicit great circle is created between the last vertex given and the first one, if needed. The vertices must be given in a counter-clockwise around order the interior of the shape.- Parameters:
vertices- vertices to use to construct the areaprecision- precision context used to create new great circles instances- Returns:
- a convex area constructed using great circles between adjacent vertices
- See Also:
-
fromVertices
public static ConvexArea2S fromVertices(Collection<Point2S> vertices, boolean close, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Construct a convex area from great circles between adjacent vertices.- Parameters:
vertices- vertices to use to construct the areaclose- if true, an additional great circle will be created between the last and first vertexprecision- precision context used to create new great circle instances- Returns:
- a convex area constructed using great circles between adjacent vertices
-
fromPath
Construct a convex area from an arc path. The area represents the intersection of all of the negative half-spaces of the great circles in the path. The boundaries of the returned area may therefore not match the arcs in the path.- Parameters:
path- path to construct the area from- Returns:
- a convex area constructed from the great circles in the given path
-
fromBounds
Create a convex area formed by the intersection of the negative half-spaces of the given bounding great circles. The returned instance represents the area that is on the minus side of all of the given circles. Note that this method does not support areas of zero size (ie, infinitely thin areas or points.)- Parameters:
bounds- great circles used to define the convex area- Returns:
- a new convex area instance representing the area on the minus side of all of the bounding great circles or an instance representing the full area if no circles are given
- Throws:
IllegalArgumentException- if the given set of bounding great circles do not form a convex area, meaning that there is no region that is on the minus side of all of the bounding circles.
-
fromBounds
Create a convex area formed by the intersection of the negative half-spaces of the given bounding great circles. The returned instance represents the area that is on the minus side of all of the given circles. Note that this method does not support areas of zero size (ie, infinitely thin areas or points.)- Parameters:
bounds- great circles used to define the convex area- Returns:
- a new convex area instance representing the area on the minus side of all of the bounding great circles or an instance representing the full area if no circles are given
- Throws:
IllegalArgumentException- if the given set of bounding great circles do not form a convex area, meaning that there is no region that is on the minus side of all of the bounding circles.
-