Class Planes.PlaneRegionExtruder

  • Enclosing class:
    Planes

    private static final class Planes.PlaneRegionExtruder
    extends java.lang.Object
    Class designed to create 3D regions by taking a 2D region and extruding from a base plane through an extrusion vector. The ends ("top" and "bottom") of the extruded 3D region are flat while the sides follow the boundaries of the original 2D region.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private EmbeddingPlane basePlane
      Base plane to extrude from.
      private boolean extrudingOnPlusSide
      True if the extrusion vector points to the plus side of the base plane.
      private Vector3D extrusionVector
      Vector to extrude along; the extruded plane is translated from the base plane by this amount.
      private org.apache.commons.numbers.core.Precision.DoubleEquivalence precision
      Precision context used to create boundaries.
    • Constructor Summary

      Constructors 
      Constructor Description
      PlaneRegionExtruder​(EmbeddingPlane basePlane, Vector3D extrusionVector, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Construct a new instance that performs extrusions from basePlane along extrusionVector.
    • Field Detail

      • basePlane

        private final EmbeddingPlane basePlane
        Base plane to extrude from.
      • extrusionVector

        private final Vector3D extrusionVector
        Vector to extrude along; the extruded plane is translated from the base plane by this amount.
      • extrudingOnPlusSide

        private final boolean extrudingOnPlusSide
        True if the extrusion vector points to the plus side of the base plane.
      • precision

        private final org.apache.commons.numbers.core.Precision.DoubleEquivalence precision
        Precision context used to create boundaries.
    • Constructor Detail

      • PlaneRegionExtruder

        PlaneRegionExtruder​(EmbeddingPlane basePlane,
                            Vector3D extrusionVector,
                            org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Construct a new instance that performs extrusions from basePlane along extrusionVector.
        Parameters:
        basePlane - base plane to extrude from
        extrusionVector - vector to extrude along
        precision - precision context used to construct boundaries
        Throws:
        java.lang.IllegalArgumentException - if the given extrusion vector and plane produce regions of zero size
    • Method Detail

      • extrude

        public java.util.List<PlaneConvexSubset> extrude​(RegionBSPTree2D subspaceRegion)
        Extrude the given 2D BSP tree using the configured base plane and extrusion vector.
        Parameters:
        subspaceRegion - region to extrude
        Returns:
        the boundaries of the extruded region
      • addEnds

        private void addEnds​(RegionBSPTree2D subspaceRegion,
                             java.util.List<? super PlaneConvexSubset> result)
        Add the end ("top" and "bottom") of the extruded subspace region to the result list.
        Parameters:
        subspaceRegion - subspace region being extruded.
        result - list to add the boundary results to
      • addSides

        private void addSides​(RegionBSPTree2D subspaceRegion,
                              java.util.List<? super PlaneConvexSubset> result)
        Add the side boundaries of the extruded region to the result list.
        Parameters:
        subspaceRegion - subspace region being extruded.
        result - list to add the boundary results to
      • extrudeSideFinite

        private ConvexPolygon3D extrudeSideFinite​(Vector3D startPt,
                                                  Vector3D endPt)
        Extrude a single, finite boundary forming one of the sides of the extruded region.
        Parameters:
        startPt - start point of the boundary
        endPt - end point of the boundary
        Returns:
        the extruded region side boundary
      • extrudeSideInfinite

        private PlaneConvexSubset extrudeSideInfinite​(LineConvexSubset lineSubset)
        Extrude a single, infinite boundary forming one of the sides of the extruded region.
        Parameters:
        lineSubset - line subset to extrude
        Returns:
        the extruded region side boundary