Class Parallelepiped.Builder
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.threed.shape.Parallelepiped.Builder
-
- Enclosing class:
- Parallelepiped
public static final class Parallelepiped.Builder extends java.lang.ObjectClass designed to aid construction ofParallelepipedinstances. 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
Fields Modifier and Type Field Description private Vector3DpositionAmount to translate the parallelepiped.private org.apache.commons.numbers.core.Precision.DoubleEquivalenceprecisionPrecision context used to construct boundaries.private QuaternionRotationrotationThe rotation of the parallelepiped.private Vector3DscaleAmount to scale the parallelepiped.
-
Constructor Summary
Constructors Modifier Constructor Description privateBuilder(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)Construct a new instance configured with the given precision context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Parallelepipedbuild()Build a new parallelepiped instance with the values configured in this builder.Parallelepiped.BuildersetPosition(Vector3D pos)Set the center position of the created parallelepiped.Parallelepiped.BuildersetRotation(QuaternionRotation rot)Set the rotation of the created parallelepiped.Parallelepiped.BuildersetScale(double scaleFactor)Set the scaling for the created parallelepiped.Parallelepiped.BuildersetScale(double x, double y, double z)Set the scaling for the created parallelepiped.Parallelepiped.BuildersetScale(Vector3D scaleFactors)Set the scaling for the created parallelepiped.
-
-
-
Field Detail
-
scale
private Vector3D scale
Amount to scale the parallelepiped.
-
rotation
private QuaternionRotation rotation
The rotation of 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.
-
-
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 factory- y scale factorz- 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
-
build
public Parallelepiped build()
Build a new parallelepiped instance with the values configured in this builder.- Returns:
- a new parallelepiped instance
- Throws:
java.lang.IllegalArgumentException- if the length of any side of the parallelepiped is zero, as determined by the configured precision context- See Also:
Parallelepiped.fromTransformedUnitCube(Transform, Precision.DoubleEquivalence)
-
-