This is an automated email from the ASF dual-hosted git repository.

mattjuntunen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-geometry.git

commit 38f25f8fe5eccdde5213555b0a97f46214b37277
Author: Baljit Singh <balsi...@ge.com>
AuthorDate: Wed Jul 1 11:32:19 2020 -0400

    Remove redundant local variables
---
 .../threed/rotation/QuaternionRotationTest.java        | 18 +++++++-----------
 .../hull/euclidean/twod/AklToussaintHeuristic.java     |  9 ++++-----
 .../commons/geometry/spherical/oned/Transform1S.java   |  3 +--
 .../commons/geometry/spherical/twod/Transform2S.java   |  5 +----
 .../geometry/spherical/oned/RegionBSPTree1STest.java   |  5 ++---
 5 files changed, 15 insertions(+), 25 deletions(-)

diff --git 
a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java
 
b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java
index c7e16e6..ea288e9 100644
--- 
a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java
+++ 
b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java
@@ -1088,10 +1088,9 @@ public class QuaternionRotationTest {
     public void testCreateVectorRotation_identity() {
         // arrange
         final Vector3D u1 = Vector3D.of(0, 2, 0);
-        final Vector3D u2 = u1;
 
         // act
-        final QuaternionRotation q = 
QuaternionRotation.createVectorRotation(u1, u2);
+        final QuaternionRotation q = 
QuaternionRotation.createVectorRotation(u1, u1);
 
         // assert
         checkQuaternion(q, 1, 0, 0, 0);
@@ -1100,7 +1099,7 @@ public class QuaternionRotationTest {
         Assert.assertEquals(0.0, q.getAngle(), EPS);
 
         EuclideanTestUtils.assertCoordinatesEqual(Vector3D.of(0, 2, 0), 
q.apply(u1), EPS);
-        EuclideanTestUtils.assertCoordinatesEqual(Vector3D.of(0, 2, 0), 
q.inverse().apply(u2), EPS);
+        EuclideanTestUtils.assertCoordinatesEqual(Vector3D.of(0, 2, 0), 
q.inverse().apply(u1), EPS);
     }
 
     @Test
@@ -1232,20 +1231,17 @@ public class QuaternionRotationTest {
         final Vector3D u1 = Vector3D.Unit.PLUS_X;
         final Vector3D u2 = Vector3D.Unit.PLUS_Y;
 
-        final Vector3D v1 = u1;
-        final Vector3D v2 = u2;
-
         // act
-        final QuaternionRotation q = 
QuaternionRotation.createBasisRotation(u1, u2, v1, v2);
+        final QuaternionRotation q = 
QuaternionRotation.createBasisRotation(u1, u2, u1, u2);
 
         // assert
         final QuaternionRotation qInv = q.inverse();
 
-        EuclideanTestUtils.assertCoordinatesEqual(v1, q.apply(u1), EPS);
-        EuclideanTestUtils.assertCoordinatesEqual(v2, q.apply(u2), EPS);
+        EuclideanTestUtils.assertCoordinatesEqual(u1, q.apply(u1), EPS);
+        EuclideanTestUtils.assertCoordinatesEqual(u2, q.apply(u2), EPS);
 
-        EuclideanTestUtils.assertCoordinatesEqual(u1, qInv.apply(v1), EPS);
-        EuclideanTestUtils.assertCoordinatesEqual(u2, qInv.apply(v2), EPS);
+        EuclideanTestUtils.assertCoordinatesEqual(u1, qInv.apply(u1), EPS);
+        EuclideanTestUtils.assertCoordinatesEqual(u2, qInv.apply(u2), EPS);
 
         assertRotationEquals(StandardRotations.IDENTITY, q);
     }
diff --git 
a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/hull/euclidean/twod/AklToussaintHeuristic.java
 
b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/hull/euclidean/twod/AklToussaintHeuristic.java
index 1ea9694..a891255 100644
--- 
a/commons-geometry-hull/src/main/java/org/apache/commons/geometry/hull/euclidean/twod/AklToussaintHeuristic.java
+++ 
b/commons-geometry-hull/src/main/java/org/apache/commons/geometry/hull/euclidean/twod/AklToussaintHeuristic.java
@@ -120,30 +120,29 @@ public final class AklToussaintHeuristic {
     private static boolean insideQuadrilateral(final Vector2D point,
                                                final List<Vector2D> 
quadrilateralPoints) {
 
-        final Vector2D v0 = point;
         Vector2D v1 = quadrilateralPoints.get(0);
         Vector2D v2 = quadrilateralPoints.get(1);
 
-        if (v0.equals(v1) || v0.equals(v2)) {
+        if (point.equals(v1) || point.equals(v2)) {
             return true;
         }
 
         // get the location of the point relative to the first two vertices
-        final double last = signedAreaPoints(v1, v2, v0);
+        final double last = signedAreaPoints(v1, v2, point);
         final int size = quadrilateralPoints.size();
         // loop through the rest of the vertices
         for (int i = 1; i < size; i++) {
             v1 = v2;
             v2 = quadrilateralPoints.get((i + 1) == size ? 0 : i + 1);
 
-            if (v0.equals(v1) || v0.equals(v2)) {
+            if (point.equals(v1) || point.equals(v2)) {
                 return true;
             }
 
             // do side of line test: multiply the last location with this 
location
             // if they are the same sign then the operation will yield a 
positive result
             // -x * -y = +xy, x * y = +xy, -x * y = -xy, x * -y = -xy
-            if (last * signedAreaPoints(v1, v2, v0) < 0) {
+            if (last * signedAreaPoints(v1, v2, point) < 0) {
                 return false;
             }
         }
diff --git 
a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Transform1S.java
 
b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Transform1S.java
index 235915b..269c111 100644
--- 
a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Transform1S.java
+++ 
b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Transform1S.java
@@ -135,10 +135,9 @@ public final class Transform1S implements 
Transform<Point1S> {
     public Transform1S inverse() {
         final double invScale = 1.0 / scale;
 
-        final double resultScale = invScale;
         final double resultRotate = -(rotate * invScale);
 
-        return new Transform1S(resultScale, resultRotate);
+        return new Transform1S(invScale, resultRotate);
     }
 
     /** {@inheritDoc} */
diff --git 
a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Transform2S.java
 
b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Transform2S.java
index f406b65..8ab514d 100644
--- 
a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Transform2S.java
+++ 
b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/Transform2S.java
@@ -248,9 +248,6 @@ public final class Transform2S implements 
Transform<Point2S> {
      */
     private static Transform2S multiply(final Transform2S a, final Transform2S 
b) {
 
-        final AffineTransformMatrix3D aMat = a.euclideanTransform;
-        final AffineTransformMatrix3D bMat = b.euclideanTransform;
-
-        return new Transform2S(aMat.multiply(bMat));
+        return new 
Transform2S(a.euclideanTransform.multiply(b.euclideanTransform));
     }
 }
diff --git 
a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java
 
b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java
index d3a1905..ea33b2e 100644
--- 
a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java
+++ 
b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java
@@ -139,13 +139,12 @@ public class RegionBSPTree1STest {
     public void testFromInterval_nonFull() {
         for (double theta = 0.0; theta <= PlaneAngleRadians.TWO_PI; theta += 
0.2) {
             // arrange
-            final double min = theta;
             final double max = theta + PlaneAngleRadians.PI_OVER_TWO;
 
             // act
-            final RegionBSPTree1S tree = 
RegionBSPTree1S.fromInterval(AngularInterval.of(min, max, TEST_PRECISION));
+            final RegionBSPTree1S tree = 
RegionBSPTree1S.fromInterval(AngularInterval.of(theta, max, TEST_PRECISION));
 
-            checkSingleInterval(tree, min, max);
+            checkSingleInterval(tree, theta, max);
 
             Assert.assertEquals(PlaneAngleRadians.PI_OVER_TWO, tree.getSize(), 
TEST_EPS);
             Assert.assertEquals(0, tree.getBoundarySize(), TEST_EPS);

Reply via email to