You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2019/12/25 23:48:24 UTC

[commons-geometry] branch master updated: GEOMETRY-79: removing AttributeBSPTree and FunctionTransformXD from public API

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 012fc44  GEOMETRY-79: removing AttributeBSPTree and FunctionTransformXD from public API
     new de25ef6  Merge branch 'GEOMETRY-79__Matt'
012fc44 is described below

commit 012fc442275bb2c71fe0b185cce1d27c77a5bd97
Author: Matt Juntunen <ma...@hotmail.com>
AuthorDate: Wed Dec 25 13:21:36 2019 -0500

    GEOMETRY-79: removing AttributeBSPTree and FunctionTransformXD from public API
---
 .../core/partition/test}/AttributeBSPTree.java     |   3 +-
 .../bsp/AbstractBSPTreeMergeOperatorTest.java      |   3 +-
 .../partitioning/bsp/AttributeBSPTreeTest.java     | 219 ---------------------
 .../euclidean/oned/FunctionTransform1D.java        |   6 +-
 .../geometry/euclidean/oned/Transform1D.java       |  19 ++
 .../euclidean/threed/FunctionTransform3D.java      |   6 +-
 .../geometry/euclidean/threed/Transform3D.java     |  19 ++
 .../euclidean/twod/FunctionTransform2D.java        |   6 +-
 .../commons/geometry/euclidean/twod/Segment.java   |   4 +-
 .../geometry/euclidean/twod/Transform2D.java       |  19 ++
 .../euclidean/DocumentationExamplesTest.java       |   4 +-
 .../euclidean/oned/FunctionTransform1DTest.java    |  22 +--
 .../euclidean/threed/FunctionTransform3DTest.java  |  22 +--
 .../euclidean/twod/FunctionTransform2DTest.java    |  22 +--
 src/site/xdoc/userguide/index.xml                  |  36 ++--
 15 files changed, 127 insertions(+), 283 deletions(-)

diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AttributeBSPTree.java b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partition/test/AttributeBSPTree.java
similarity index 97%
rename from commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AttributeBSPTree.java
rename to commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partition/test/AttributeBSPTree.java
index 59c2874..09c8b6f 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AttributeBSPTree.java
+++ b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partition/test/AttributeBSPTree.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.geometry.core.partitioning.bsp;
+package org.apache.commons.geometry.core.partition.test;
 
 import org.apache.commons.geometry.core.Point;
+import org.apache.commons.geometry.core.partitioning.bsp.AbstractBSPTree;
 
 /** Simple {@link BSPTree} implementation allowing arbitrary values to be
  * associated with each node.
diff --git a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTreeMergeOperatorTest.java b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTreeMergeOperatorTest.java
index 8e25253..8d59095 100644
--- a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTreeMergeOperatorTest.java
+++ b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTreeMergeOperatorTest.java
@@ -18,10 +18,11 @@ package org.apache.commons.geometry.core.partitioning.bsp;
 
 import java.util.stream.StreamSupport;
 
+import org.apache.commons.geometry.core.partition.test.AttributeBSPTree;
 import org.apache.commons.geometry.core.partition.test.PartitionTestUtils;
 import org.apache.commons.geometry.core.partition.test.TestLine;
 import org.apache.commons.geometry.core.partition.test.TestPoint2D;
-import org.apache.commons.geometry.core.partitioning.bsp.AttributeBSPTree.AttributeNode;
+import org.apache.commons.geometry.core.partition.test.AttributeBSPTree.AttributeNode;
 import org.junit.Assert;
 import org.junit.Test;
 
diff --git a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partitioning/bsp/AttributeBSPTreeTest.java b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partitioning/bsp/AttributeBSPTreeTest.java
deleted file mode 100644
index 99b1606..0000000
--- a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partitioning/bsp/AttributeBSPTreeTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.geometry.core.partitioning.bsp;
-
-import java.util.Arrays;
-
-import org.apache.commons.geometry.core.partition.test.PartitionTestUtils;
-import org.apache.commons.geometry.core.partition.test.TestLine;
-import org.apache.commons.geometry.core.partition.test.TestLineSegment;
-import org.apache.commons.geometry.core.partition.test.TestPoint2D;
-import org.apache.commons.geometry.core.partitioning.bsp.AttributeBSPTree.AttributeNode;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class AttributeBSPTreeTest {
-
-    @Test
-    public void testInitialization() {
-        // act
-        AttributeBSPTree<TestPoint2D, String> tree = new AttributeBSPTree<TestPoint2D, String>();
-
-        // assert
-        AttributeNode<TestPoint2D, String> root = tree.getRoot();
-
-        Assert.assertNotNull(root);
-        Assert.assertNull(root.getParent());
-        Assert.assertNull(root.getAttribute());
-
-        PartitionTestUtils.assertIsLeafNode(root);
-        Assert.assertFalse(root.isPlus());
-        Assert.assertFalse(root.isMinus());
-
-        Assert.assertSame(tree, root.getTree());
-    }
-
-    @Test
-    public void testInitialNodeValue_null() {
-        // arrange
-        AttributeBSPTree<TestPoint2D, String> tree = new AttributeBSPTree<TestPoint2D, String>();
-        tree.getRoot().cut(TestLine.X_AXIS);
-
-        // act/assert
-        Assert.assertNull(tree.getRoot().getAttribute());
-        Assert.assertNull(tree.getRoot().getPlus().getAttribute());
-        Assert.assertNull(tree.getRoot().getMinus().getAttribute());
-    }
-
-    @Test
-    public void testInitialNodeValue_givenValue() {
-        // arrange
-        AttributeBSPTree<TestPoint2D, String> tree = new AttributeBSPTree<TestPoint2D, String>("a");
-        tree.getRoot().cut(TestLine.X_AXIS);
-
-        // act/assert
-        Assert.assertEquals("a", tree.getRoot().getAttribute());
-        Assert.assertEquals("a", tree.getRoot().getPlus().getAttribute());
-        Assert.assertEquals("a", tree.getRoot().getMinus().getAttribute());
-    }
-
-    @Test
-    public void testSetAttribute_node() {
-        // arrange
-        AttributeBSPTree<TestPoint2D, String> tree = new AttributeBSPTree<TestPoint2D, String>();
-        AttributeNode<TestPoint2D, String> root = tree.getRoot();
-
-        // act
-        root.setAttribute("a");
-
-        // assert
-        Assert.assertEquals("a", root.getAttribute());
-    }
-
-    @Test
-    public void testAttr_node() {
-        // arrange
-        AttributeBSPTree<TestPoint2D, String> tree = new AttributeBSPTree<TestPoint2D, String>();
-        AttributeNode<TestPoint2D, String> root = tree.getRoot();
-
-        // act
-        AttributeNode<TestPoint2D, String> result = root.attr("a");
-
-        // assert
-        Assert.assertSame(root, result);
-        Assert.assertEquals("a", root.getAttribute());
-    }
-
-    @Test
-    public void testCopy_rootOnly() {
-        // arrange
-        AttributeBSPTree<TestPoint2D, String> tree = new AttributeBSPTree<TestPoint2D, String>();
-        tree.getRoot().attr("abc");
-
-        // act
-        AttributeBSPTree<TestPoint2D, String> copy = new AttributeBSPTree<>();
-        copy.copy(tree);
-
-        // assert
-        Assert.assertEquals(1, copy.count());
-        Assert.assertEquals("abc", copy.getRoot().getAttribute());
-    }
-
-    @Test
-    public void testCopy_withCuts() {
-        // arrange
-        AttributeBSPTree<TestPoint2D, String> tree = new AttributeBSPTree<TestPoint2D, String>();
-        tree.insert(Arrays.asList(
-                new TestLineSegment(TestPoint2D.ZERO, new TestPoint2D(1, 0)),
-                new TestLineSegment(TestPoint2D.ZERO, new TestPoint2D(0, 1))
-                ));
-
-        tree.findNode(new TestPoint2D(1, 1)).attr("a");
-        tree.findNode(new TestPoint2D(-1, 1)).attr("b");
-        tree.findNode(new TestPoint2D(0, -1)).attr("c");
-
-        // act
-        AttributeBSPTree<TestPoint2D, String> copy = new AttributeBSPTree<>();
-        copy.copy(tree);
-
-        // assert
-        Assert.assertEquals(5, copy.count());
-        Assert.assertEquals("a", copy.findNode(new TestPoint2D(1, 1)).getAttribute());
-        Assert.assertEquals("b", copy.findNode(new TestPoint2D(-1, 1)).getAttribute());
-        Assert.assertEquals("c", copy.findNode(new TestPoint2D(0, -1)).getAttribute());
-    }
-
-    @Test
-    public void testExtract() {
-        // arrange
-        AttributeBSPTree<TestPoint2D, String> tree = new AttributeBSPTree<TestPoint2D, String>();
-        tree.insert(Arrays.asList(
-                new TestLineSegment(new TestPoint2D(-1, -1), new TestPoint2D(1, 1)),
-                new TestLineSegment(new TestPoint2D(-1, 1), new TestPoint2D(1, -1)),
-
-                new TestLineSegment(new TestPoint2D(-1, 3), new TestPoint2D(1, 3)),
-                new TestLineSegment(new TestPoint2D(3, 1), new TestPoint2D(3, -1)),
-                new TestLineSegment(new TestPoint2D(1, -3), new TestPoint2D(-1, -3)),
-                new TestLineSegment(new TestPoint2D(-3, -1), new TestPoint2D(-3, 1))
-                ));
-
-        AttributeNode<TestPoint2D, String> root = tree.getRoot();
-
-        root.attr("R");
-        root.getMinus().attr("A");
-        root.getPlus().attr("B");
-
-        root.getMinus().getMinus().nodes().forEach(n -> n.attr("a"));
-        root.getMinus().getPlus().nodes().forEach(n -> n.attr("b"));
-
-        root.getPlus().getPlus().nodes().forEach(n -> n.attr("c"));
-        root.getPlus().getMinus().nodes().forEach(n -> n.attr("d"));
-
-        AttributeBSPTree<TestPoint2D, String> result = new AttributeBSPTree<>();
-
-        // act
-        result.extract(tree.findNode(new TestPoint2D(0, 1)));
-
-        // assert
-        Assert.assertEquals(7, result.count());
-        Assert.assertEquals(15, tree.count());
-
-        // check result tree attributes
-        AttributeNode<TestPoint2D, String> resultRoot = result.getRoot();
-        Assert.assertEquals("R", resultRoot.getAttribute());
-        Assert.assertEquals("A", resultRoot.getMinus().getAttribute());
-        Assert.assertEquals("B", resultRoot.getPlus().getAttribute());
-
-        Assert.assertEquals("a", resultRoot.getMinus().getMinus().getAttribute());
-        Assert.assertEquals("b", resultRoot.getMinus().getPlus().getAttribute());
-
-        Assert.assertEquals(2, resultRoot.getMinus().height());
-        Assert.assertEquals(0, resultRoot.getPlus().height());
-
-        PartitionTestUtils.assertTreeStructure(result);
-
-        // check original tree attributes
-        Assert.assertEquals("R", root.getAttribute());
-        Assert.assertEquals("A", root.getMinus().getAttribute());
-        Assert.assertEquals("B", root.getPlus().getAttribute());
-
-        Assert.assertEquals("a", root.getMinus().getMinus().getAttribute());
-        Assert.assertEquals("b", root.getMinus().getPlus().getAttribute());
-        Assert.assertEquals("c", root.getPlus().getPlus().getAttribute());
-        Assert.assertEquals("d", root.getPlus().getMinus().getAttribute());
-
-        Assert.assertEquals(2, root.getMinus().height());
-        Assert.assertEquals(2, root.getPlus().height());
-
-        PartitionTestUtils.assertTreeStructure(tree);
-    }
-
-    @Test
-    public void testNodeToString() {
-        // arrange
-        AttributeBSPTree<TestPoint2D, String> tree = new AttributeBSPTree<TestPoint2D, String>();
-        tree.getRoot().cut(TestLine.X_AXIS).attr("abc");
-
-        // act
-        String str = tree.getRoot().toString();
-
-        // assert
-        Assert.assertTrue(str.contains("AttributeNode"));
-        Assert.assertTrue(str.contains("cut= TestLineSegment"));
-        Assert.assertTrue(str.contains("attribute= abc"));
-    }
-}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/FunctionTransform1D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/FunctionTransform1D.java
index 056f8cc..e63cc43 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/FunctionTransform1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/FunctionTransform1D.java
@@ -20,7 +20,7 @@ import java.util.function.UnaryOperator;
 
 /** Class that wraps a {@link UnaryOperator} with the {@link Transform1D} interface.
  */
-public final class FunctionTransform1D implements Transform1D {
+final class FunctionTransform1D implements Transform1D {
 
     /** Static instance representing the identity transform. */
     private static final FunctionTransform1D IDENTITY =
@@ -76,7 +76,7 @@ public final class FunctionTransform1D implements Transform1D {
     /** Return an instance representing the identity transform.
      * @return an instance representing the identity transform
      */
-    public static FunctionTransform1D identity() {
+    static FunctionTransform1D identity() {
         return IDENTITY;
     }
 
@@ -84,7 +84,7 @@ public final class FunctionTransform1D implements Transform1D {
      * @param fn the function to use for the transform
      * @return a new transform instance using the given function
      */
-    public static FunctionTransform1D from(final UnaryOperator<Vector1D> fn) {
+    static FunctionTransform1D from(final UnaryOperator<Vector1D> fn) {
         final Vector1D tOne = fn.apply(Vector1D.Unit.PLUS);
         final Vector1D tZero = fn.apply(Vector1D.ZERO);
 
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Transform1D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Transform1D.java
index 1f0eac1..a85b4ca 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Transform1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Transform1D.java
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.geometry.euclidean.oned;
 
+import java.util.function.UnaryOperator;
+
 import org.apache.commons.geometry.euclidean.EuclideanTransform;
 
 /** Extension of the {@link EuclideanTransform} interface for 1D space.
@@ -28,4 +30,21 @@ public interface Transform1D extends EuclideanTransform<Vector1D> {
      *      as this instance
      */
     AffineTransformMatrix1D toMatrix();
+
+    /** Return a transform representing the identity transform.
+     * @return a transform representing the identity transform
+     */
+    static Transform1D identity() {
+        return FunctionTransform1D.identity();
+    }
+
+    /** Construct a transform instance from the given function. Callers are responsible for
+     * ensuring that the given function meets all the requirements for
+     * {@link org.apache.commons.geometry.core.Transform Transform} instances.
+     * @param fn the function to use for the transform
+     * @return a new transform instance using the given function
+     */
+    static Transform1D from(final UnaryOperator<Vector1D> fn) {
+        return FunctionTransform1D.from(fn);
+    }
 }
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/FunctionTransform3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/FunctionTransform3D.java
index 0bd7630..2cc52cd 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/FunctionTransform3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/FunctionTransform3D.java
@@ -22,7 +22,7 @@ import org.apache.commons.geometry.euclidean.internal.Matrices;
 
 /** Class that wraps a {@link UnaryOperator} with the {@link Transform3D} interface.
  */
-public final class FunctionTransform3D implements Transform3D {
+final class FunctionTransform3D implements Transform3D {
 
     /** Static instance representing the identity transform. */
     private static final FunctionTransform3D IDENTITY =
@@ -80,7 +80,7 @@ public final class FunctionTransform3D implements Transform3D {
     /** Return an instance representing the identity transform.
      * @return an instance representing the identity transform
      */
-    public static FunctionTransform3D identity() {
+    static FunctionTransform3D identity() {
         return IDENTITY;
     }
 
@@ -88,7 +88,7 @@ public final class FunctionTransform3D implements Transform3D {
      * @param fn the function to use for the transform
      * @return a new transform instance using the given function
      */
-    public static FunctionTransform3D from(final UnaryOperator<Vector3D> fn) {
+    static FunctionTransform3D from(final UnaryOperator<Vector3D> fn) {
         final Vector3D tPlusX = fn.apply(Vector3D.Unit.PLUS_X);
         final Vector3D tPlusY = fn.apply(Vector3D.Unit.PLUS_Y);
         final Vector3D tPlusZ = fn.apply(Vector3D.Unit.PLUS_Z);
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Transform3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Transform3D.java
index 493a70a..20bbcdb 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Transform3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Transform3D.java
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.geometry.euclidean.threed;
 
+import java.util.function.UnaryOperator;
+
 import org.apache.commons.geometry.euclidean.EuclideanTransform;
 
 /** Extension of the {@link EuclideanTransform} interface for 3D points.
@@ -28,4 +30,21 @@ public interface Transform3D extends EuclideanTransform<Vector3D> {
      *      as this instance
      */
     AffineTransformMatrix3D toMatrix();
+
+    /** Return a transform representing the identity transform.
+     * @return a transform representing the identity transform
+     */
+    static Transform3D identity() {
+        return FunctionTransform3D.identity();
+    }
+
+    /** Construct a transform instance from the given function. Callers are responsible for
+     * ensuring that the given function meets all the requirements for
+     * {@link org.apache.commons.geometry.core.Transform Transform} instances.
+     * @param fn the function to use for the transform
+     * @return a new transform instance using the given function
+     */
+    static Transform3D from(final UnaryOperator<Vector3D> fn) {
+        return FunctionTransform3D.from(fn);
+    }
 }
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/FunctionTransform2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/FunctionTransform2D.java
index 15fc7bb..03ff639 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/FunctionTransform2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/FunctionTransform2D.java
@@ -22,7 +22,7 @@ import org.apache.commons.geometry.euclidean.internal.Matrices;
 
 /** Class that wraps a {@link UnaryOperator} with the {@link Transform2D} interface.
  */
-public final class FunctionTransform2D implements Transform2D {
+final class FunctionTransform2D implements Transform2D {
 
     /** Static instance representing the identity transform. */
     private static final FunctionTransform2D IDENTITY =
@@ -79,7 +79,7 @@ public final class FunctionTransform2D implements Transform2D {
     /** Return an instance representing the identity transform.
      * @return an instance representing the identity transform
      */
-    public static FunctionTransform2D identity() {
+    static FunctionTransform2D identity() {
         return IDENTITY;
     }
 
@@ -87,7 +87,7 @@ public final class FunctionTransform2D implements Transform2D {
      * @param fn the function to use for the transform
      * @return a new transform instance using the given function
      */
-    public static FunctionTransform2D from(final UnaryOperator<Vector2D> fn) {
+    static FunctionTransform2D from(final UnaryOperator<Vector2D> fn) {
         final Vector2D tPlusX = fn.apply(Vector2D.Unit.PLUS_X);
         final Vector2D tPlusY = fn.apply(Vector2D.Unit.PLUS_Y);
         final Vector2D tZero = fn.apply(Vector2D.ZERO);
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Segment.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Segment.java
index b636206..756bdfe 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Segment.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Segment.java
@@ -24,8 +24,8 @@ import org.apache.commons.geometry.core.partitioning.ConvexSubHyperplane;
 import org.apache.commons.geometry.core.partitioning.Hyperplane;
 import org.apache.commons.geometry.core.partitioning.Split;
 import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
-import org.apache.commons.geometry.euclidean.oned.FunctionTransform1D;
 import org.apache.commons.geometry.euclidean.oned.Interval;
+import org.apache.commons.geometry.euclidean.oned.Transform1D;
 import org.apache.commons.geometry.euclidean.oned.Vector1D;
 import org.apache.commons.geometry.euclidean.twod.Line.SubspaceTransform;
 
@@ -174,7 +174,7 @@ public final class Segment extends AbstractSubLine
     /** {@inheritDoc} */
     @Override
     public Segment reverse() {
-        final Interval reversedInterval = interval.transform(FunctionTransform1D.from(Vector1D::negate));
+        final Interval reversedInterval = interval.transform(Transform1D.from(Vector1D::negate));
         return fromInterval(getLine().reverse(), reversedInterval);
     }
 
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Transform2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Transform2D.java
index 94f8a4e..b6c5da6 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Transform2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Transform2D.java
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.geometry.euclidean.twod;
 
+import java.util.function.UnaryOperator;
+
 import org.apache.commons.geometry.euclidean.EuclideanTransform;
 
 /** Extension of the {@link EuclideanTransform} interface for 2D space.
@@ -28,4 +30,21 @@ public interface Transform2D extends EuclideanTransform<Vector2D> {
      *      as this instance
      */
     AffineTransformMatrix2D toMatrix();
+
+    /** Return a transform representing the identity transform.
+     * @return a transform representing the identity transform
+     */
+    static Transform2D identity() {
+        return FunctionTransform2D.identity();
+    }
+
+    /** Construct a transform instance from the given function. Callers are responsible for
+     * ensuring that the given function meets all the requirements for
+     * {@link org.apache.commons.geometry.core.Transform Transform} instances.
+     * @param fn the function to use for the transform
+     * @return a new transform instance using the given function
+     */
+    static Transform2D from(final UnaryOperator<Vector2D> fn) {
+        return FunctionTransform2D.from(fn);
+    }
 }
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/DocumentationExamplesTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/DocumentationExamplesTest.java
index cf6818e..d234e56 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/DocumentationExamplesTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/DocumentationExamplesTest.java
@@ -36,11 +36,11 @@ import org.apache.commons.geometry.euclidean.threed.RegionBSPTree3D;
 import org.apache.commons.geometry.euclidean.threed.Transform3D;
 import org.apache.commons.geometry.euclidean.threed.Vector3D;
 import org.apache.commons.geometry.euclidean.threed.rotation.QuaternionRotation;
-import org.apache.commons.geometry.euclidean.twod.FunctionTransform2D;
 import org.apache.commons.geometry.euclidean.twod.Line;
 import org.apache.commons.geometry.euclidean.twod.Polyline;
 import org.apache.commons.geometry.euclidean.twod.RegionBSPTree2D;
 import org.apache.commons.geometry.euclidean.twod.Segment;
+import org.apache.commons.geometry.euclidean.twod.Transform2D;
 import org.apache.commons.geometry.euclidean.twod.Vector2D;
 import org.apache.commons.numbers.angle.PlaneAngleRadians;
 import org.junit.Assert;
@@ -267,7 +267,7 @@ public class DocumentationExamplesTest {
 
         // translate the copy
         Vector2D translation = Vector2D.of(0.5, 0.5);
-        copy.transform(FunctionTransform2D.from(v -> v.add(translation)));
+        copy.transform(Transform2D.from(v -> v.add(translation)));
 
         // compute the union of the regions, storing the result back into the
         // first tree
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/FunctionTransform1DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/FunctionTransform1DTest.java
index a268a84..01fb3a8 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/FunctionTransform1DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/FunctionTransform1DTest.java
@@ -34,7 +34,7 @@ public class FunctionTransform1DTest {
         Vector1D p2 = Vector1D.of(-1);
 
         // act
-        Transform1D t = FunctionTransform1D.identity();
+        Transform1D t = Transform1D.identity();
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -52,7 +52,7 @@ public class FunctionTransform1DTest {
         Vector1D p2 = Vector1D.of(-1);
 
         // act
-        Transform1D t = FunctionTransform1D.from(UnaryOperator.identity());
+        Transform1D t = Transform1D.from(UnaryOperator.identity());
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -70,7 +70,7 @@ public class FunctionTransform1DTest {
         Vector1D p2 = Vector1D.of(-1);
 
         // act
-        Transform1D t = FunctionTransform1D.from(v -> Vector1D.of((v.getX() + 2) * 3));
+        Transform1D t = Transform1D.from(v -> Vector1D.of((v.getX() + 2) * 3));
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -88,7 +88,7 @@ public class FunctionTransform1DTest {
         Vector1D p2 = Vector1D.of(-1);
 
         // act
-        Transform1D t = FunctionTransform1D.from(Vector1D::negate);
+        Transform1D t = Transform1D.from(Vector1D::negate);
 
         // assert
         Assert.assertFalse(t.preservesOrientation());
@@ -101,7 +101,7 @@ public class FunctionTransform1DTest {
     @Test
     public void testApply() {
         // arrange
-        Transform1D t = FunctionTransform1D.from(v -> {
+        Transform1D t = Transform1D.from(v -> {
             double x = v.getX();
             return Vector1D.of((-2 * x) + 1);
         });
@@ -117,7 +117,7 @@ public class FunctionTransform1DTest {
     @Test
     public void testApplyVector() {
         // arrange
-        Transform1D t = FunctionTransform1D.from(v -> {
+        Transform1D t = Transform1D.from(v -> {
             double x = v.getX();
             return Vector1D.of((-2 * x) + 1);
         });
@@ -134,13 +134,13 @@ public class FunctionTransform1DTest {
     public void testToMatrix() {
         // act/assert
         Assert.assertArrayEquals(new double[] {1, 0},
-                FunctionTransform1D.identity().toMatrix().toArray(), TEST_EPS);
+                Transform1D.identity().toMatrix().toArray(), TEST_EPS);
         Assert.assertArrayEquals(new double[] {1, 2},
-                FunctionTransform1D.from(v -> v.add(Vector1D.of(2))).toMatrix().toArray(), TEST_EPS);
+                Transform1D.from(v -> v.add(Vector1D.of(2))).toMatrix().toArray(), TEST_EPS);
         Assert.assertArrayEquals(new double[] {3, 0},
-                FunctionTransform1D.from(v -> v.multiply(3)).toMatrix().toArray(), TEST_EPS);
+                Transform1D.from(v -> v.multiply(3)).toMatrix().toArray(), TEST_EPS);
         Assert.assertArrayEquals(new double[] {3, 6},
-                FunctionTransform1D.from(v -> v.add(Vector1D.of(2)).multiply(3)).toMatrix().toArray(), TEST_EPS);
+                Transform1D.from(v -> v.add(Vector1D.of(2)).multiply(3)).toMatrix().toArray(), TEST_EPS);
     }
 
     @Test
@@ -155,7 +155,7 @@ public class FunctionTransform1DTest {
 
         EuclideanTestUtils.permuteSkipZero(-2, 2, delta, (translate, scale) -> {
 
-            FunctionTransform1D t = FunctionTransform1D.from(v -> {
+            Transform1D t = Transform1D.from(v -> {
                 return v.multiply(scale * 0.5)
                     .add(Vector1D.of(translate))
                     .multiply(scale * 1.5);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/FunctionTransform3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/FunctionTransform3DTest.java
index 7c7a8ba..7a59b53 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/FunctionTransform3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/FunctionTransform3DTest.java
@@ -34,7 +34,7 @@ public class FunctionTransform3DTest {
         Vector3D p2 = Vector3D.of(-1, -1, -1);
 
         // act
-        FunctionTransform3D t = FunctionTransform3D.identity();
+        Transform3D t = Transform3D.identity();
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -52,7 +52,7 @@ public class FunctionTransform3DTest {
         Vector3D p2 = Vector3D.of(-1, -1, -1);
 
         // act
-        FunctionTransform3D t = FunctionTransform3D.from(UnaryOperator.identity());
+        Transform3D t = Transform3D.from(UnaryOperator.identity());
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -70,7 +70,7 @@ public class FunctionTransform3DTest {
         Vector3D p2 = Vector3D.of(-1, -2, -3);
 
         // act
-        FunctionTransform3D t = FunctionTransform3D.from(v -> v.multiply(2).add(Vector3D.of(1, -1, 2)));
+        Transform3D t = Transform3D.from(v -> v.multiply(2).add(Vector3D.of(1, -1, 2)));
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -88,7 +88,7 @@ public class FunctionTransform3DTest {
         Vector3D p2 = Vector3D.of(-1, -2, -3);
 
         // act
-        FunctionTransform3D t = FunctionTransform3D.from(v -> Vector3D.of(-v.getX(), v.getY(), v.getZ()));
+        Transform3D t = Transform3D.from(v -> Vector3D.of(-v.getX(), v.getY(), v.getZ()));
 
         // assert
         Assert.assertFalse(t.preservesOrientation());
@@ -106,7 +106,7 @@ public class FunctionTransform3DTest {
         Vector3D p2 = Vector3D.of(-1, -2, -3);
 
         // act
-        FunctionTransform3D t = FunctionTransform3D.from(v -> Vector3D.of(-v.getX(), -v.getY(), v.getZ()));
+        Transform3D t = Transform3D.from(v -> Vector3D.of(-v.getX(), -v.getY(), v.getZ()));
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -124,7 +124,7 @@ public class FunctionTransform3DTest {
         Vector3D p2 = Vector3D.of(-1, -2, -3);
 
         // act
-        FunctionTransform3D t = FunctionTransform3D.from(Vector3D::negate);
+        Transform3D t = Transform3D.from(Vector3D::negate);
 
         // assert
         Assert.assertFalse(t.preservesOrientation());
@@ -141,22 +141,22 @@ public class FunctionTransform3DTest {
             1, 0, 0, 0,
             0, 1, 0, 0,
             0, 0, 1, 0
-        }, FunctionTransform3D.identity().toMatrix().toArray(), TEST_EPS);
+        }, Transform3D.identity().toMatrix().toArray(), TEST_EPS);
         Assert.assertArrayEquals(new double[] {
             1, 0, 0, 2,
             0, 1, 0, 3,
             0, 0, 1, -4
-        }, FunctionTransform3D.from(v -> v.add(Vector3D.of(2, 3, -4))).toMatrix().toArray(), TEST_EPS);
+        }, Transform3D.from(v -> v.add(Vector3D.of(2, 3, -4))).toMatrix().toArray(), TEST_EPS);
         Assert.assertArrayEquals(new double[] {
             3, 0, 0, 0,
             0, 3, 0, 0,
             0, 0, 3, 0
-        }, FunctionTransform3D.from(v -> v.multiply(3)).toMatrix().toArray(), TEST_EPS);
+        }, Transform3D.from(v -> v.multiply(3)).toMatrix().toArray(), TEST_EPS);
         Assert.assertArrayEquals(new double[] {
             3, 0, 0, 6,
             0, 3, 0, 9,
             0, 0, 3, 12
-        }, FunctionTransform3D.from(v -> v.add(Vector3D.of(2, 3, 4)).multiply(3)).toMatrix().toArray(), TEST_EPS);
+        }, Transform3D.from(v -> v.add(Vector3D.of(2, 3, 4)).multiply(3)).toMatrix().toArray(), TEST_EPS);
     }
 
     @Test
@@ -171,7 +171,7 @@ public class FunctionTransform3DTest {
 
         EuclideanTestUtils.permuteSkipZero(-2, 2, delta, (translate, scale) -> {
 
-            FunctionTransform3D t = FunctionTransform3D.from(v -> {
+            Transform3D t = Transform3D.from(v -> {
                 return v.multiply(scale * 0.5)
                     .add(Vector3D.of(translate, 0.5 * translate, 0.25 * translate))
                     .multiply(scale * 1.5);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/FunctionTransform2DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/FunctionTransform2DTest.java
index 848553e..99da23d 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/FunctionTransform2DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/FunctionTransform2DTest.java
@@ -34,7 +34,7 @@ public class FunctionTransform2DTest {
         Vector2D p2 = Vector2D.of(-1, -1);
 
         // act
-        FunctionTransform2D t = FunctionTransform2D.identity();
+        Transform2D t = Transform2D.identity();
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -52,7 +52,7 @@ public class FunctionTransform2DTest {
         Vector2D p2 = Vector2D.of(-1, -1);
 
         // act
-        FunctionTransform2D t = FunctionTransform2D.from(UnaryOperator.identity());
+        Transform2D t = Transform2D.from(UnaryOperator.identity());
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -70,7 +70,7 @@ public class FunctionTransform2DTest {
         Vector2D p2 = Vector2D.of(-1, -2);
 
         // act
-        FunctionTransform2D t = FunctionTransform2D.from(v -> v.multiply(2).add(Vector2D.of(1, -1)));
+        Transform2D t = Transform2D.from(v -> v.multiply(2).add(Vector2D.of(1, -1)));
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -88,7 +88,7 @@ public class FunctionTransform2DTest {
         Vector2D p2 = Vector2D.of(-1, -2);
 
         // act
-        FunctionTransform2D t = FunctionTransform2D.from(v -> Vector2D.of(-v.getX(), v.getY()));
+        Transform2D t = Transform2D.from(v -> Vector2D.of(-v.getX(), v.getY()));
 
         // assert
         Assert.assertFalse(t.preservesOrientation());
@@ -106,7 +106,7 @@ public class FunctionTransform2DTest {
         Vector2D p2 = Vector2D.of(-1, -2);
 
         // act
-        FunctionTransform2D t = FunctionTransform2D.from(Vector2D::negate);
+        Transform2D t = Transform2D.from(Vector2D::negate);
 
         // assert
         Assert.assertTrue(t.preservesOrientation());
@@ -119,7 +119,7 @@ public class FunctionTransform2DTest {
     @Test
     public void testApplyVector() {
         // arrange
-        Transform2D t = FunctionTransform2D.from(v -> {
+        Transform2D t = Transform2D.from(v -> {
             return v.multiply(-2).add(Vector2D.of(4, 5));
         });
 
@@ -137,19 +137,19 @@ public class FunctionTransform2DTest {
         Assert.assertArrayEquals(new double[] {
             1, 0, 0,
             0, 1, 0
-        }, FunctionTransform2D.identity().toMatrix().toArray(), TEST_EPS);
+        }, Transform2D.identity().toMatrix().toArray(), TEST_EPS);
         Assert.assertArrayEquals(new double[] {
             1, 0, 2,
             0, 1, 3
-        }, FunctionTransform2D.from(v -> v.add(Vector2D.of(2, 3))).toMatrix().toArray(), TEST_EPS);
+        }, Transform2D.from(v -> v.add(Vector2D.of(2, 3))).toMatrix().toArray(), TEST_EPS);
         Assert.assertArrayEquals(new double[] {
             3, 0, 0,
             0, 3, 0
-        }, FunctionTransform2D.from(v -> v.multiply(3)).toMatrix().toArray(), TEST_EPS);
+        }, Transform2D.from(v -> v.multiply(3)).toMatrix().toArray(), TEST_EPS);
         Assert.assertArrayEquals(new double[] {
             3, 0, 6,
             0, 3, 9
-        }, FunctionTransform2D.from(v -> v.add(Vector2D.of(2, 3)).multiply(3)).toMatrix().toArray(), TEST_EPS);
+        }, Transform2D.from(v -> v.add(Vector2D.of(2, 3)).multiply(3)).toMatrix().toArray(), TEST_EPS);
     }
 
     @Test
@@ -164,7 +164,7 @@ public class FunctionTransform2DTest {
 
         EuclideanTestUtils.permuteSkipZero(-2, 2, delta, (translate, scale) -> {
 
-            FunctionTransform2D t = FunctionTransform2D.from(v -> {
+            Transform2D t = Transform2D.from(v -> {
                 return v.multiply(scale * 0.5)
                     .add(Vector2D.of(translate, 0.5 * translate))
                     .multiply(scale * 1.5);
diff --git a/src/site/xdoc/userguide/index.xml b/src/site/xdoc/userguide/index.xml
index 1bc5f90..98442d1 100644
--- a/src/site/xdoc/userguide/index.xml
+++ b/src/site/xdoc/userguide/index.xml
@@ -428,14 +428,16 @@ tree.count(); // number of nodes in the tree = 7
             Transform
             <ul>
               <li>
-                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1D.html">AffineTransformMatrix1D</a> -
-                Represents transforms using a 2x2 matrix.
+                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/oned/Transform1D.html">Transform1D</a> -
+                Primary interface for 1D transforms. A utility method is also provided to construct transform instances
+                from JDK <span class="code">Function</span>'s. Callers are responsible for ensuring that given functions
+                meet the <a href="#transforms">requirements for transforms</a>.
               </li>
               <li>
-                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/oned/FunctionTransform1D.html">FunctionTransform1D</a> -
-                Adapter class that allows simple JDK <span class="code">Function</span>'s to be used as transforms.
-                Callers are responsible for ensuring that given functions meet the <a href="#transforms">requirements for transforms</a>.
+                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/oned/AffineTransformMatrix1D.html">AffineTransformMatrix1D</a> -
+                Represents transforms using a 2x2 matrix.
               </li>
+
             </ul>
           </li>
         </ul>
@@ -517,13 +519,14 @@ List&lt;Interval&gt; intervals = tree.toIntervals(); // size = 2
             Transform
             <ul>
               <li>
-                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/twod/AffineTransformMatrix2D.html">AffineTransformMatrix2D</a> -
-                Represents transforms using a 3x3 matrix.
+                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/twod/Transform2D.html">Transform2D</a> -
+                Primary interface for 2D transforms. A utility method is also provided to construct transform instances
+                from JDK <span class="code">Function</span>'s. Callers are responsible for ensuring that given functions
+                meet the <a href="#transforms">requirements for transforms</a>.
               </li>
               <li>
-                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/twod/FunctionTransform2D.html">FunctionTransform2D</a> -
-                Adapter class that allows simple JDK <span class="code">Function</span>'s to be used as transforms.
-                Callers are responsible for ensuring that given functions meet the <a href="#transforms">requirements for transforms</a> .
+                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/twod/AffineTransformMatrix2D.html">AffineTransformMatrix2D</a> -
+                Represents transforms using a 3x3 matrix.
               </li>
             </ul>
           </li>
@@ -589,7 +592,7 @@ RegionBSPTree2D copy = tree.copy();
 
 // translate the copy
 Vector2D translation = Vector2D.of(0.5, 0.5);
-copy.transform(FunctionTransform2D.from(v -> v.add(translation)));
+copy.transform(Transform2D.from(v -> v.add(translation)));
 
 // compute the union of the regions, storing the result back into the
 // first tree
@@ -642,13 +645,14 @@ List&lt;Polyline&gt; boundaries = tree.getBoundaryPaths(); // size = 1
             Transform
             <ul>
               <li>
-                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/threed/AffineTransformMatrix3D.html">AffineTransformMatrix3D</a> -
-                Represents transforms using a 4x4 matrix.
+                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/threed/Transform3D.html">Transform3D</a> -
+                Primary interface for 3D transforms. A utility method is also provided to construct transform instances
+                from JDK <span class="code">Function</span>'s. Callers are responsible for ensuring that given functions
+                meet the <a href="#transforms">requirements for transforms</a>.
               </li>
               <li>
-                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/threed/FunctionTransform3D.html">FunctionTransform3D</a> -
-                Adapter class that allows simple JDK <span class="code">Function</span>'s to be used as transforms.
-                Callers are responsible for ensuring that given functions meet the <a href="#transforms">requirements for transforms</a>.
+                <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/threed/AffineTransformMatrix3D.html">AffineTransformMatrix3D</a> -
+                Represents transforms using a 4x4 matrix.
               </li>
               <li>
                 <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.html">QuaternionRotation</a> -