Class ConvexArea2S

All Implemented Interfaces:
BoundarySource<GreatArc>, HyperplaneBoundedRegion<Point2S>, Splittable<Point2S, HyperplaneBoundedRegion<Point2S>>, Region<Point2S>, Sized, BoundarySource2S

Class representing a convex area in 2D spherical space. The boundaries of this area, if any, are composed of convex great circle arcs.
  • Method Details

    • boundaryStream

      Return a stream containing the boundaries for this instance.
      Specified by:
      boundaryStream in interface BoundarySource<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

      public double[] 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(): if i is an index into the boundaries list, then angles[i] is the angle between boundaries i and (i+1) % boundariesSize.

      Returns:
      an array of interior angles for the area
    • getSize

      public double getSize()
      Get the size of the instance.
      Specified by:
      getSize in interface Sized
      Returns:
      the size of the instance
    • getCentroid

      public Point2S 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:
      getCentroid in interface Region<Point2S>
      Returns:
      the centroid of the region or null if no unique centroid exists
      See Also:
    • split

      public Split<ConvexArea2S> split(Hyperplane<Point2S> splitter)
      Split this instance with the given hyperplane.
      Specified by:
      split in interface Splittable<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:
      toTree in interface BoundarySource2S
      Returns:
      a BSP tree constructed from the boundaries in this instance
    • transform

      public ConvexArea2S transform(Transform<Point2S> 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:
      trim in class AbstractConvexHyperplaneBoundedRegion<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

      public static ConvexArea2S 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 area
      precision - 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 area
      precision - 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 area
      close - if true, an additional great circle will be created between the last and first vertex
      precision - precision context used to create new great circle instances
      Returns:
      a convex area constructed using great circles between adjacent vertices
    • fromPath

      public static ConvexArea2S fromPath(GreatArcPath path)
      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

      public static ConvexArea2S fromBounds(GreatCircle... bounds)
      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

      public static ConvexArea2S fromBounds(Iterable<GreatCircle> bounds)
      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.