Class EmbeddedTreePlaneSubset

All Implemented Interfaces:
Embedding<Vector3D,Vector2D>, HyperplaneSubset<Vector3D>, Splittable<Vector3D,HyperplaneSubset<Vector3D>>, RegionEmbedding<Vector3D,Vector2D>, Sized, PlaneSubset, PlaneSubset.Embedded

public final class EmbeddedTreePlaneSubset extends AbstractEmbeddedRegionPlaneSubset
Class representing an arbitrary subset of a plane using a RegionBSPTree2D. This class can represent convex, non-convex, finite, infinite, and empty regions.

This class is mutable and not thread safe.

  • Field Details

    • region

      private final RegionBSPTree2D region
      The 2D region representing the area on the plane.
  • Constructor Details

    • EmbeddedTreePlaneSubset

      public EmbeddedTreePlaneSubset(EmbeddingPlane plane)
      Construct a new, empty plane subset for the given plane.
      Parameters:
      plane - plane containing the subset
    • EmbeddedTreePlaneSubset

      public EmbeddedTreePlaneSubset(EmbeddingPlane plane, boolean full)
      Construct a new subset for the given plane. If full is true, then the subset will cover the entire plane; otherwise, it will be empty.
      Parameters:
      plane - plane containing the subset
      full - if true, the subset will cover the entire space; otherwise it will be empty
    • EmbeddedTreePlaneSubset

      public EmbeddedTreePlaneSubset(EmbeddingPlane plane, RegionBSPTree2D region)
      Construct a new instance from its defining plane and subspace region.
      Parameters:
      plane - plane containing the subset
      region - subspace region for the plane subset
  • Method Details

    • getEmbedded

      public PlaneSubset.Embedded getEmbedded()
      Return an object containing the plane subset as an embedded 2D subspace region.
      Returns:
      an object containing the plane subset as an embedded 2D subspace region
    • getSubspaceRegion

      public RegionBSPTree2D getSubspaceRegion()
      Get the embedded subspace region.
      Returns:
      the embedded subspace region
    • toConvex

      public List<PlaneConvexSubset> 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.
      Returns:
      a list of hyperplane convex subsets representing the same subspace region as this instance
    • toTriangles

      public List<Triangle3D> toTriangles()
      Return a list of triangles representing the same subset region as this instance. An IllegalStateException is thrown if the subset has infinite size and therefore cannot be converted to triangles. If the subset has zero size (is empty), an empty list is returned.
      Returns:
      a list of triangles representing the same subset region as this instance
    • getBounds

      public Bounds3D getBounds()
      Get a Bounds3D 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.
      Returns:
      the bounding box for this instance or null if no valid bounds could be determined
    • split

      public Split<EmbeddedTreePlaneSubset> split(Hyperplane<Vector3D> 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 plane subset 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
    • transform

      public EmbeddedTreePlaneSubset transform(Transform<Vector3D> 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
    • add

      public void add(PlaneConvexSubset subset)
      Add a plane convex subset to this instance.
      Parameters:
      subset - plane convex subset to add
      Throws:
      IllegalArgumentException - if the given plane subset is not from a plane equivalent to this instance
    • add

      public void add(EmbeddedTreePlaneSubset subset)
      Add a plane subset to this instance.
      Parameters:
      subset - plane subset to add
      Throws:
      IllegalArgumentException - if the given plane subset is not from a plane equivalent to this instance
    • getEmbeddedRegionRotation

      private Rotation2D getEmbeddedRegionRotation(PlaneSubset.Embedded embedded)
      Construct a rotation transform used to transform the subspace of the given embedded region plane subset into the subspace of this instance. Returns null if no transform is needed. This method must only be called with embedded regions that share an equivalent plane with this instance, meaning that the planes have the same origin point and normal
      Parameters:
      embedded - the embedded region plane subset to compare with the current instance
      Returns:
      a rotation transform to convert from the subspace of the argument into the current subspace; returns null if no such transform is needed