Interface Transformation.Builder
-
- All Superinterfaces:
ResettableBuilder<Transformation,Transformation.Builder>
- Enclosing interface:
- Transformation
public static interface Transformation.Builder extends ResettableBuilder<Transformation,Transformation.Builder>
Createstransformations
.Apart from the
origin
transformation, all actions will be performed in the order specified in the builder. Thus, a translation then a rotation will not produce the same results as the reverse.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Transformation
build()
Builds aTransformation
Transformation.Builder
mirror(Axis axis)
Performs a reflection of -1 in the direction of the givenAxis
, where the plane from which scaling is performed is normal to this axis and contains theorigin(Vector3d)
.Transformation.Builder
origin(Vector3d origin)
Specifies the origin for position transformations.Transformation.Builder
performRounding(boolean round)
Attempts to round the result to attempt to compensate for machine precision.Transformation.Builder
rotate(Rotation rotation)
Transformation.Builder
translate(Vector3d translate)
Performs a simple additive translation of a positionVector3d
by this supplied vector.-
Methods inherited from interface org.spongepowered.api.util.ResettableBuilder
reset
-
-
-
-
Method Detail
-
origin
Transformation.Builder origin(Vector3d origin)
Specifies the origin for position transformations.This is a special transform in that this translation is performed before the rest of the transformations are made. Once all transformations are performed, this transformation is undone. This is especially useful if you are only transforming around a given origin which is not at (0, 0, 0), as other transformations specified in this object will be performed around this origin instead.
This does not affect
Transformation.transformDirection(Vector3d)
- Parameters:
origin
- The origin to transform around- Returns:
- This builder, for chaining
-
rotate
Transformation.Builder rotate(Rotation rotation)
- Parameters:
rotation
- TheRotation
to perform- Returns:
- This builder, for chaining
-
mirror
Transformation.Builder mirror(Axis axis)
Performs a reflection of -1 in the direction of the givenAxis
, where the plane from which scaling is performed is normal to this axis and contains theorigin(Vector3d)
.For example, for a point (1, 2, 3), using this transformation in the direction the x axis where the origin is at (0, 0, 0) will result in a transformation to (-1, 2, 3).
This action is effectively a scaling of -1 in the axis direction.
- Parameters:
axis
- The axis that represents the direction of scaling- Returns:
- This builder, for chaining
-
translate
Transformation.Builder translate(Vector3d translate)
Performs a simple additive translation of a positionVector3d
by this supplied vector.This does not affect
Transformation.transformDirection(Vector3d)
- Parameters:
translate
- The translation- Returns:
- This builder, for chaining
-
performRounding
Transformation.Builder performRounding(boolean round)
Attempts to round the result to attempt to compensate for machine precision. Defaults totrue
.- Parameters:
round
- Whether to perform rounding- Returns:
- This builder, for chaining
- See Also:
Transformation.performsRounding()
-
build
Transformation build()
Builds aTransformation
- Returns:
- A
Transformation
-
-