Class AbstractConvexPolygon3D

    • Field Detail

      • plane

        private final Plane plane
        Plane containing the convex polygon.
    • Constructor Detail

      • AbstractConvexPolygon3D

        AbstractConvexPolygon3D​(Plane plane)
        Simple constructor.
        Parameters:
        plane - the plane containing the convex polygon
    • Method Detail

      • isFull

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

        This method always returns false.

        Specified by:
        isFull in interface HyperplaneSubset<Vector3D>
        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.

        This method always returns false.

        Specified by:
        isEmpty in interface HyperplaneSubset<Vector3D>
        Returns:
        true if this instance does not contain any points
      • 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 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.

        Specified by:
        getCentroid in interface HyperplaneSubset<Vector3D>
        Returns:
        the centroid of the hyperplane subset or null if no unique centroid exists
        See Also:
        Centroid
      • 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.
        Specified by:
        getBounds in interface PlaneSubset
        Returns:
        the bounding box for this instance or null if no valid bounds could be determined
      • classify

        public RegionLocation classify​(Vector3D pt)
        Classify a point with respect to the subset region. The point is classified as follows:
        • INSIDE - The point lies on the hyperplane and inside of the subset region.
        • BOUNDARY - The point lies on the hyperplane and is on the boundary of the subset region.
        • OUTSIDE - The point does not lie on the hyperplane or it does lie on the hyperplane but is outside of the subset region.
        Specified by:
        classify in interface HyperplaneSubset<Vector3D>
        Parameters:
        pt - the point to classify
        Returns:
        classification of the point with respect to the hyperplane and subspace region
      • closest

        public Vector3D closest​(Vector3D 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.
        Specified by:
        closest in interface HyperplaneSubset<Vector3D>
        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
      • buildPolygonSplitVertexList

        private java.util.List<Vector3D> buildPolygonSplitVertexList​(int enterIdx,
                                                                     Vector3D newEnterPt,
                                                                     int exitIdx,
                                                                     Vector3D newExitPt,
                                                                     java.util.List<? extends Vector3D> vertices)
        Internal method for building a vertex list for one side of a split result. The method is designed to make the fewest allocations possible.
        Parameters:
        enterIdx - the index of the vertex from vertices immediately before the polygon transitioned to being fully entered into this side of the split result. If no point from vertices lay directly on the splitting plane while entering this side and a new vertex had to be computed for the split result, then this index will be the last vertex on the opposite side of the split. If a vertex did lie directly on the splitting plane, then this index will point to that vertex.
        newEnterPt - the newly-computed point to be added as the first vertex in the split result; may be null if no such point exists
        exitIdx - the index of the vertex from vertices immediately before the polygon transitioned to being fully exited from this side of the split result. If no point from vertices lay directly on the splitting plane while exiting this side and a new vertex had to be computed for the split result, then this index will be the last vertex on the this side of the split. If a vertex did lie directly on the splitting plane, then this index will point to that vertex.
        newExitPt - the newly-computed point to be added as the last vertex in the split result; may be null if no such point exists
        vertices - the original list of vertices that this split result originated from; this list is not modified by this operation
        Returns:
        the list of vertices for the split result
      • toString

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