You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2020/07/03 02:36:02 UTC

[commons-geometry] branch master updated (ba1b480 -> 8d3d7ea)

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

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


    from ba1b480  GEOMETRY-95: adding BSP tree tutorial
     new e88905e  removing redundant groupId and version entries from poms
     new 452e5ba  updating dist-archive pom dependencies; removing redundant groupId and version
     new d951410  GEOMETRY-63: throwing NoSuchElementException in SimpleTriangleMesh Face iterator
     new 1e7b57c  GEOMETRY-63: removing unnecessary braces in lambdas; removing use of Stream.peek
     new b29a0d7  removing empty test
     new 8d3d7ea  GEOMETRY-63: swapping assertion argument order

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 commons-geometry-core/pom.xml                      |  2 --
 commons-geometry-enclosing/pom.xml                 |  2 --
 commons-geometry-euclidean/pom.xml                 |  2 --
 .../euclidean/threed/mesh/SimpleTriangleMesh.java  | 36 ++++++++++---------
 .../threed/mesh/SimpleTriangleMeshTest.java        | 33 ++++++++++++++----
 commons-geometry-examples/examples-io/pom.xml      |  2 --
 .../examples-tutorials/pom.xml                     |  2 --
 commons-geometry-hull/pom.xml                      |  2 --
 commons-geometry-spherical/pom.xml                 |  2 --
 .../geometry/spherical/oned/Point1STest.java       |  2 +-
 dist-archive/pom.xml                               | 40 ++++++++++++++++++++--
 pom.xml                                            |  1 -
 12 files changed, 86 insertions(+), 40 deletions(-)


[commons-geometry] 02/06: updating dist-archive pom dependencies; removing redundant groupId and version

Posted by ma...@apache.org.
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 452e5ba88c836334e2faea1a119c356af15314d0
Author: Matt Juntunen <ma...@apache.org>
AuthorDate: Thu Jul 2 22:13:37 2020 -0400

    updating dist-archive pom dependencies; removing redundant groupId and version
---
 dist-archive/pom.xml | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/dist-archive/pom.xml b/dist-archive/pom.xml
index d9510fe..9adeddc 100644
--- a/dist-archive/pom.xml
+++ b/dist-archive/pom.xml
@@ -26,9 +26,7 @@ under the License.
     <version>1.0-SNAPSHOT</version>
   </parent>
 
-  <groupId>org.apache.commons</groupId>
   <artifactId>commons-geometry</artifactId>
-  <version>1.0-SNAPSHOT</version>
   <packaging>pom</packaging>
   <name>Apache Commons Geometry (full distribution)</name>
   <description>This module creates the Apache Commons Geometry distribution.</description>
@@ -176,6 +174,44 @@ under the License.
           <classifier>javadoc</classifier>
         </dependency>
 
+        <!-- Module: Examples - IO -->
+        <dependency>
+          <groupId>org.apache.commons</groupId>
+          <artifactId>commons-geometry-examples-io</artifactId>
+          <version>${project.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.commons</groupId>
+          <artifactId>commons-geometry-examples-io</artifactId>
+          <version>${project.version}</version>
+          <classifier>sources</classifier>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.commons</groupId>
+          <artifactId>commons-geometry-examples-io</artifactId>
+          <version>${project.version}</version>
+          <classifier>javadoc</classifier>
+        </dependency>
+
+        <!-- Module: Examples - Tutorials -->
+        <dependency>
+          <groupId>org.apache.commons</groupId>
+          <artifactId>commons-geometry-examples-tutorials</artifactId>
+          <version>${project.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.commons</groupId>
+          <artifactId>commons-geometry-examples-tutorials</artifactId>
+          <version>${project.version}</version>
+          <classifier>sources</classifier>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.commons</groupId>
+          <artifactId>commons-geometry-examples-tutorials</artifactId>
+          <version>${project.version}</version>
+          <classifier>javadoc</classifier>
+        </dependency>
+
       </dependencies>
       <build>
         <plugins>


[commons-geometry] 05/06: removing empty test

Posted by ma...@apache.org.
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 b29a0d7341638f66c5dd2a517d86c436426dd35c
Author: Matt Juntunen <ma...@apache.org>
AuthorDate: Thu Jul 2 22:32:51 2020 -0400

    removing empty test
---
 .../geometry/euclidean/threed/mesh/SimpleTriangleMeshTest.java      | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMeshTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMeshTest.java
index 68912d6..b6ac4dc 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMeshTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMeshTest.java
@@ -386,12 +386,6 @@ public class SimpleTriangleMeshTest {
     }
 
     @Test
-    public void testToTree_largeNumberOfFaces() {
-        // arrange
-        // TODO
-    }
-
-    @Test
     public void testTransform() {
         // arrange
         final SimpleTriangleMesh mesh = SimpleTriangleMesh.from(Parallelepiped.unitCube(TEST_PRECISION), TEST_PRECISION);


[commons-geometry] 01/06: removing redundant groupId and version entries from poms

Posted by ma...@apache.org.
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 e88905eaf677c0df6032d5553fd54fd5217ec4bb
Author: Matt Juntunen <ma...@apache.org>
AuthorDate: Thu Jul 2 17:34:05 2020 -0400

    removing redundant groupId and version entries from poms
---
 commons-geometry-core/pom.xml                        | 2 --
 commons-geometry-enclosing/pom.xml                   | 2 --
 commons-geometry-euclidean/pom.xml                   | 2 --
 commons-geometry-examples/examples-io/pom.xml        | 2 --
 commons-geometry-examples/examples-tutorials/pom.xml | 2 --
 commons-geometry-hull/pom.xml                        | 2 --
 commons-geometry-spherical/pom.xml                   | 2 --
 pom.xml                                              | 1 -
 8 files changed, 15 deletions(-)

diff --git a/commons-geometry-core/pom.xml b/commons-geometry-core/pom.xml
index 6ecf798..5fc52b4 100644
--- a/commons-geometry-core/pom.xml
+++ b/commons-geometry-core/pom.xml
@@ -26,9 +26,7 @@
     <version>1.0-SNAPSHOT</version>
   </parent>
 
-  <groupId>org.apache.commons</groupId>
   <artifactId>commons-geometry-core</artifactId>
-  <version>1.0-SNAPSHOT</version>
   <name>Apache Commons Geometry Core</name>
 
   <description>Core interfaces and classes for Apache Commons Geometry.</description>
diff --git a/commons-geometry-enclosing/pom.xml b/commons-geometry-enclosing/pom.xml
index c0efa07..7deb010 100644
--- a/commons-geometry-enclosing/pom.xml
+++ b/commons-geometry-enclosing/pom.xml
@@ -26,9 +26,7 @@
     <version>1.0-SNAPSHOT</version>
   </parent>
 
-  <groupId>org.apache.commons</groupId>
   <artifactId>commons-geometry-enclosing</artifactId>
-  <version>1.0-SNAPSHOT</version>
   <name>Apache Commons Geometry Enclosing</name>
 
   <description>Algorithms for computing enclosing balls.</description>
diff --git a/commons-geometry-euclidean/pom.xml b/commons-geometry-euclidean/pom.xml
index 239c4ab..fdb7966 100644
--- a/commons-geometry-euclidean/pom.xml
+++ b/commons-geometry-euclidean/pom.xml
@@ -26,9 +26,7 @@
     <version>1.0-SNAPSHOT</version>
   </parent>
 
-  <groupId>org.apache.commons</groupId>
   <artifactId>commons-geometry-euclidean</artifactId>
-  <version>1.0-SNAPSHOT</version>
   <name>Apache Commons Geometry Euclidean</name>
 
   <description>Geometric primitives for euclidean space.</description>
diff --git a/commons-geometry-examples/examples-io/pom.xml b/commons-geometry-examples/examples-io/pom.xml
index bf4b480..68b9536 100644
--- a/commons-geometry-examples/examples-io/pom.xml
+++ b/commons-geometry-examples/examples-io/pom.xml
@@ -24,9 +24,7 @@
     <version>1.0-SNAPSHOT</version>
   </parent>
 
-  <groupId>org.apache.commons</groupId>
   <artifactId>commons-geometry-examples-io</artifactId>
-  <version>1.0-SNAPSHOT</version>
   <name>Apache Commons Geometry IO Examples</name>
 
   <description>Contains code examples for reading and writing geometric objects to persistent storage.
diff --git a/commons-geometry-examples/examples-tutorials/pom.xml b/commons-geometry-examples/examples-tutorials/pom.xml
index aa02b4d..d566631 100644
--- a/commons-geometry-examples/examples-tutorials/pom.xml
+++ b/commons-geometry-examples/examples-tutorials/pom.xml
@@ -24,9 +24,7 @@
     <version>1.0-SNAPSHOT</version>
   </parent>
 
-  <groupId>org.apache.commons</groupId>
   <artifactId>commons-geometry-examples-tutorials</artifactId>
-  <version>1.0-SNAPSHOT</version>
   <name>Apache Commons Geometry Tutorials</name>
 
   <description>Contains code used in project tutorials. Code in this module is not part of the public API.</description>
diff --git a/commons-geometry-hull/pom.xml b/commons-geometry-hull/pom.xml
index c6d4283..eb41763 100644
--- a/commons-geometry-hull/pom.xml
+++ b/commons-geometry-hull/pom.xml
@@ -26,9 +26,7 @@
     <version>1.0-SNAPSHOT</version>
   </parent>
 
-  <groupId>org.apache.commons</groupId>
   <artifactId>commons-geometry-hull</artifactId>
-  <version>1.0-SNAPSHOT</version>
   <name>Apache Commons Geometry Hull</name>
 
   <description>Algorithms for computing convex hulls.</description>
diff --git a/commons-geometry-spherical/pom.xml b/commons-geometry-spherical/pom.xml
index a22f9fd..026cde4 100644
--- a/commons-geometry-spherical/pom.xml
+++ b/commons-geometry-spherical/pom.xml
@@ -26,9 +26,7 @@
     <version>1.0-SNAPSHOT</version>
   </parent>
 
-  <groupId>org.apache.commons</groupId>
   <artifactId>commons-geometry-spherical</artifactId>
-  <version>1.0-SNAPSHOT</version>
   <name>Apache Commons Geometry Spherical</name>
 
   <description>Geometric primitives for spherical space.</description>
diff --git a/pom.xml b/pom.xml
index fdee1b2..426ff5f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,6 @@
     <version>50</version>
   </parent>
 
-  <groupId>org.apache.commons</groupId>
   <artifactId>commons-geometry-parent</artifactId>
   <version>1.0-SNAPSHOT</version>
   <packaging>pom</packaging>


[commons-geometry] 04/06: GEOMETRY-63: removing unnecessary braces in lambdas; removing use of Stream.peek

Posted by ma...@apache.org.
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 1e7b57cae90b1ea5c6798657b6c4cf7aae5b84b0
Author: Matt Juntunen <ma...@apache.org>
AuthorDate: Thu Jul 2 22:31:46 2020 -0400

    GEOMETRY-63: removing unnecessary braces in lambdas; removing use of Stream.peek
---
 .../euclidean/threed/mesh/SimpleTriangleMesh.java  | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMesh.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMesh.java
index 5eae799..1c56b5b 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMesh.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMesh.java
@@ -28,7 +28,6 @@ import java.util.NoSuchElementException;
 import java.util.Objects;
 import java.util.TreeMap;
 import java.util.function.Function;
-import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 
@@ -102,9 +101,7 @@ public final class SimpleTriangleMesh implements TriangleMesh {
     /** {@inheritDoc} */
     @Override
     public Iterable<TriangleMesh.Face> faces() {
-        return () -> {
-            return new FaceIterator<Face>(Function.identity());
-        };
+        return () -> new FaceIterator<>(Function.identity());
     }
 
     /** {@inheritDoc} */
@@ -163,10 +160,15 @@ public final class SimpleTriangleMesh implements TriangleMesh {
     public SimpleTriangleMesh transform(final Transform<Vector3D> transform) {
         // only the vertices and bounds are modified; the faces are the same
         final Bounds3D.Builder boundsBuilder = Bounds3D.builder();
-        final List<Vector3D> tVertices = vertices.stream()
-                .map(transform)
-                .peek(boundsBuilder::add)
-                .collect(Collectors.toList());
+        final List<Vector3D> tVertices = new ArrayList<>(vertices.size());
+
+        Vector3D tVertex;
+        for (final Vector3D vertex : vertices) {
+            tVertex = transform.apply(vertex);
+
+            boundsBuilder.add(tVertex);
+            tVertices.add(tVertex);
+        }
 
         final Bounds3D tBounds = boundsBuilder.hasBounds() ?
                 boundsBuilder.build() :
@@ -269,12 +271,10 @@ public final class SimpleTriangleMesh implements TriangleMesh {
     public static SimpleTriangleMesh from(final BoundarySource3D boundarySrc, final DoublePrecisionContext precision) {
         final Builder builder = builder(precision);
         try (Stream<Triangle3D> stream = boundarySrc.triangleStream()) {
-            stream.forEach(tri -> {
-                builder.addFaceUsingVertices(
-                        tri.getPoint1(),
-                        tri.getPoint2(),
-                        tri.getPoint3());
-            });
+            stream.forEach(tri -> builder.addFaceUsingVertices(
+                tri.getPoint1(),
+                tri.getPoint2(),
+                tri.getPoint3()));
         }
 
         return builder.build();


[commons-geometry] 06/06: GEOMETRY-63: swapping assertion argument order

Posted by ma...@apache.org.
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 8d3d7ea95e629ad1cd2637031c145aee51ea5ec2
Author: Matt Juntunen <ma...@apache.org>
AuthorDate: Thu Jul 2 22:35:46 2020 -0400

    GEOMETRY-63: swapping assertion argument order
---
 .../java/org/apache/commons/geometry/spherical/oned/Point1STest.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java
index bda9046..e7c0284 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java
@@ -205,7 +205,7 @@ public class Point1STest {
         Assert.assertEquals(d, a);
 
         Assert.assertNotEquals(a, e);
-        Assert.assertEquals(e, Point1S.NaN);
+        Assert.assertEquals(Point1S.NaN, e);
     }
 
     @Test


[commons-geometry] 03/06: GEOMETRY-63: throwing NoSuchElementException in SimpleTriangleMesh Face iterator

Posted by ma...@apache.org.
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 d951410cba41f5ea5eadbdd9fb4d7a84c4074a4d
Author: Matt Juntunen <ma...@apache.org>
AuthorDate: Thu Jul 2 22:24:02 2020 -0400

    GEOMETRY-63: throwing NoSuchElementException in SimpleTriangleMesh Face iterator
---
 .../euclidean/threed/mesh/SimpleTriangleMesh.java  |  8 +++++--
 .../threed/mesh/SimpleTriangleMeshTest.java        | 27 ++++++++++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMesh.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMesh.java
index 11d30d3..5eae799 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMesh.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMesh.java
@@ -24,6 +24,7 @@ import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.NoSuchElementException;
 import java.util.Objects;
 import java.util.TreeMap;
 import java.util.function.Function;
@@ -398,8 +399,11 @@ public final class SimpleTriangleMesh implements TriangleMesh {
         /** {@inheritDoc} */
         @Override
         public T next() {
-            final Face face = getFace(index++);
-            return fn.apply(face);
+            if (hasNext()) {
+                final Face face = getFace(index++);
+                return fn.apply(face);
+            }
+            throw new NoSuchElementException();
         }
     }
 
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMeshTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMeshTest.java
index 8fafff8..68912d6 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMeshTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMeshTest.java
@@ -19,7 +19,9 @@ package org.apache.commons.geometry.euclidean.threed.mesh;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
+import java.util.NoSuchElementException;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
@@ -251,6 +253,31 @@ public class SimpleTriangleMeshTest {
     }
 
     @Test
+    public void testFaces_iterator() {
+        // arrange
+        final List<Vector3D> vertices = Arrays.asList(
+            Vector3D.ZERO,
+            Vector3D.of(1, 0, 0),
+            Vector3D.of(0, 1, 0)
+        );
+
+        final List<int[]> faceIndices = Arrays.asList(
+            new int[] {0, 1, 2}
+        );
+
+        final SimpleTriangleMesh mesh = SimpleTriangleMesh.from(vertices, faceIndices, TEST_PRECISION);
+
+        // act/assert
+        final Iterator<TriangleMesh.Face> it = mesh.faces().iterator();
+
+        Assert.assertTrue(it.hasNext());
+        Assert.assertEquals(0, it.next().getIndex());
+        Assert.assertFalse(it.hasNext());
+
+        GeometryTestUtils.assertThrows(() -> it.next(), NoSuchElementException.class);
+    }
+
+    @Test
     public void testTriangleStream() {
         // arrange
         final List<Vector3D> vertices = Arrays.asList(