Skip to content

Commit 3a35612

Browse files
author
Daniel Naylor
committed
Add Transformation#then
1 parent 929d1ef commit 3a35612

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/main/java/org/spongepowered/api/util/transformation/Transformation.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,28 @@ static Transformation.Builder builder() {
158158
*/
159159
Builder toBuilder();
160160

161+
/**
162+
* Returns are new Transformation which represents the combination of this
163+
* transformation, followed by the supplied transformation.
164+
*
165+
* <p><strong>You must not assume that the second transformation origin is
166+
* relative to the first.</strong> Each transformation is assumed to operate in
167+
* <strong>untransformed</strong> and each is assumed to operate around the
168+
* origin specified in <em>that</em> transformation. For example, if the
169+
* first transformation operates around (1, 1, 1), and the second operates
170+
* around (2, 2, 2), this will still be the case, the second won't operate
171+
* around (3, 3, 3). As a result, {@link #origin()} will return
172+
* {@link Vector3d#ZERO} unless the two origins are equal to each other.
173+
* </p>
174+
*
175+
* <p>The resultant transformation will set {@link #performsRounding()}
176+
* to the value of <strong>this</strong> transformation.</p>
177+
*
178+
* @param transformation The transformation to perform after this one
179+
* @return A new, combined, transformation
180+
*/
181+
Transformation then(Transformation transformation);
182+
161183
/**
162184
* Creates {@link Transformation transformations}.
163185
*
@@ -175,8 +197,8 @@ interface Builder extends ResettableBuilder<Transformation, Builder> {
175197
* before the rest of the transformations are made. Once all
176198
* transformations are performed, this transformation is undone. This
177199
* is especially useful if you are only transforming around a given
178-
* origin which is not at (0, 0, 0), as the rotation will be performed
179-
* around this origin instead.</p>
200+
* origin which is not at (0, 0, 0), as other transformations specified
201+
* in this object will be performed around this origin instead.</p>
180202
*
181203
* <p>This does not affect
182204
* {@link Transformation#transformDirection(Vector3d)}</p>

0 commit comments

Comments
 (0)