Class AbstractRegionBSPTree.AbstractRegionNode<P extends Point<P>,​N extends AbstractRegionBSPTree.AbstractRegionNode<P,​N>>

    • Field Detail

      • location

        private RegionLocation location
        The location for the node. This will only be set on leaf nodes.
      • cutBoundary

        private RegionCutBoundary<P extends Point<P>> cutBoundary
        Object representing the part of the node cut hyperplane subset that lies on the region boundary. This is calculated lazily and is only present on internal nodes.
    • Constructor Detail

      • AbstractRegionNode

        protected AbstractRegionNode​(AbstractBSPTree<P,​N> tree)
        Simple constructor.
        Parameters:
        tree - owning tree instance
    • Method Detail

      • getLocation

        public RegionLocation getLocation()
        Get the location property of the node. Only the locations of leaf nodes are meaningful as they relate to the region represented by the BSP tree. For example, changing the location of an internal node will only affect the geometric properties of the region if the node later becomes a leaf node.
        Returns:
        the location of the node
      • setLocation

        public void setLocation​(RegionLocation location)
        Set the location property for the node. If the location is changed, the tree is invalidated.

        Only the locations of leaf nodes are meaningful as they relate to the region represented by the BSP tree. For example, changing the location of an internal node will only affect the geometric properties of the region if the node later becomes a leaf node.

        Parameters:
        location - the location for the node
        Throws:
        java.lang.IllegalArgumentException - if location is not one of INSIDE or OUTSIDE
      • insertCut

        public boolean insertCut​(Hyperplane<P> cutter)
        Insert a cut into this node, using the default region cut rule of RegionCutRule.MINUS_INSIDE.
        Parameters:
        cutter - the hyperplane to cut the node's region with
        Returns:
        true if the cutting hyperplane intersected the node's region, resulting in the creation of new child nodes
        See Also:
        insertCut(Hyperplane, RegionCutRule)
      • insertCut

        public boolean insertCut​(Hyperplane<P> cutter,
                                 RegionCutRule cutRule)
        Insert a cut into this node. If the given hyperplane intersects this node's region, then the node's cut is set to the HyperplaneConvexSubset representing the intersection, new plus and minus child leaf nodes are assigned, and true is returned. If the hyperplane does not intersect the node's region, then the node's cut and plus and minus child references are all set to null (ie, it becomes a leaf node) and false is returned. In either case, any existing cut and/or child nodes are removed by this method.
        Parameters:
        cutter - the hyperplane to cut the node's region with
        cutRule - rule used to determine the region locations of newly created child nodes
        Returns:
        true if the cutting hyperplane intersected the node's region, resulting in the creation of new child nodes
      • clearCut

        public boolean clearCut()
        Remove the cut from this node. Returns true if the node previously had a cut.
        Returns:
        true if the node had a cut before the call to this method
      • cut

        public N cut​(Hyperplane<P> cutter)
        Cut this node with the given hyperplane. The same node is returned, regardless of the outcome of the cut operation. If the operation succeeded, then the node will have plus and minus child nodes.
        Parameters:
        cutter - the hyperplane to cut the node's region with
        Returns:
        this node
        See Also:
        insertCut(Hyperplane)
      • cut

        public N cut​(Hyperplane<P> cutter,
                     RegionCutRule cutRule)
        Cut this node with the given hyperplane, using cutRule to determine the region locations of any new child nodes. The same node is returned, regardless of the outcome of the cut operation. If the operation succeeded, then the node will have plus and minus child nodes.
        Parameters:
        cutter - the hyperplane to cut the node's region with
        cutRule - rule used to determine the region locations of newly created child nodes
        Returns:
        this node
        See Also:
        insertCut(Hyperplane, RegionCutRule)
      • getCutBoundary

        public RegionCutBoundary<P> getCutBoundary()
        Get the portion of the node's cut that lies on the boundary of the region.
        Returns:
        the portion of the node's cut that lies on the boundary of the region
      • computeBoundary

        private RegionCutBoundary<P> computeBoundary()
        Compute the portion of the node's cut that lies on the boundary of the region. This method must only be called on internal nodes.
        Returns:
        object representing the portions of the node's cut that lie on the region's boundary
      • characterizeHyperplaneSubset

        private void characterizeHyperplaneSubset​(HyperplaneConvexSubset<P> sub,
                                                  AbstractRegionBSPTree.AbstractRegionNode<P,​N> node,
                                                  java.util.List<? super HyperplaneConvexSubset<P>> in,
                                                  java.util.List<? super HyperplaneConvexSubset<P>> out)
        Recursive method to characterize a hyperplane convex subset with respect to the region's boundaries.
        Parameters:
        sub - the hyperplane convex subset to characterize
        node - the node to characterize the hyperplane convex subset against
        in - list that will receive the portions of the subset that lie in the inside of the region; may be null
        out - list that will receive the portions of the subset that lie on the outside of the region; may be null
      • setLocationValue

        protected void setLocationValue​(RegionLocation locationValue)
        Directly set the value of the location property for the node. No input validation is performed and the tree is not invalidated.
        Parameters:
        locationValue - the new location value for the node
        See Also:
        setLocation(RegionLocation)