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 7fd257e  GEOMETRY-27: refactoring and cleaning up OrientedPoint class; 
adding GeometryValueException to encapsulate idea of a programatically correct 
input that evaluates to an invalid geometric value
     new 9b78c2a  Merge branch 'GEOMETRY-27__matt'
7fd257e is described below

commit 7fd257e708a28d47b9af988a76b9ca460b0f01a0
Author: Matt Juntunen <[email protected]>
AuthorDate: Sun Feb 10 09:26:22 2019 -0500

    GEOMETRY-27: refactoring and cleaning up OrientedPoint class; adding 
GeometryValueException to encapsulate idea of a programatically correct input 
that evaluates to an invalid geometric value
---
 ...mException.java => GeometryValueException.java} |  21 +-
 .../core/exception/IllegalNormException.java       |   2 +-
 .../geometry/euclidean/oned/IntervalsSet.java      |  12 +-
 .../geometry/euclidean/oned/OrientedPoint.java     | 186 +++++++++++--
 .../commons/geometry/euclidean/twod/Line.java      |   2 +-
 .../commons/geometry/euclidean/twod/SubLine.java   |   4 +-
 .../geometry/euclidean/EuclideanTestUtils.java     |   6 +-
 .../geometry/euclidean/oned/IntervalsSetTest.java  |   2 +-
 .../geometry/euclidean/oned/OrientedPointTest.java | 294 +++++++++++++++++----
 .../euclidean/oned/SubOrientedPointTest.java       |  30 +--
 10 files changed, 435 insertions(+), 124 deletions(-)

diff --git 
a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/exception/IllegalNormException.java
 
b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/exception/GeometryValueException.java
similarity index 63%
copy from 
commons-geometry-core/src/main/java/org/apache/commons/geometry/core/exception/IllegalNormException.java
copy to 
commons-geometry-core/src/main/java/org/apache/commons/geometry/core/exception/GeometryValueException.java
index 26fc11c..a5f7d3f 100644
--- 
a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/exception/IllegalNormException.java
+++ 
b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/exception/GeometryValueException.java
@@ -16,25 +16,18 @@
  */
 package org.apache.commons.geometry.core.exception;
 
-/** Exception thrown when an illegal vector norm value is encountered
- * in an operation.
+/** Exception thrown to indicate that a value used in a geometric operation
+ * is not valid.
  */
-public class IllegalNormException extends GeometryException {
+public class GeometryValueException extends GeometryException {
 
     /** Serializable version identifier */
-    private static final long serialVersionUID = 20180909L;
+    private static final long serialVersionUID = 20190210L;
 
-    /** Simple constructor accepting the illegal norm value.
-     * @param norm the illegal norm value
+    /** Simple constructor with error message.
+     * @param msg exception message string
      */
-    public IllegalNormException(double norm) {
-        super("Illegal norm: " + norm);
-    }
-
-    /** Constructor accepting an error message.
-     * @param msg the error message
-     */
-    public IllegalNormException(String msg) {
+    public GeometryValueException(String msg) {
         super(msg);
     }
 }
diff --git 
a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/exception/IllegalNormException.java
 
b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/exception/IllegalNormException.java
index 26fc11c..6993704 100644
--- 
a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/exception/IllegalNormException.java
+++ 
b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/exception/IllegalNormException.java
@@ -19,7 +19,7 @@ package org.apache.commons.geometry.core.exception;
 /** Exception thrown when an illegal vector norm value is encountered
  * in an operation.
  */
-public class IllegalNormException extends GeometryException {
+public class IllegalNormException extends GeometryValueException {
 
     /** Serializable version identifier */
     private static final long serialVersionUID = 20180909L;
diff --git 
a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/IntervalsSet.java
 
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/IntervalsSet.java
index bb86ed6..b7f1dbc 100644
--- 
a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/IntervalsSet.java
+++ 
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/IntervalsSet.java
@@ -106,14 +106,14 @@ public class IntervalsSet extends 
AbstractRegion<Vector1D, Vector1D> implements
             }
             // the tree must be open on the negative infinity side
             final SubHyperplane<Vector1D> upperCut =
-                new OrientedPoint(Vector1D.of(upper), true, 
precision).wholeHyperplane();
+                OrientedPoint.createPositiveFacing(Vector1D.of(upper), 
precision).wholeHyperplane();
             return new BSPTree<>(upperCut,
                                new BSPTree<Vector1D>(Boolean.FALSE),
                                new BSPTree<Vector1D>(Boolean.TRUE),
                                null);
         }
         final SubHyperplane<Vector1D> lowerCut =
-            new OrientedPoint(Vector1D.of(lower), false, 
precision).wholeHyperplane();
+            OrientedPoint.createNegativeFacing(Vector1D.of(lower), 
precision).wholeHyperplane();
         if (Double.isInfinite(upper) && (upper > 0)) {
             // the tree must be open on the positive infinity side
             return new BSPTree<>(lowerCut,
@@ -124,7 +124,7 @@ public class IntervalsSet extends AbstractRegion<Vector1D, 
Vector1D> implements
 
         // the tree must be bounded on the two sides
         final SubHyperplane<Vector1D> upperCut =
-            new OrientedPoint(Vector1D.of(upper), true, 
precision).wholeHyperplane();
+            OrientedPoint.createPositiveFacing(Vector1D.of(upper), 
precision).wholeHyperplane();
         return new BSPTree<>(lowerCut,
                                         new BSPTree<Vector1D>(Boolean.FALSE),
                                         new BSPTree<>(upperCut,
@@ -177,7 +177,7 @@ public class IntervalsSet extends AbstractRegion<Vector1D, 
Vector1D> implements
         while (node.getCut() != null) {
             final OrientedPoint op = (OrientedPoint) 
node.getCut().getHyperplane();
             inf  = op.getLocation().getX();
-            node = op.isDirect() ? node.getMinus() : node.getPlus();
+            node = op.isPositiveFacing() ? node.getMinus() : node.getPlus();
         }
         return ((Boolean) node.getAttribute()) ? Double.NEGATIVE_INFINITY : 
inf;
     }
@@ -194,7 +194,7 @@ public class IntervalsSet extends AbstractRegion<Vector1D, 
Vector1D> implements
         while (node.getCut() != null) {
             final OrientedPoint op = (OrientedPoint) 
node.getCut().getHyperplane();
             sup  = op.getLocation().getX();
-            node = op.isDirect() ? node.getPlus() : node.getMinus();
+            node = op.isPositiveFacing() ? node.getPlus() : node.getMinus();
         }
         return ((Boolean) node.getAttribute()) ? Double.POSITIVE_INFINITY : 
sup;
     }
@@ -484,7 +484,7 @@ public class IntervalsSet extends AbstractRegion<Vector1D, 
Vector1D> implements
      * @return true if the oriented point is direct
      */
     private boolean isDirect(final BSPTree<Vector1D> node) {
-        return ((OrientedPoint) node.getCut().getHyperplane()).isDirect();
+        return ((OrientedPoint) 
node.getCut().getHyperplane()).isPositiveFacing();
     }
 
     /** Get the abscissa of an internal node.
diff --git 
a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/OrientedPoint.java
 
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/OrientedPoint.java
index 1a8b338..4b01e66 100644
--- 
a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/OrientedPoint.java
+++ 
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/OrientedPoint.java
@@ -16,37 +16,100 @@
  */
 package org.apache.commons.geometry.euclidean.oned;
 
+import java.io.Serializable;
+import java.util.Objects;
+
+import org.apache.commons.geometry.core.exception.GeometryValueException;
 import org.apache.commons.geometry.core.partitioning.Hyperplane;
+import org.apache.commons.geometry.core.partitioning.Transform;
 import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
 
 /** This class represents a 1D oriented hyperplane.
- * <p>An hyperplane in 1D is a simple point, its orientation being a
- * boolean.</p>
+ *
+ * <p>A hyperplane in 1D is a simple point, its orientation being a
+ * boolean indicating if the direction is positive or negative.</p>
+ *
  * <p>Instances of this class are guaranteed to be immutable.</p>
  */
-public class OrientedPoint implements Hyperplane<Vector1D> {
+public final class OrientedPoint implements Hyperplane<Vector1D>, Serializable 
{
+
+    /** Serializable UID. */
+    private static final long serialVersionUID = 20190210L;
 
-    /** Point location. */
+    /** Hyperplane location. */
     private final Vector1D location;
 
-    /** Orientation. */
-    private boolean direct;
+    /** Hyperplane direction. */
+    private final boolean positiveFacing;
 
     /** Precision context used to compare floating point numbers. */
     private final DoublePrecisionContext precision;
 
     /** Simple constructor.
-     * @param location location of the hyperplane
-     * @param direct if true, the plus side of the hyperplane is towards
-     * abscissas greater than {@code location}
+     * @param point location of the hyperplane
+     * @param positiveFacing if true, the hyperplane will face toward positive 
infinity;
+     *      otherwise, it will point toward negative infinity.
      * @param precision precision context used to compare floating point values
      */
-    public OrientedPoint(final Vector1D location, final boolean direct, final 
DoublePrecisionContext precision) {
-        this.location  = location;
-        this.direct    = direct;
+    private OrientedPoint(final Vector1D point, final boolean positiveFacing, 
final DoublePrecisionContext precision) {
+        this.location = point;
+        this.positiveFacing = positiveFacing;
         this.precision = precision;
     }
 
+    /** Get the point representing the hyperplane's location on the real line.
+     * @return the hyperplane location
+     */
+    public Vector1D getLocation() {
+        return location;
+    }
+
+    /** Get the direction of the hyperplane's plus side.
+     * @return the hyperplane direction
+     */
+    public Vector1D getDirection() {
+        return positiveFacing ? Vector1D.ONE : Vector1D.MINUS_ONE;
+    }
+
+    /**
+     * Return true if the hyperplane is oriented with its plus
+     * side in the direction of positive infinity.
+     * @return true if the hyperplane is facing toward positive
+     *      infinity
+     */
+    public boolean isPositiveFacing() {
+        return positiveFacing;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public DoublePrecisionContext getPrecision() {
+        return precision;
+    }
+
+    /** Get an instance with the same location and precision but the opposite
+     * direction.
+     * @return a copy of this instance with the opposite direction
+     */
+    public OrientedPoint reverse() {
+        return new OrientedPoint(location, !positiveFacing, precision);
+    }
+
+    /** Return a new instance transformed by the given {@link Transform}.
+     * @param transform transform object
+     * @return a transformed instance
+     */
+    public OrientedPoint transform(final Transform<Vector1D, Vector1D> 
transform) {
+        Vector1D transformedLocation = transform.apply(location);
+        Vector1D transformedPlusDirPt = 
transform.apply(location.add(getDirection()));
+
+        return OrientedPoint.fromPointAndDirection(
+                    transformedLocation,
+                    transformedLocation.vectorTo(transformedPlusDirPt),
+                    precision
+                );
+    }
+
     /** Copy the instance.
      * <p>Since instances are immutable, this method directly returns
      * the instance.</p>
@@ -61,7 +124,7 @@ public class OrientedPoint implements Hyperplane<Vector1D> {
     @Override
     public double getOffset(final Vector1D point) {
         final double delta = point.getX() - location.getX();
-        return direct ? delta : -delta;
+        return positiveFacing ? delta : -delta;
     }
 
     /** Build a region covering the whole hyperplane.
@@ -92,40 +155,105 @@ public class OrientedPoint implements 
Hyperplane<Vector1D> {
     /** {@inheritDoc} */
     @Override
     public boolean sameOrientationAs(final Hyperplane<Vector1D> other) {
-        return !(direct ^ ((OrientedPoint) other).direct);
+        return positiveFacing == ((OrientedPoint) other).positiveFacing;
     }
 
     /** {@inheritDoc} */
     @Override
-    public Vector1D project(Vector1D point) {
+    public Vector1D project(final Vector1D point) {
         return location;
     }
 
     /** {@inheritDoc} */
     @Override
-    public DoublePrecisionContext getPrecision() {
-        return precision;
+    public int hashCode() {
+        final int prime = 31;
+
+        int result = 1;
+        result = (prime * result) + Objects.hashCode(location);
+        result = (prime * result) + Boolean.hashCode(positiveFacing);
+        result = (prime * result) + Objects.hash(precision);
+
+        return result;
     }
 
-    /** Get the hyperplane location on the real line.
-     * @return the hyperplane location
+    /** {@inheritDoc} */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        else if (!(obj instanceof OrientedPoint)) {
+            return false;
+        }
+
+        OrientedPoint other = (OrientedPoint) obj;
+
+        return Objects.equals(this.location, other.location) &&
+                this.positiveFacing == other.positiveFacing &&
+                Objects.equals(this.precision, other.precision);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append(this.getClass().getSimpleName())
+            .append("[location= ")
+            .append(location)
+            .append(", direction= ")
+            .append(getDirection())
+            .append(']');
+
+        return sb.toString();
+    }
+
+    /** Create a new instance from the given point and boolean direction value.
+     * @param point the location of the hyperplane
+     * @param positiveFacing if true, the hyperplane will face toward positive 
infinity;
+     *      otherwise, it will point toward negative infinity.
+     * @param precision precision context used to compare floating point values
+     * @return a new instance
      */
-    public Vector1D getLocation() {
-        return location;
+    public static OrientedPoint fromPointAndDirection(final Vector1D point, 
final boolean positiveFacing,
+            final DoublePrecisionContext precision) {
+        return new OrientedPoint(point, positiveFacing, precision);
     }
 
-    /** Check if the hyperplane orientation is direct.
-     * @return true if the plus side of the hyperplane is towards
-     * abscissae greater than hyperplane location
+    /** Create a new instance from the given point and direction.
+     * @param point the location of the hyperplane
+     * @param direction the direction of the plus side of the hyperplane
+     * @param precision precision context used to compare floating point values
+     * @return a new instance oriented in the given direction
+     * @throws GeometryValueException if the direction is zero as evaluated by 
the
+     *      given precision context
      */
-    public boolean isDirect() {
-        return direct;
+    public static OrientedPoint fromPointAndDirection(final Vector1D point, 
final Vector1D direction,
+            final DoublePrecisionContext precision) {
+        if (direction.isZero(precision)) {
+            throw new GeometryValueException("Oriented point direction cannot 
be zero");
+        }
+
+        final boolean positiveFacing = direction.getX() > 0;
+
+        return new OrientedPoint(point, positiveFacing, precision);
     }
 
-    /** Revert the instance.
+    /** Create a new instance at the given point, oriented so that it is 
facing positive infinity.
+     * @param point the location of the hyperplane
+     * @param precision precision context used to compare floating point values
+     * @return a new instance oriented toward positive infinity
      */
-    public void revertSelf() {
-        direct = !direct;
+    public static OrientedPoint createPositiveFacing(final Vector1D point, 
final DoublePrecisionContext precision) {
+        return new OrientedPoint(point, true, precision);
     }
 
+    /** Create a new instance at the given point, oriented so that it is 
facing negative infinity.
+     * @param point the location of the hyperplane
+     * @param precision precision context used to compare floating point values
+     * @return a new instance oriented toward negative infinity
+     */
+    public static OrientedPoint createNegativeFacing(final Vector1D point, 
final DoublePrecisionContext precision) {
+        return new OrientedPoint(point, false, precision);
+    }
 }
diff --git 
a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java
 
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java
index 892b952..37d4a6c 100644
--- 
a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java
+++ 
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Line.java
@@ -496,7 +496,7 @@ public class Line implements Hyperplane<Vector2D>, 
Embedding<Vector2D, Vector1D>
             final Line transformedLine = (Line) transformed;
             final Vector1D newLoc =
                 
transformedLine.toSubSpace(apply(originalLine.toSpace(op.getLocation())));
-            return new OrientedPoint(newLoc, op.isDirect(), 
originalLine.precision).wholeHyperplane();
+            return OrientedPoint.fromPointAndDirection(newLoc, 
op.getDirection(), originalLine.precision).wholeHyperplane();
         }
 
     }
diff --git 
a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/SubLine.java
 
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/SubLine.java
index f527b98..21b340b 100644
--- 
a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/SubLine.java
+++ 
b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/SubLine.java
@@ -178,9 +178,9 @@ public class SubLine extends 
AbstractSubHyperplane<Vector2D, Vector1D> {
         final boolean direct = Math.sin(thisLine.getAngle() - 
otherLine.getAngle()) < 0;
         final Vector1D x      = thisLine.toSubSpace(crossing);
         final SubHyperplane<Vector1D> subPlus  =
-                new OrientedPoint(x, !direct, precision).wholeHyperplane();
+                OrientedPoint.fromPointAndDirection(x, !direct, 
precision).wholeHyperplane();
         final SubHyperplane<Vector1D> subMinus =
-                new OrientedPoint(x,  direct, precision).wholeHyperplane();
+                OrientedPoint.fromPointAndDirection(x,  direct, 
precision).wholeHyperplane();
 
         final BSPTree<Vector1D> splitTree = 
getRemainingRegion().getTree(false).split(subMinus);
         final BSPTree<Vector1D> plusTree  = 
getRemainingRegion().isEmpty(splitTree.getPlus()) ?
diff --git 
a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/EuclideanTestUtils.java
 
b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/EuclideanTestUtils.java
index b79e382..3fc4280 100644
--- 
a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/EuclideanTestUtils.java
+++ 
b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/EuclideanTestUtils.java
@@ -223,7 +223,7 @@ public class EuclideanTestUtils {
             @Override
             protected void formatHyperplane(final Hyperplane<Vector1D> 
hyperplane) {
                 final OrientedPoint h = (OrientedPoint) hyperplane;
-                getFormatter().format("%22.15e %b", h.getLocation().getX(), 
h.isDirect());
+                getFormatter().format("%22.15e %b", h.getLocation().getX(), 
h.isPositiveFacing());
             }
 
         };
@@ -294,7 +294,7 @@ public class EuclideanTestUtils {
             @Override
             public OrientedPoint parseHyperplane()
                 throws ParseException {
-                return new OrientedPoint(Vector1D.of(getNumber()), 
getBoolean(), getPrecision());
+                return 
OrientedPoint.fromPointAndDirection(Vector1D.of(getNumber()), getBoolean(), 
getPrecision());
             }
 
         };
@@ -394,7 +394,7 @@ public class EuclideanTestUtils {
 
             OrientedPoint hyper = (OrientedPoint) cut.getHyperplane();
             write("cut = { hyperplane: ");
-            if (hyper.isDirect()) {
+            if (hyper.isPositiveFacing()) {
                 write("[" + hyper.getLocation().getX() + ", inf)");
             } else {
                 write("(-inf, " + hyper.getLocation().getX() + "]");
diff --git 
a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/IntervalsSetTest.java
 
b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/IntervalsSetTest.java
index 53cc2c3..85f27e4 100644
--- 
a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/IntervalsSetTest.java
+++ 
b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/IntervalsSetTest.java
@@ -587,6 +587,6 @@ public class IntervalsSetTest {
 
     private SubOrientedPoint subOrientedPoint(double location, boolean direct, 
DoublePrecisionContext precision) {
         // the remaining region isn't necessary for creating 1D boundaries so 
we can set it to null here
-        return new SubOrientedPoint(new OrientedPoint(Vector1D.of(location), 
direct, precision), null);
+        return new 
SubOrientedPoint(OrientedPoint.fromPointAndDirection(Vector1D.of(location), 
direct, precision), null);
     }
 }
diff --git 
a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/OrientedPointTest.java
 
b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/OrientedPointTest.java
index 1621c8e..e1aa221 100644
--- 
a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/OrientedPointTest.java
+++ 
b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/OrientedPointTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.geometry.euclidean.oned;
 
+import org.apache.commons.geometry.core.GeometryTestUtils;
+import org.apache.commons.geometry.core.exception.GeometryValueException;
 import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
 import 
org.apache.commons.geometry.core.precision.EpsilonDoublePrecisionContext;
 import org.apache.commons.geometry.euclidean.EuclideanTestUtils;
@@ -31,65 +33,116 @@ public class OrientedPointTest {
             new EpsilonDoublePrecisionContext(TEST_EPS);
 
     @Test
-    public void testConstructor() {
-        // act
-        OrientedPoint pt = new OrientedPoint(Vector1D.of(2.0), true, 
TEST_PRECISION);
+    public void testGetDirection() {
+        // act/assert
+        EuclideanTestUtils.assertCoordinatesEqual(Vector1D.ONE,
+                OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, 
TEST_PRECISION).getDirection(),
+                TEST_EPS);
+        EuclideanTestUtils.assertCoordinatesEqual(Vector1D.MINUS_ONE,
+                OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), false, 
TEST_PRECISION).getDirection(),
+                TEST_EPS);
+    }
 
-        // assert
-        Assert.assertSame(TEST_PRECISION, pt.getPrecision());
-        Assert.assertEquals(2.0, pt.getLocation().getX(), Precision.EPSILON);
-        Assert.assertTrue(pt.isDirect());
+    @Test
+    public void testReverse() {
+        // act/assert
+        
assertOrientedPoint(OrientedPoint.fromPointAndDirection(Vector1D.of(0), true, 
TEST_PRECISION).reverse(),
+                0.0, false, TEST_PRECISION);
+        
assertOrientedPoint(OrientedPoint.fromPointAndDirection(Vector1D.of(-1), false, 
TEST_PRECISION).reverse(),
+                -1.0, true, TEST_PRECISION);
+        
assertOrientedPoint(OrientedPoint.fromPointAndDirection(Vector1D.of(1), true, 
TEST_PRECISION).reverse(),
+                1.0, false, TEST_PRECISION);
+
+        
assertOrientedPoint(OrientedPoint.fromPointAndDirection(Vector1D.of(0), true, 
TEST_PRECISION).reverse().reverse(),
+                0.0, true, TEST_PRECISION);
+        
assertOrientedPoint(OrientedPoint.fromPointAndDirection(Vector1D.of(-1), false, 
TEST_PRECISION).reverse().reverse(),
+                -1.0, false, TEST_PRECISION);
+        
assertOrientedPoint(OrientedPoint.fromPointAndDirection(Vector1D.of(1), true, 
TEST_PRECISION).reverse().reverse(),
+                1.0, true, TEST_PRECISION);
+    }
+
+    @Test
+    public void testTransform() {
+        // arrange
+        AffineTransformMatrix1D scaleAndTranslate = AffineTransformMatrix1D
+                .createScale(0.5)
+                .translate(-10);
+
+        AffineTransformMatrix1D reflect = 
AffineTransformMatrix1D.createScale(-2);
+
+        OrientedPoint a = OrientedPoint.createPositiveFacing(Vector1D.of(2.0), 
TEST_PRECISION);
+        OrientedPoint b = 
OrientedPoint.createNegativeFacing(Vector1D.of(-3.0), TEST_PRECISION);
+
+        // act/assert
+        assertOrientedPoint(a.transform(scaleAndTranslate), -9.0, true, 
TEST_PRECISION);
+        assertOrientedPoint(b.transform(scaleAndTranslate), -11.5, false, 
TEST_PRECISION);
+
+        assertOrientedPoint(a.transform(reflect), -4.0, false, TEST_PRECISION);
+        assertOrientedPoint(b.transform(reflect), 6.0, true, TEST_PRECISION);
+    }
+
+    @Test
+    public void testTransform_zeroScale() {
+        // arrange
+        AffineTransformMatrix1D zeroScale = 
AffineTransformMatrix1D.createScale(0.0);
+
+        OrientedPoint pt = 
OrientedPoint.createPositiveFacing(Vector1D.of(2.0), TEST_PRECISION);
+
+        // act/assert
+        GeometryTestUtils.assertThrows(
+                () -> pt.transform(zeroScale),
+                GeometryValueException.class, "Oriented point direction cannot 
be zero");
     }
 
     @Test
     public void testCopySelf() {
         // arrange
-        OrientedPoint orig = new OrientedPoint(Vector1D.of(2.0), true, 
TEST_PRECISION);
+        OrientedPoint orig = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, TEST_PRECISION);
 
         // act
         OrientedPoint copy = orig.copySelf();
 
         // assert
         Assert.assertSame(orig, copy);
-        Assert.assertSame(TEST_PRECISION, copy.getPrecision());
-        Assert.assertEquals(2.0, copy.getLocation().getX(), Precision.EPSILON);
-        Assert.assertTrue(copy.isDirect());
+        assertOrientedPoint(copy, 2.0, true, TEST_PRECISION);
     }
 
     @Test
-    public void testGetOffset_direct_point() {
+    public void testGetOffset_positiveFacing() {
         // arrange
-        OrientedPoint pt = new OrientedPoint(Vector1D.of(-1.0), true, 
TEST_PRECISION);
+        OrientedPoint pt = 
OrientedPoint.fromPointAndDirection(Vector1D.of(-2.0), true, TEST_PRECISION);
 
         // act/assert
-        Assert.assertEquals(-99, pt.getOffset(Vector1D.of(-100)), 
Precision.EPSILON);
-        Assert.assertEquals(-1, pt.getOffset(Vector1D.of(-2)), 
Precision.EPSILON);
-        Assert.assertEquals(-0.01, pt.getOffset(Vector1D.of(-1.01)), 
Precision.EPSILON);
-        Assert.assertEquals(0.0, pt.getOffset(Vector1D.of(-1.0)), 
Precision.EPSILON);
-        Assert.assertEquals(0.01, pt.getOffset(Vector1D.of(-0.99)), 
Precision.EPSILON);
-        Assert.assertEquals(1, pt.getOffset(Vector1D.of(0)), 
Precision.EPSILON);
-        Assert.assertEquals(101, pt.getOffset(Vector1D.of(100)), 
Precision.EPSILON);
+        Assert.assertEquals(-98.0, pt.getOffset(Vector1D.of(-100)), 
Precision.EPSILON);
+        Assert.assertEquals(-0.1, pt.getOffset(Vector1D.of(-2.1)), 
Precision.EPSILON);
+        Assert.assertEquals(0.0, pt.getOffset(Vector1D.of(-2)), 
Precision.EPSILON);
+        Assert.assertEquals(0.99, pt.getOffset(Vector1D.of(-1.01)), 
Precision.EPSILON);
+        Assert.assertEquals(1.0, pt.getOffset(Vector1D.of(-1.0)), 
Precision.EPSILON);
+        Assert.assertEquals(1.01, pt.getOffset(Vector1D.of(-0.99)), 
Precision.EPSILON);
+        Assert.assertEquals(2.0, pt.getOffset(Vector1D.of(0)), 
Precision.EPSILON);
+        Assert.assertEquals(102, pt.getOffset(Vector1D.of(100)), 
Precision.EPSILON);
     }
 
     @Test
-    public void testGetOffset_notDirect_point() {
+    public void testGetOffset_negativeFacing() {
         // arrange
-        OrientedPoint pt = new OrientedPoint(Vector1D.of(-1.0), false, 
TEST_PRECISION);
+        OrientedPoint pt = 
OrientedPoint.fromPointAndDirection(Vector1D.of(-2.0), false, TEST_PRECISION);
 
         // act/assert
-        Assert.assertEquals(99, pt.getOffset(Vector1D.of(-100)), 
Precision.EPSILON);
-        Assert.assertEquals(1, pt.getOffset(Vector1D.of(-2)), 
Precision.EPSILON);
-        Assert.assertEquals(0.01, pt.getOffset(Vector1D.of(-1.01)), 
Precision.EPSILON);
-        Assert.assertEquals(0.0, pt.getOffset(Vector1D.of(-1.0)), 
Precision.EPSILON);
-        Assert.assertEquals(-0.01, pt.getOffset(Vector1D.of(-0.99)), 
Precision.EPSILON);
-        Assert.assertEquals(-1, pt.getOffset(Vector1D.of(0)), 
Precision.EPSILON);
-        Assert.assertEquals(-101, pt.getOffset(Vector1D.of(100)), 
Precision.EPSILON);
+        Assert.assertEquals(98.0, pt.getOffset(Vector1D.of(-100)), 
Precision.EPSILON);
+        Assert.assertEquals(0.1, pt.getOffset(Vector1D.of(-2.1)), 
Precision.EPSILON);
+        Assert.assertEquals(0.0, pt.getOffset(Vector1D.of(-2)), 
Precision.EPSILON);
+        Assert.assertEquals(-0.99, pt.getOffset(Vector1D.of(-1.01)), 
Precision.EPSILON);
+        Assert.assertEquals(-1.0, pt.getOffset(Vector1D.of(-1.0)), 
Precision.EPSILON);
+        Assert.assertEquals(-1.01, pt.getOffset(Vector1D.of(-0.99)), 
Precision.EPSILON);
+        Assert.assertEquals(-2, pt.getOffset(Vector1D.of(0)), 
Precision.EPSILON);
+        Assert.assertEquals(-102, pt.getOffset(Vector1D.of(100)), 
Precision.EPSILON);
     }
 
     @Test
     public void testWholeHyperplane() {
         // arrange
-        OrientedPoint pt = new OrientedPoint(Vector1D.of(1.0), false, 
TEST_PRECISION);
+        OrientedPoint pt = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1.0), false, TEST_PRECISION);
 
         // act
         SubOrientedPoint subPt = pt.wholeHyperplane();
@@ -102,7 +155,7 @@ public class OrientedPointTest {
     @Test
     public void testWholeSpace() {
         // arrange
-        OrientedPoint pt = new OrientedPoint(Vector1D.of(1.0), false, 
TEST_PRECISION);
+        OrientedPoint pt = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1.0), false, TEST_PRECISION);
 
         // act
         IntervalsSet set = pt.wholeSpace();
@@ -115,28 +168,28 @@ public class OrientedPointTest {
     @Test
     public void testSameOrientationAs() {
         // arrange
-        OrientedPoint notDirect1 = new OrientedPoint(Vector1D.of(1.0), false, 
TEST_PRECISION);
-        OrientedPoint notDirect2 = new OrientedPoint(Vector1D.of(1.0), false, 
TEST_PRECISION);
-        OrientedPoint direct1 = new OrientedPoint(Vector1D.of(1.0), true, 
TEST_PRECISION);
-        OrientedPoint direct2 = new OrientedPoint(Vector1D.of(1.0), true, 
TEST_PRECISION);
+        OrientedPoint negativeDir1 = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1.0), false, TEST_PRECISION);
+        OrientedPoint negativeDir2 = 
OrientedPoint.fromPointAndDirection(Vector1D.of(-1.0), false, TEST_PRECISION);
+        OrientedPoint positiveDir1 = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, TEST_PRECISION);
+        OrientedPoint positiveDir2 = 
OrientedPoint.fromPointAndDirection(Vector1D.of(-2.0), true, TEST_PRECISION);
 
         // act/assert
-        Assert.assertTrue(notDirect1.sameOrientationAs(notDirect1));
-        Assert.assertTrue(notDirect1.sameOrientationAs(notDirect2));
-        Assert.assertTrue(notDirect2.sameOrientationAs(notDirect1));
+        Assert.assertTrue(negativeDir1.sameOrientationAs(negativeDir1));
+        Assert.assertTrue(negativeDir1.sameOrientationAs(negativeDir2));
+        Assert.assertTrue(negativeDir2.sameOrientationAs(negativeDir1));
 
-        Assert.assertTrue(direct1.sameOrientationAs(direct1));
-        Assert.assertTrue(direct1.sameOrientationAs(direct2));
-        Assert.assertTrue(direct2.sameOrientationAs(direct1));
+        Assert.assertTrue(positiveDir1.sameOrientationAs(positiveDir1));
+        Assert.assertTrue(positiveDir1.sameOrientationAs(positiveDir2));
+        Assert.assertTrue(positiveDir2.sameOrientationAs(positiveDir1));
 
-        Assert.assertFalse(notDirect1.sameOrientationAs(direct1));
-        Assert.assertFalse(direct1.sameOrientationAs(notDirect1));
+        Assert.assertFalse(negativeDir1.sameOrientationAs(positiveDir1));
+        Assert.assertFalse(positiveDir1.sameOrientationAs(negativeDir1));
     }
 
     @Test
     public void testProject() {
         // arrange
-        OrientedPoint pt = new OrientedPoint(Vector1D.of(1.0), true, 
TEST_PRECISION);
+        OrientedPoint pt = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1.0), true, TEST_PRECISION);
 
         // act/assert
         Assert.assertEquals(1.0, pt.project(Vector1D.of(-1.0)).getX(), 
Precision.EPSILON);
@@ -146,19 +199,156 @@ public class OrientedPointTest {
     }
 
     @Test
-    public void testRevertSelf() {
+    public void testHashCode() {
+        // arrange
+        DoublePrecisionContext precisionA = new 
EpsilonDoublePrecisionContext(1e-10);
+        DoublePrecisionContext precisionB = new 
EpsilonDoublePrecisionContext(1e-15);
+
+        OrientedPoint a = 
OrientedPoint.fromPointAndDirection(Vector1D.of(3.0), true, precisionA);
+        OrientedPoint b = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), false, precisionA);
+        OrientedPoint c = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, precisionB);
+
+        OrientedPoint d = 
OrientedPoint.fromPointAndDirection(Vector1D.of(3.0), true, precisionA);
+        OrientedPoint e = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), false, precisionA);
+        OrientedPoint f = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, precisionB);
+
+        // act/assert
+        Assert.assertNotEquals(a.hashCode(), b.hashCode());
+        Assert.assertNotEquals(b.hashCode(), c.hashCode());
+        Assert.assertNotEquals(c.hashCode(), a.hashCode());
+
+        Assert.assertEquals(a.hashCode(), d.hashCode());
+        Assert.assertEquals(b.hashCode(), e.hashCode());
+        Assert.assertEquals(c.hashCode(), f.hashCode());
+    }
+
+    @Test
+    public void testEquals() {
+        // arrange
+        DoublePrecisionContext precisionA = new 
EpsilonDoublePrecisionContext(1e-10);
+        DoublePrecisionContext precisionB = new 
EpsilonDoublePrecisionContext(1e-15);
+
+        OrientedPoint a = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1.0), true, precisionA);
+        OrientedPoint b = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, precisionA);
+
+        OrientedPoint c = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, precisionA);
+        OrientedPoint d = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), false, precisionA);
+
+        OrientedPoint e = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, precisionA);
+        OrientedPoint f = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, precisionB);
+
+        OrientedPoint g = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1.0), true, precisionA);
+
+        // act/assert
+        Assert.assertFalse(a.equals(null));
+        Assert.assertFalse(a.equals(new Object()));
+
+        Assert.assertFalse(a.equals(b));
+        Assert.assertFalse(c.equals(d));
+        Assert.assertFalse(e.equals(f));
+
+        Assert.assertTrue(a.equals(a));
+        Assert.assertTrue(a.equals(g));
+        Assert.assertTrue(g.equals(a));
+    }
+
+    @Test
+    public void testToString() {
         // arrange
-        OrientedPoint pt = new OrientedPoint(Vector1D.of(2.0), true, 
TEST_PRECISION);
+        OrientedPoint pt = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, TEST_PRECISION);
 
         // act
-        pt.revertSelf();
+        String str = pt.toString();
 
         // assert
-        Assert.assertEquals(2.0, pt.getLocation().getX(), Precision.EPSILON);
-        Assert.assertFalse(pt.isDirect());
-        Assert.assertSame(TEST_PRECISION, pt.getPrecision());
+        Assert.assertTrue(str.contains("OrientedPoint"));
+        Assert.assertTrue(str.contains("location= (2.0)"));
+        Assert.assertTrue(str.contains("direction= (1.0)"));
+    }
+
+    @Test
+    public void testFromPointAndDirection_trueBooleanArg() {
+        // act
+        OrientedPoint pt = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), true, TEST_PRECISION);
+
+        // assert
+        assertOrientedPoint(pt, 2.0, true, TEST_PRECISION);
+        Assert.assertEquals(1.0, pt.getDirection().getX(), Precision.EPSILON);
+    }
+
+    @Test
+    public void testFromPointAndDirection_falseBooleanArg() {
+        // act
+        OrientedPoint pt = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), false, TEST_PRECISION);
+
+        // assert
+        assertOrientedPoint(pt, 2.0, false, TEST_PRECISION);
+        Assert.assertEquals(-1.0, pt.getDirection().getX(), Precision.EPSILON);
+    }
+
+    @Test
+    public void testFromPointAndDirection_positiveVectorArg() {
+        // act
+        OrientedPoint pt = OrientedPoint.fromPointAndDirection(
+                Vector1D.of(-2.0), Vector1D.of(0.1), TEST_PRECISION);
+
+        // assert
+        assertOrientedPoint(pt, -2.0, true, TEST_PRECISION);
+        Assert.assertEquals(1.0, pt.getDirection().getX(), Precision.EPSILON);
+    }
+
+    @Test
+    public void testFromPointAndDirection_negativeVectorArg() {
+        // act
+        OrientedPoint pt = OrientedPoint.fromPointAndDirection(
+                Vector1D.of(2.0), Vector1D.of(-10.1), TEST_PRECISION);
+
+        // assert
+        assertOrientedPoint(pt, 2.0, false, TEST_PRECISION);
+        Assert.assertEquals(-1.0, pt.getDirection().getX(), Precision.EPSILON);
+    }
+
+    @Test
+    public void testFromPointAndDirection_invalidDirection() {
+        // arrange
+        DoublePrecisionContext precision = new 
EpsilonDoublePrecisionContext(0.1);
+
+        // act/assert
+        GeometryTestUtils.assertThrows(
+                () -> OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), 
Vector1D.of(0.09), precision),
+                GeometryValueException.class, "Oriented point direction cannot 
be zero");
+        GeometryTestUtils.assertThrows(
+                () -> OrientedPoint.fromPointAndDirection(Vector1D.of(2.0), 
Vector1D.of(-0.09), precision),
+                GeometryValueException.class, "Oriented point direction cannot 
be zero");
+        ;
+    }
+
+    @Test
+    public void testCreatePositiveFacing() {
+        // act
+        OrientedPoint pt = OrientedPoint.createPositiveFacing(
+                Vector1D.of(-2.0), TEST_PRECISION);
+
+        // assert
+        assertOrientedPoint(pt, -2.0, true, TEST_PRECISION);
+        Assert.assertEquals(1.0, pt.getDirection().getX(), Precision.EPSILON);
+    }
+
+    @Test
+    public void testCreateNegativeFacing() {
+        // act
+        OrientedPoint pt = OrientedPoint.createNegativeFacing(
+                Vector1D.of(2.0), TEST_PRECISION);
+
+        // assert
+        assertOrientedPoint(pt, 2.0, false, TEST_PRECISION);
+        Assert.assertEquals(-1.0, pt.getDirection().getX(), Precision.EPSILON);
+    }
 
-        Assert.assertEquals(1, pt.getOffset(Vector1D.of(1.0)), 
Precision.EPSILON);
-        Assert.assertEquals(-1, pt.getOffset(Vector1D.of(3.0)), 
Precision.EPSILON);
+    private static void assertOrientedPoint(OrientedPoint pt, double location,
+            boolean positiveFacing, DoublePrecisionContext precision) {
+        Assert.assertEquals(location, pt.getLocation().getX(), TEST_EPS);
+        Assert.assertEquals(positiveFacing, pt.isPositiveFacing());
+        Assert.assertSame(precision, pt.getPrecision());
     }
 }
diff --git 
a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/SubOrientedPointTest.java
 
b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/SubOrientedPointTest.java
index c9dab33..5935309 100644
--- 
a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/SubOrientedPointTest.java
+++ 
b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/SubOrientedPointTest.java
@@ -34,7 +34,7 @@ public class SubOrientedPointTest {
     @Test
     public void testGetSize() {
         // arrange
-        OrientedPoint hyperplane = new OrientedPoint(Vector1D.of(1), true, 
TEST_PRECISION);
+        OrientedPoint hyperplane = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1), true, TEST_PRECISION);
         SubOrientedPoint pt = hyperplane.wholeHyperplane();
 
         // act/assert
@@ -44,7 +44,7 @@ public class SubOrientedPointTest {
     @Test
     public void testIsEmpty() {
         // arrange
-        OrientedPoint hyperplane = new OrientedPoint(Vector1D.of(1), true, 
TEST_PRECISION);
+        OrientedPoint hyperplane = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1), true, TEST_PRECISION);
         SubOrientedPoint pt = hyperplane.wholeHyperplane();
 
         // act/assert
@@ -54,10 +54,10 @@ public class SubOrientedPointTest {
     @Test
     public void testBuildNew() {
         // arrange
-        OrientedPoint originalHyperplane = new OrientedPoint(Vector1D.of(1), 
true, TEST_PRECISION);
+        OrientedPoint originalHyperplane = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1), true, TEST_PRECISION);
         SubOrientedPoint pt = originalHyperplane.wholeHyperplane();
 
-        OrientedPoint hyperplane = new OrientedPoint(Vector1D.of(2), true, 
TEST_PRECISION);
+        OrientedPoint hyperplane = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2), true, TEST_PRECISION);
         IntervalsSet intervals = new IntervalsSet(2, 3, TEST_PRECISION);
 
         // act
@@ -72,11 +72,11 @@ public class SubOrientedPointTest {
     @Test
     public void testSplit_resultOnMinusSide() {
         // arrange
-        OrientedPoint hyperplane = new OrientedPoint(Vector1D.of(1), true, 
TEST_PRECISION);
+        OrientedPoint hyperplane = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1), true, TEST_PRECISION);
         IntervalsSet interval = new IntervalsSet(TEST_PRECISION);
         SubOrientedPoint pt = new SubOrientedPoint(hyperplane, interval);
 
-        OrientedPoint splitter = new OrientedPoint(Vector1D.of(2), true, 
TEST_PRECISION);
+        OrientedPoint splitter = 
OrientedPoint.fromPointAndDirection(Vector1D.of(2), true, TEST_PRECISION);
 
         // act
         SplitSubHyperplane<Vector1D> split = pt.split(splitter);
@@ -98,11 +98,11 @@ public class SubOrientedPointTest {
     @Test
     public void testSplit_resultOnPlusSide() {
         // arrange
-        OrientedPoint hyperplane = new OrientedPoint(Vector1D.of(1), true, 
TEST_PRECISION);
+        OrientedPoint hyperplane = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1), true, TEST_PRECISION);
         IntervalsSet interval = new IntervalsSet(TEST_PRECISION);
         SubOrientedPoint pt = new SubOrientedPoint(hyperplane, interval);
 
-        OrientedPoint splitter = new OrientedPoint(Vector1D.of(0), true, 
TEST_PRECISION);
+        OrientedPoint splitter = 
OrientedPoint.fromPointAndDirection(Vector1D.of(0), true, TEST_PRECISION);
 
         // act
         SplitSubHyperplane<Vector1D> split = pt.split(splitter);
@@ -124,11 +124,11 @@ public class SubOrientedPointTest {
     @Test
     public void testSplit_equivalentHyperplanes() {
         // arrange
-        OrientedPoint hyperplane = new OrientedPoint(Vector1D.of(1), true, 
TEST_PRECISION);
+        OrientedPoint hyperplane = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1), true, TEST_PRECISION);
         IntervalsSet interval = new IntervalsSet(TEST_PRECISION);
         SubOrientedPoint pt = new SubOrientedPoint(hyperplane, interval);
 
-        OrientedPoint splitter = new OrientedPoint(Vector1D.of(1), true, 
TEST_PRECISION);
+        OrientedPoint splitter = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1), true, TEST_PRECISION);
 
         // act
         SplitSubHyperplane<Vector1D> split = pt.split(splitter);
@@ -146,23 +146,23 @@ public class SubOrientedPointTest {
         DoublePrecisionContext parentPrecision = new 
EpsilonDoublePrecisionContext(0.1);
         DoublePrecisionContext otherPrecision = new 
EpsilonDoublePrecisionContext(1e-10);
 
-        OrientedPoint hyperplane = new OrientedPoint(Vector1D.of(1), true, 
parentPrecision);
+        OrientedPoint hyperplane = 
OrientedPoint.fromPointAndDirection(Vector1D.of(1), true, parentPrecision);
         SubOrientedPoint pt = hyperplane.wholeHyperplane();
 
         // act/assert
-        SplitSubHyperplane<Vector1D> plusSplit = pt.split(new 
OrientedPoint(Vector1D.of(0.899), true, otherPrecision));
+        SplitSubHyperplane<Vector1D> plusSplit = 
pt.split(OrientedPoint.fromPointAndDirection(Vector1D.of(0.899), true, 
otherPrecision));
         Assert.assertNull(plusSplit.getMinus());
         Assert.assertNotNull(plusSplit.getPlus());
 
-        SplitSubHyperplane<Vector1D> lowWithinTolerance = pt.split(new 
OrientedPoint(Vector1D.of(0.901), true, otherPrecision));
+        SplitSubHyperplane<Vector1D> lowWithinTolerance = 
pt.split(OrientedPoint.fromPointAndDirection(Vector1D.of(0.901), true, 
otherPrecision));
         Assert.assertNull(lowWithinTolerance.getMinus());
         Assert.assertNull(lowWithinTolerance.getPlus());
 
-        SplitSubHyperplane<Vector1D> highWithinTolerance = pt.split(new 
OrientedPoint(Vector1D.of(1.09), true, otherPrecision));
+        SplitSubHyperplane<Vector1D> highWithinTolerance = 
pt.split(OrientedPoint.fromPointAndDirection(Vector1D.of(1.09), true, 
otherPrecision));
         Assert.assertNull(highWithinTolerance.getMinus());
         Assert.assertNull(highWithinTolerance.getPlus());
 
-        SplitSubHyperplane<Vector1D> minusSplit = pt.split(new 
OrientedPoint(Vector1D.of(1.101), true, otherPrecision));
+        SplitSubHyperplane<Vector1D> minusSplit = 
pt.split(OrientedPoint.fromPointAndDirection(Vector1D.of(1.101), true, 
otherPrecision));
         Assert.assertNotNull(minusSplit.getMinus());
         Assert.assertNull(minusSplit.getPlus());
     }

Reply via email to