Class Parallelepiped.Builder

  • Enclosing class:
    Parallelepiped

    public static final class Parallelepiped.Builder
    extends java.lang.Object
    Class designed to aid construction of Parallelepiped instances. Parallelepipeds are constructed by transforming the vertices of a unit cube centered at the origin with a transform built from the values configured here. The transformations applied are scaling, rotation, and translation, in that order. When applied in this order, the scale factors determine the width, height, and depth of the parallelepiped; the rotation determines the orientation; and the translation determines the position of the center point.
    • Field Detail

      • scale

        private Vector3D scale
        Amount to scale the parallelepiped.
      • position

        private Vector3D position
        Amount to translate the parallelepiped.
      • precision

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

      • Builder

        private Builder​(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Construct a new instance configured with the given precision context.
        Parameters:
        precision - precision context used to create boundaries
    • Method Detail

      • setPosition

        public Parallelepiped.Builder setPosition​(Vector3D pos)
        Set the center position of the created parallelepiped.
        Parameters:
        pos - center position of the created parallelepiped
        Returns:
        this instance
      • setScale

        public Parallelepiped.Builder setScale​(Vector3D scaleFactors)
        Set the scaling for the created parallelepiped. The scale values determine the lengths of the respective sides in the created parallelepiped.
        Parameters:
        scaleFactors - scale factors
        Returns:
        this instance
      • setScale

        public Parallelepiped.Builder setScale​(double x,
                                               double y,
                                               double z)
        Set the scaling for the created parallelepiped. The scale values determine the lengths of the respective sides in the created parallelepiped.
        Parameters:
        x - x scale factor
        y - y scale factor
        z - z scale factor
        Returns:
        this instance
      • setScale

        public Parallelepiped.Builder setScale​(double scaleFactor)
        Set the scaling for the created parallelepiped. The given scale factor is applied to the x, y, and z directions.
        Parameters:
        scaleFactor - scale factor for the x, y, and z directions
        Returns:
        this instance
      • setRotation

        public Parallelepiped.Builder setRotation​(QuaternionRotation rot)
        Set the rotation of the created parallelepiped.
        Parameters:
        rot - the rotation of the created parallelepiped
        Returns:
        this instance