Class ConvexVolume

    • Field Detail

      • FULL

        private static final ConvexVolume FULL
        Instance representing the full 3D volume.
    • Constructor Detail

      • ConvexVolume

        protected ConvexVolume​(java.util.List<PlaneConvexSubset> boundaries)
        Simple constructor. Callers are responsible for ensuring that the given path represents the boundary of a convex area. No validation is performed.
        Parameters:
        boundaries - the boundaries of the convex area
    • Method Detail

      • getSize

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

        public Vector3D 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<Vector3D>
        Returns:
        the centroid of the region or null if no unique centroid exists
        See Also:
        Centroid
      • toTree

        public RegionBSPTree3D toTree()
        Return a BSP tree constructed from the boundaries contained in this instance. This is a convenience method for quickly constructing BSP trees and may produce unbalanced trees with unacceptable performance characteristics when used with large numbers of boundaries. In these cases, alternate tree construction approaches should be used, such as RegionBSPTree3D.PartitionedRegionBuilder3D.
        Specified by:
        toTree in interface BoundarySource3D
        Returns:
        a BSP tree constructed from the boundaries in this instance
        See Also:
        RegionBSPTree3D.partitionedRegionBuilder()
      • transform

        public ConvexVolume transform​(Transform<Vector3D> transform)
        Return a new instance transformed by the argument.
        Parameters:
        transform - transform to apply
        Returns:
        a new instance transformed by the argument
      • full

        public static ConvexVolume full()
        Return an instance representing the full 3D volume.
        Returns:
        an instance representing the full 3D volume.
      • fromBounds

        public static ConvexVolume fromBounds​(Plane... planes)
        Create a convex volume formed by the intersection of the negative half-spaces of the given bounding planes. The returned instance represents the volume that is on the minus side of all of the given plane. Note that this method does not support volumes of zero size (ie, infinitely thin volumes or points.)
        Parameters:
        planes - planes used to define the convex area
        Returns:
        a new convex volume instance representing the volume on the minus side of all of the bounding plane or an instance representing the full space if the collection is empty
        Throws:
        java.lang.IllegalArgumentException - if the given set of bounding planes do not form a convex volume, meaning that there is no region that is on the minus side of all of the bounding planes.
      • fromBounds

        public static ConvexVolume fromBounds​(java.lang.Iterable<? extends Plane> boundingPlanes)
        Create a convex volume formed by the intersection of the negative half-spaces of the given bounding planes. The returned instance represents the volume that is on the minus side of all of the given plane. Note that this method does not support volumes of zero size (ie, infinitely thin volumes or points.)
        Parameters:
        boundingPlanes - planes used to define the convex area
        Returns:
        a new convex volume instance representing the volume on the minus side of all of the bounding plane or an instance representing the full space if the collection is empty
        Throws:
        java.lang.IllegalArgumentException - if the given set of bounding planes do not form a convex volume, meaning that there is no region that is on the minus side of all of the bounding planes.