Class EmbeddedTreeLineSubset

    • Field Detail

      • region

        private final RegionBSPTree1D region
        The 1D region representing the area on the line.
    • Constructor Detail

      • EmbeddedTreeLineSubset

        public EmbeddedTreeLineSubset​(Line line)
        Construct a new, empty subset for the given line.
        Parameters:
        line - line defining the subset
      • EmbeddedTreeLineSubset

        public EmbeddedTreeLineSubset​(Line line,
                                      boolean full)
        Construct a new subset for the given line. If full is true, then the subset will cover the entire line; otherwise, it will be empty.
        Parameters:
        line - line defining the subset
        full - if true, the subset will cover the entire space; otherwise it will be empty
      • EmbeddedTreeLineSubset

        public EmbeddedTreeLineSubset​(Line line,
                                      RegionBSPTree1D region)
        Construct a new instance from its defining line and subspace region. The give BSP tree is used directly by this instance; it is not copied.
        Parameters:
        line - line defining the subset
        region - subspace region for the instance
    • Method Detail

      • isFull

        public boolean isFull()
        Return true if this instance contains all points in the hyperplane.
        Returns:
        true if this instance contains all points in the hyperplane
      • isEmpty

        public boolean isEmpty()
        Return true if this instance does not contain any points.
        Returns:
        true if this instance does not contain any points
      • getSize

        public double getSize()
        Get the size of the instance.
        Returns:
        the size of the instance
      • getCentroid

        public Vector2D getCentroid()
        Get the centroid, or geometric center, of the hyperplane subset or null if no centroid exists or one exists but is not unique. A centroid will not exist for empty or infinite subsets.

        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.

        Returns:
        the centroid of the hyperplane subset or null if no unique centroid exists
        See Also:
        Centroid
      • getBounds

        public Bounds2D getBounds()
        Get a Bounds2D object defining an axis-aligned bounding box containing all vertices for this subset. Null is returned if the subset is infinite or does not contain any vertices.
        Specified by:
        getBounds in class LineSubset
        Returns:
        the bounding box for this instance or null if no valid bounds could be determined
      • closest

        public Vector2D closest​(Vector2D pt)
        Return the closest point to the argument that is contained in the subset (ie, not classified as outside), or null if no such point exists.
        Parameters:
        pt - the reference point
        Returns:
        the closest point to the reference point that is contained in the subset, or null if no such point exists
      • transform

        public EmbeddedTreeLineSubset transform​(Transform<Vector2D> transform)
        Return a new hyperplane subset resulting from the application of the given transform. The current instance is not modified.
        Parameters:
        transform - the transform instance to apply
        Returns:
        new transformed hyperplane subset
      • toConvex

        public java.util.List<LineConvexSubset> toConvex()
        Convert this instance into a list of convex child subsets representing the same region. Implementations are not required to return an optimal convex subdivision of the current instance. They are free to return whatever subdivision is readily available.
        Specified by:
        toConvex in interface HyperplaneSubset<Vector2D>
        Specified by:
        toConvex in class LineSubset
        Returns:
        a list of hyperplane convex subsets representing the same subspace region as this instance
      • split

        public Split<EmbeddedTreeLineSubset> split​(Hyperplane<Vector2D> splitter)
        Split this instance with the given hyperplane.

        In all cases, the current instance is not modified. However, In order to avoid unnecessary copying, this method will use the current instance as the split value when the instance lies entirely on the plus or minus side of the splitter. For example, if this instance lies entirely on the minus side of the splitter, the subplane returned by Split.getMinus() will be this instance. Similarly, Split.getPlus() will return the current instance if it lies entirely on the plus side. Callers need to make special note of this, since this class is mutable.

        Parameters:
        splitter - the hyperplane to split this object with.
        Returns:
        result of the split operation
      • add

        public void add​(LineConvexSubset subset)
        Add a line subset to this instance.
        Parameters:
        subset - the line subset to add
        Throws:
        java.lang.IllegalArgumentException - if the given line subset is not from a line equivalent to this instance
      • add

        public void add​(EmbeddedTreeLineSubset subset)
        Add the region represented by the given line subset to this instance. The argument is not modified.
        Parameters:
        subset - line subset to add
        Throws:
        java.lang.IllegalArgumentException - if the given line subset is not from a line equivalent to this instance
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • classifyAbscissa

        RegionLocation classifyAbscissa​(double abscissa)
        Classify the given line abscissa value with respect to the subspace region.
        Specified by:
        classifyAbscissa in class LineSubset
        Parameters:
        abscissa - the abscissa value to classify
        Returns:
        the region location of the line abscissa value