Class Parallelepiped.Builder
java.lang.Object
org.apache.commons.geometry.euclidean.threed.shape.Parallelepiped.Builder
- Enclosing class:
Parallelepiped
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 Summary
FieldsModifier and TypeFieldDescriptionprivate Vector3D
Amount to translate the parallelepiped.private final org.apache.commons.numbers.core.Precision.DoubleEquivalence
Precision context used to construct boundaries.private QuaternionRotation
The rotation of the parallelepiped.private Vector3D
Amount to scale the parallelepiped. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Builder
(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision) Construct a new instance configured with the given precision context. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build a new parallelepiped instance with the values configured in this builder.setPosition
(Vector3D pos) Set the center position of the created parallelepiped.Set the rotation of the created parallelepiped.setScale
(double scaleFactor) Set the scaling for the created parallelepiped.setScale
(double x, double y, double z) Set the scaling for the created parallelepiped.Set the scaling for the created parallelepiped.
-
Field Details
-
scale
Amount to scale the parallelepiped. -
rotation
The rotation of the parallelepiped. -
position
Amount to translate the parallelepiped. -
precision
private final org.apache.commons.numbers.core.Precision.DoubleEquivalence precisionPrecision context used to construct boundaries.
-
-
Constructor Details
-
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 Details
-
setPosition
Set the center position of the created parallelepiped.- Parameters:
pos
- center position of the created parallelepiped- Returns:
- this instance
-
setScale
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
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 factory
- y scale factorz
- z scale factor- Returns:
- this instance
-
setScale
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
Set the rotation of the created parallelepiped.- Parameters:
rot
- the rotation of the created parallelepiped- Returns:
- this instance
-
build
Build a new parallelepiped instance with the values configured in this builder.- Returns:
- a new parallelepiped instance
- Throws:
IllegalArgumentException
- if the length of any side of the parallelepiped is zero, as determined by the configured precision context- See Also:
-