Class RegionBSPTree2S

    • Field Detail

      • FULL_SIZE

        private static final double FULL_SIZE
        Constant containing the area of the full spherical space.
        See Also:
        Constant Field Values
      • boundaryPaths

        private java.util.List<GreatArcPath> boundaryPaths
        List of great arc path comprising the region boundary.
    • Constructor Detail

      • RegionBSPTree2S

        public RegionBSPTree2S()
        Create a new, empty instance.
      • RegionBSPTree2S

        public RegionBSPTree2S​(boolean full)
        Create a new region. If full is true, then the region will represent the entire 2-sphere. Otherwise, it will be empty.
        Parameters:
        full - whether or not the region should contain the entire 2-sphere or be empty
    • Method Detail

      • boundaryStream

        public java.util.stream.Stream<GreatArc> 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
      • getBoundaries

        public java.util.List<GreatArc> getBoundaries()
        Return a list containing the boundaries of the region. Each boundary is oriented such that its plus side points to the outside of the region. The exact ordering of the boundaries is determined by the internal structure of the tree.
        Overrides:
        getBoundaries in class AbstractRegionBSPTree<Point2S,​RegionBSPTree2S.RegionNode2S>
        Returns:
        a list of the boundaries of the region
      • getBoundaryPaths

        public java.util.List<GreatArcPath> getBoundaryPaths()
        Get the boundary of the region as a list of connected great arc paths. The arcs are oriented such that their minus (left) side lies on the interior of the region.
        Returns:
        great arc paths representing the region boundary
      • toConvex

        public java.util.List<ConvexArea2S> toConvex()
        Return a list of ConvexArea2Ss representing the same region as this instance. One convex area is returned for each interior leaf node in the tree.
        Returns:
        a list of convex areas representing the same region as this instance
      • toConvexRecursive

        private void toConvexRecursive​(RegionBSPTree2S.RegionNode2S node,
                                       ConvexArea2S nodeArea,
                                       java.util.List<? super ConvexArea2S> result)
        Recursive method to compute the convex areas of all inside leaf nodes in the subtree rooted at the given node. The computed convex areas are added to the given list.
        Parameters:
        node - root of the subtree to compute the convex areas for
        nodeArea - the convex area for the current node; this will be split by the node's cut hyperplane to form the convex areas for any child nodes
        result - list containing the results of the computation
      • toTree

        public RegionBSPTree2S toTree()
        Return the current instance.
        Specified by:
        toTree in interface BoundarySource2S
        Returns:
        a BSP tree constructed from the boundaries in this instance
      • computeBoundaryPaths

        private java.util.List<GreatArcPath> computeBoundaryPaths()
        Compute the great arc paths comprising the region boundary.
        Returns:
        the great arc paths comprising the region boundary
      • empty

        public static RegionBSPTree2S empty()
        Return a new, empty BSP tree.
        Returns:
        a new, empty BSP tree.
      • full

        public static RegionBSPTree2S full()
        Return a new, full BSP tree. The returned tree represents the full space.
        Returns:
        a new, full BSP tree.
      • from

        public static RegionBSPTree2S from​(java.lang.Iterable<GreatArc> boundaries)
        Construct a new tree from the given boundaries. If no boundaries are present, the returned tree is empty.
        Parameters:
        boundaries - boundaries to construct the tree from
        Returns:
        a new tree instance constructed from the given boundaries
        See Also:
        from(Iterable, boolean)
      • from

        public static RegionBSPTree2S from​(java.lang.Iterable<GreatArc> boundaries,
                                           boolean full)
        Construct a new tree from the given boundaries. If full is true, then the initial tree before boundary insertion contains the entire space. Otherwise, it is empty.
        Parameters:
        boundaries - boundaries to construct the tree from
        full - if true, the initial tree will contain the entire space
        Returns:
        a new tree instance constructed from the given boundaries