@@ -53,7 +53,7 @@ public class DiscreteTransform2 {
5353 private final Vector3d matrixRow0 ;
5454 private final Vector3d matrixRow1 ;
5555
56- private DiscreteTransform2 (Matrix3d matrix ) {
56+ private DiscreteTransform2 (final Matrix3d matrix ) {
5757 this .matrix = matrix ;
5858 this .matrixRow0 = matrix .row (0 );
5959 this .matrixRow1 = matrix .row (1 );
@@ -75,7 +75,7 @@ public Matrix3d matrix() {
7575 * @param vector The original vector
7676 * @return The transformed vector
7777 */
78- public Vector2i transform (Vector2i vector ) {
78+ public Vector2i transform (final Vector2i vector ) {
7979 return this .transform (vector .x (), vector .y ());
8080 }
8181
@@ -87,7 +87,7 @@ public Vector2i transform(Vector2i vector) {
8787 * @param y The y coordinate of the original vector
8888 * @return The transformed vector
8989 */
90- public Vector2i transform (int x , int y ) {
90+ public Vector2i transform (final int x , final int y ) {
9191 return new Vector2i (this .transformX (x , y ), this .transformY (x , y ));
9292 }
9393
@@ -98,7 +98,7 @@ public Vector2i transform(int x, int y) {
9898 * @param vector The original vector
9999 * @return The transformed x coordinate
100100 */
101- public int transformX (Vector2i vector ) {
101+ public int transformX (final Vector2i vector ) {
102102 return this .transformX (vector .x (), vector .y ());
103103 }
104104
@@ -110,7 +110,7 @@ public int transformX(Vector2i vector) {
110110 * @param y The y coordinate of the original vector
111111 * @return The transformed x coordinate
112112 */
113- public int transformX (int x , int y ) {
113+ public int transformX (final int x , final int y ) {
114114 return GenericMath .floor (this .matrixRow0 .dot (x , y , 1 ) + GenericMath .FLT_EPSILON );
115115 }
116116
@@ -121,7 +121,7 @@ public int transformX(int x, int y) {
121121 * @param vector The original vector
122122 * @return The transformed y coordinate
123123 */
124- public int transformY (Vector2i vector ) {
124+ public int transformY (final Vector2i vector ) {
125125 return this .transformY (vector .x (), vector .y ());
126126 }
127127
@@ -133,7 +133,7 @@ public int transformY(Vector2i vector) {
133133 * @param y The y coordinate of the original vector
134134 * @return The transformed y coordinate
135135 */
136- public int transformY (int x , int y ) {
136+ public int transformY (final int x , final int y ) {
137137 return GenericMath .floor (this .matrixRow1 .dot (x , y , 1 ) + GenericMath .FLT_EPSILON );
138138 }
139139
@@ -154,7 +154,7 @@ public DiscreteTransform2 invert() {
154154 * @param that The transform to compose with
155155 * @return The new composed transform
156156 */
157- public DiscreteTransform2 compose (DiscreteTransform2 that ) {
157+ public DiscreteTransform2 compose (final DiscreteTransform2 that ) {
158158 return new DiscreteTransform2 (this .matrix .mul (that .matrix ));
159159 }
160160
@@ -166,7 +166,7 @@ public DiscreteTransform2 compose(DiscreteTransform2 that) {
166166 * @param that The transform to compose with
167167 * @return The new composed transform
168168 */
169- public DiscreteTransform2 andThen (DiscreteTransform2 that ) {
169+ public DiscreteTransform2 andThen (final DiscreteTransform2 that ) {
170170 return that .compose (this );
171171 }
172172
@@ -176,7 +176,7 @@ public DiscreteTransform2 andThen(DiscreteTransform2 that) {
176176 * @param vector The translation vector
177177 * @return The translated transform as a copy
178178 */
179- public DiscreteTransform2 withTranslation (Vector2i vector ) {
179+ public DiscreteTransform2 withTranslation (final Vector2i vector ) {
180180 return this .withTranslation (vector .x (), vector .y ());
181181 }
182182
@@ -187,7 +187,7 @@ public DiscreteTransform2 withTranslation(Vector2i vector) {
187187 * @param y The y coordinate of the translation
188188 * @return The translated transform as a copy
189189 */
190- public DiscreteTransform2 withTranslation (int x , int y ) {
190+ public DiscreteTransform2 withTranslation (final int x , final int y ) {
191191 return new DiscreteTransform2 (this .matrix .translate (x , y ));
192192 }
193193
@@ -198,7 +198,7 @@ public DiscreteTransform2 withTranslation(int x, int y) {
198198 * @param a The scale factor
199199 * @return The scaled transform as a copy
200200 */
201- public DiscreteTransform2 withScale (int a ) {
201+ public DiscreteTransform2 withScale (final int a ) {
202202 return this .withScale (a , a );
203203 }
204204
@@ -209,7 +209,7 @@ public DiscreteTransform2 withScale(int a) {
209209 * @param vector The scale vector
210210 * @return The scaled transform as a copy
211211 */
212- public DiscreteTransform2 withScale (Vector2i vector ) {
212+ public DiscreteTransform2 withScale (final Vector2i vector ) {
213213 return this .withScale (vector .x (), vector .y ());
214214 }
215215
@@ -221,7 +221,7 @@ public DiscreteTransform2 withScale(Vector2i vector) {
221221 * @param y The scale factor on y
222222 * @return The scaled transform as a copy
223223 */
224- public DiscreteTransform2 withScale (int x , int y ) {
224+ public DiscreteTransform2 withScale (final int x , final int y ) {
225225 if (x == 0 ) {
226226 throw new IllegalArgumentException ("x == 0" );
227227 }
@@ -240,7 +240,7 @@ public DiscreteTransform2 withScale(int x, int y) {
240240 * @param quarterTurns The number of quarter turns in this rotation
241241 * @return The rotated transform as a copy
242242 */
243- public DiscreteTransform2 withRotation (int quarterTurns ) {
243+ public DiscreteTransform2 withRotation (final int quarterTurns ) {
244244 return new DiscreteTransform2 (this .matrix .rotate (Complexd .fromAngleDeg (quarterTurns * 90 )));
245245 }
246246
@@ -257,7 +257,7 @@ public DiscreteTransform2 withRotation(int quarterTurns) {
257257 * the center
258258 * @return The rotated transform as a copy
259259 */
260- public DiscreteTransform2 withRotation (int quarterTurns , Vector2i point , boolean tileCorner ) {
260+ public DiscreteTransform2 withRotation (final int quarterTurns , final Vector2i point , final boolean tileCorner ) {
261261 Vector2d pointDouble = point .toDouble ();
262262 if (tileCorner ) {
263263 pointDouble = pointDouble .add (0.5 , 0.5 );
@@ -283,7 +283,7 @@ public DiscreteTransform2 withRotation(int quarterTurns, Vector2i point, boolean
283283 * of the center on the y axis
284284 * @return The rotated transform as a copy
285285 */
286- public DiscreteTransform2 withRotation (int halfTurns , Vector2i point , boolean tileCornerX , boolean tileCornerY ) {
286+ public DiscreteTransform2 withRotation (final int halfTurns , final Vector2i point , final boolean tileCornerX , final boolean tileCornerY ) {
287287 Vector2d pointDouble = point .toDouble ();
288288 if (tileCornerX ) {
289289 pointDouble = pointDouble .add (0.5 , 0 );
@@ -302,7 +302,7 @@ public DiscreteTransform2 withRotation(int halfTurns, Vector2i point, boolean ti
302302 * @param transform The transformation to add
303303 * @return The added transforms as a copy
304304 */
305- public DiscreteTransform2 withTransformation (DiscreteTransform2 transform ) {
305+ public DiscreteTransform2 withTransformation (final DiscreteTransform2 transform ) {
306306 return new DiscreteTransform2 (transform .matrix ().mul (this .matrix ()));
307307 }
308308
@@ -313,7 +313,7 @@ public DiscreteTransform2 withTransformation(DiscreteTransform2 transform) {
313313 * @param matrix The matrix to use for the transform
314314 * @return The new transform, or {@link Optional#empty()}
315315 */
316- public static Optional <DiscreteTransform2 > of (Matrix3d matrix ) {
316+ public static Optional <DiscreteTransform2 > of (final Matrix3d matrix ) {
317317 if (Arrays .stream (matrix .toArray ())
318318 .anyMatch (value -> Math .rint (value ) != value )) {
319319 return Optional .empty ();
@@ -327,7 +327,7 @@ public static Optional<DiscreteTransform2> of(Matrix3d matrix) {
327327 * @param vector The translation vector
328328 * @return The new translation transform
329329 */
330- public static DiscreteTransform2 fromTranslation (Vector2i vector ) {
330+ public static DiscreteTransform2 fromTranslation (final Vector2i vector ) {
331331 return DiscreteTransform2 .fromTranslation (vector .x (), vector .y ());
332332 }
333333
@@ -338,7 +338,7 @@ public static DiscreteTransform2 fromTranslation(Vector2i vector) {
338338 * @param y The y coordinate of the translation
339339 * @return The new translation transform
340340 */
341- public static DiscreteTransform2 fromTranslation (int x , int y ) {
341+ public static DiscreteTransform2 fromTranslation (final int x , final int y ) {
342342 return new DiscreteTransform2 (Matrix3d .createTranslation (x , y ));
343343 }
344344
@@ -349,7 +349,7 @@ public static DiscreteTransform2 fromTranslation(int x, int y) {
349349 * @param a The scale factor
350350 * @return The new scale transform
351351 */
352- public static DiscreteTransform2 fromScale (int a ) {
352+ public static DiscreteTransform2 fromScale (final int a ) {
353353 return DiscreteTransform2 .fromScale (a , a );
354354 }
355355
@@ -360,7 +360,7 @@ public static DiscreteTransform2 fromScale(int a) {
360360 * @param vector The scale vector
361361 * @return The new scale transform
362362 */
363- public static DiscreteTransform2 fromScale (Vector2i vector ) {
363+ public static DiscreteTransform2 fromScale (final Vector2i vector ) {
364364 return DiscreteTransform2 .fromScale (vector .x (), vector .y ());
365365 }
366366
@@ -372,7 +372,7 @@ public static DiscreteTransform2 fromScale(Vector2i vector) {
372372 * @param y The scale factor on y
373373 * @return The new scale transform
374374 */
375- public static DiscreteTransform2 fromScale (int x , int y ) {
375+ public static DiscreteTransform2 fromScale (final int x , final int y ) {
376376 if (x == 0 ) {
377377 throw new IllegalArgumentException ("x == 0" );
378378 }
@@ -391,7 +391,7 @@ public static DiscreteTransform2 fromScale(int x, int y) {
391391 * @param quarterTurns The number of quarter turns in this rotation
392392 * @return The new rotation transform
393393 */
394- public static DiscreteTransform2 fromRotation (int quarterTurns ) {
394+ public static DiscreteTransform2 fromRotation (final int quarterTurns ) {
395395 return new DiscreteTransform2 (Matrix3d .createRotation (Complexd .fromAngleDeg (quarterTurns * 90 )));
396396 }
397397
@@ -407,7 +407,7 @@ public static DiscreteTransform2 fromRotation(int quarterTurns) {
407407 * the center
408408 * @return The new rotation transform
409409 */
410- public static DiscreteTransform2 fromRotation (int quarterTurns , Vector2i point , boolean tileCorner ) {
410+ public static DiscreteTransform2 fromRotation (final int quarterTurns , final Vector2i point , final boolean tileCorner ) {
411411 Vector2d pointDouble = point .toDouble ();
412412 if (tileCorner ) {
413413 pointDouble = pointDouble .add (0.5 , 0.5 );
@@ -432,7 +432,7 @@ public static DiscreteTransform2 fromRotation(int quarterTurns, Vector2i point,
432432 * of the center on the y axis
433433 * @return The new rotation transform
434434 */
435- public static DiscreteTransform2 fromRotation (int halfTurns , Vector2i point , boolean tileCornerX , boolean tileCornerY ) {
435+ public static DiscreteTransform2 fromRotation (final int halfTurns , final Vector2i point , final boolean tileCornerX , final boolean tileCornerY ) {
436436 Vector2d pointDouble = point .toDouble ();
437437 if (tileCornerX ) {
438438 pointDouble = pointDouble .add (0.5 , 0 );
@@ -454,7 +454,7 @@ public static DiscreteTransform2 fromRotation(int halfTurns, Vector2i point, boo
454454 * @param size The size of the area to rotate
455455 * @return The new rotation transform
456456 */
457- public static DiscreteTransform2 rotationAroundCenter (int quarterTurns , Vector2i size ) {
457+ public static DiscreteTransform2 rotationAroundCenter (final int quarterTurns , final Vector2i size ) {
458458 if (size .x () <= 0 ) {
459459 throw new IllegalArgumentException ("The size on x must be positive" );
460460 }
@@ -464,7 +464,7 @@ public static DiscreteTransform2 rotationAroundCenter(int quarterTurns, Vector2i
464464 final boolean mul180 = (quarterTurns & 1 ) == 0 ;
465465 final boolean xEven = (size .x () & 1 ) == 0 ;
466466 final boolean yEven = (size .y () & 1 ) == 0 ;
467- if (!mul180 || xEven != yEven ) {
467+ if (!mul180 && xEven != yEven ) {
468468 throw new IllegalArgumentException ("The size must have the same parity on all axes for rotations that are "
469469 + "not a multiple of 180 degrees" );
470470 }
0 commit comments