renaming BoundarySourceLinecastWrapperXD to BoundarySourceLinecasterXD
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecastWrapper3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecaster3D.java
similarity index 91%
rename from commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecastWrapper3D.java
rename to commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecaster3D.java
index 5060d86..43a7399 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecastWrapper3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecaster3D.java
@@ -21,12 +21,12 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-/** Class that wraps a {@link BoundarySource3D} instance with the {@link Linecastable3D}
- * interface. This class performs a brute-force computation of the intersections of the
+/** Class that performs linecast operations against arbitrary {@link BoundarySource3D}
+ * instances. This class performs a brute-force computation of the intersections of the
* line or line segment against all boundaries. Some data structures may support more
* efficient algorithms and should therefore prefer those instead.
*/
-final class BoundarySourceLinecastWrapper3D implements Linecastable3D {
+final class BoundarySourceLinecaster3D implements Linecastable3D {
/** The boundary source instance providing boundaries for the linecast operation. */
private final BoundarySource3D boundarySrc;
@@ -34,7 +34,7 @@
/** Construct a new instance for linecasting against the given boundary source.
* @param boundarySrc boundary source to linecast against.
*/
- BoundarySourceLinecastWrapper3D(final BoundarySource3D boundarySrc) {
+ BoundarySourceLinecaster3D(final BoundarySource3D boundarySrc) {
this.boundarySrc = boundarySrc;
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/ConvexVolume.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/ConvexVolume.java
index a79c14f..ac1a702 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/ConvexVolume.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/ConvexVolume.java
@@ -132,13 +132,13 @@
/** {@inheritDoc} */
@Override
public List<LinecastPoint3D> linecast(final Segment3D segment) {
- return new BoundarySourceLinecastWrapper3D(this).linecast(segment);
+ return new BoundarySourceLinecaster3D(this).linecast(segment);
}
/** {@inheritDoc} */
@Override
public LinecastPoint3D linecastFirst(final Segment3D segment) {
- return new BoundarySourceLinecastWrapper3D(this).linecastFirst(segment);
+ return new BoundarySourceLinecaster3D(this).linecastFirst(segment);
}
/** {@inheritDoc} */
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecastWrapper2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecaster2D.java
similarity index 91%
rename from commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecastWrapper2D.java
rename to commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecaster2D.java
index 0c0b57b..bf4133d 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecastWrapper2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecaster2D.java
@@ -21,12 +21,12 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-/** Class that wraps a {@link BoundarySource2D} instance with the {@link Linecastable2D}
- * interface. This class performs a brute-force computation of the intersections of the
+/** Class that performs linecast operations against arbitrary {@link BoundarySource2D}
+ * instances. This class performs a brute-force computation of the intersections of the
* line or line segment against all boundaries. Some data structures may support more
* efficient algorithms and should therefore prefer those instead.
*/
-final class BoundarySourceLinecastWrapper2D implements Linecastable2D {
+final class BoundarySourceLinecaster2D implements Linecastable2D {
/** The boundary source instance providing boundaries for the linecast operation. */
private final BoundarySource2D boundarySrc;
@@ -34,7 +34,7 @@
/** Construct a new instance for linecasting against the given boundary source.
* @param boundarySrc boundary source to linecast against.
*/
- BoundarySourceLinecastWrapper2D(final BoundarySource2D boundarySrc) {
+ BoundarySourceLinecaster2D(final BoundarySource2D boundarySrc) {
this.boundarySrc = boundarySrc;
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/ConvexArea.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/ConvexArea.java
index 2061053..f65f4fa 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/ConvexArea.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/ConvexArea.java
@@ -168,13 +168,13 @@
/** {@inheritDoc} */
@Override
public List<LinecastPoint2D> linecast(final Segment segment) {
- return new BoundarySourceLinecastWrapper2D(this).linecast(segment);
+ return new BoundarySourceLinecaster2D(this).linecast(segment);
}
/** {@inheritDoc} */
@Override
public LinecastPoint2D linecastFirst(final Segment segment) {
- return new BoundarySourceLinecastWrapper2D(this).linecastFirst(segment);
+ return new BoundarySourceLinecaster2D(this).linecastFirst(segment);
}
/** Return an instance representing the full 2D area.
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Polyline.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Polyline.java
index 65948f0..9e0d926 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Polyline.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Polyline.java
@@ -260,13 +260,13 @@
/** {@inheritDoc} */
@Override
public List<LinecastPoint2D> linecast(final Segment segment) {
- return new BoundarySourceLinecastWrapper2D(this).linecast(segment);
+ return new BoundarySourceLinecaster2D(this).linecast(segment);
}
/** {@inheritDoc} */
@Override
public LinecastPoint2D linecastFirst(final Segment segment) {
- return new BoundarySourceLinecastWrapper2D(this).linecastFirst(segment);
+ return new BoundarySourceLinecaster2D(this).linecastFirst(segment);
}
/** Return a string representation of the segment polyline.
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecastWrapper3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecaster3DTest.java
similarity index 82%
rename from commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecastWrapper3DTest.java
rename to commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecaster3DTest.java
index 45f8bd8..e43cbea 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecastWrapper3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/BoundarySourceLinecaster3DTest.java
@@ -23,7 +23,7 @@
import org.apache.commons.geometry.euclidean.threed.shapes.Parallelepiped;
import org.junit.Test;
-public class BoundarySourceLinecastWrapper3DTest {
+public class BoundarySourceLinecaster3DTest {
private static final double TEST_EPS = 1e-10;
@@ -36,22 +36,22 @@
@Test
public void testLinecast_line_simple() {
// arrange
- BoundarySourceLinecastWrapper3D wrapper = new BoundarySourceLinecastWrapper3D(UNIT_CUBE);
+ BoundarySourceLinecaster3D linecaster = new BoundarySourceLinecaster3D(UNIT_CUBE);
// act/assert
// no intersections
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returnsNothing()
.whenGiven(Line3D.fromPointAndDirection(Vector3D.of(0, 4, 4), Vector3D.Unit.MINUS_X, TEST_PRECISION));
// through center; two directions
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(0, 0.5, 0.5), Vector3D.Unit.MINUS_X)
.and(Vector3D.of(1, 0.5, 0.5), Vector3D.Unit.PLUS_X)
.whenGiven(Line3D.fromPointAndDirection(Vector3D.of(0.5, 0.5, 0.5), Vector3D.Unit.PLUS_X, TEST_PRECISION));
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(1, 0.5, 0.5), Vector3D.Unit.PLUS_X)
.and(Vector3D.of(0, 0.5, 0.5), Vector3D.Unit.MINUS_X)
.whenGiven(Line3D.fromPointAndDirection(Vector3D.of(0.5, 0.5, 0.5), Vector3D.Unit.MINUS_X, TEST_PRECISION));
@@ -60,10 +60,10 @@
@Test
public void testLinecast_line_alongFace() {
// arrange
- BoundarySourceLinecastWrapper3D wrapper = new BoundarySourceLinecastWrapper3D(UNIT_CUBE);
+ BoundarySourceLinecaster3D linecaster = new BoundarySourceLinecaster3D(UNIT_CUBE);
// act/assert
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.ZERO, Vector3D.Unit.MINUS_Y)
.and(Vector3D.ZERO, Vector3D.Unit.MINUS_Z)
.and(Vector3D.of(0, 1, 1), Vector3D.Unit.PLUS_Z)
@@ -74,19 +74,19 @@
@Test
public void testLinecast_line_corners() {
// arrange
- BoundarySourceLinecastWrapper3D wrapper = new BoundarySourceLinecastWrapper3D(UNIT_CUBE);
+ BoundarySourceLinecaster3D linecaster = new BoundarySourceLinecaster3D(UNIT_CUBE);
// act/assert
// through single corner vertex
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(1, 1, 1), Vector3D.Unit.PLUS_Z)
.and(Vector3D.of(1, 1, 1), Vector3D.Unit.PLUS_Y)
.and(Vector3D.of(1, 1, 1), Vector3D.Unit.PLUS_X)
.whenGiven(Line3D.fromPointAndDirection(Vector3D.of(1, 1, 1), Vector3D.of(1, -1, -1), TEST_PRECISION));
// through two corner vertices
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.ZERO, Vector3D.Unit.MINUS_X)
.and(Vector3D.ZERO, Vector3D.Unit.MINUS_Y)
.and(Vector3D.ZERO, Vector3D.Unit.MINUS_Z)
@@ -103,10 +103,10 @@
Facet.fromVertexLoop(Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y), TEST_PRECISION),
Facet.fromVertexLoop(Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_Y, Vector3D.Unit.MINUS_X), TEST_PRECISION)
);
- BoundarySourceLinecastWrapper3D wrapper = new BoundarySourceLinecastWrapper3D(src);
+ BoundarySourceLinecaster3D linecaster = new BoundarySourceLinecaster3D(src);
// act/assert
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(0, 0.5, 0), Vector3D.Unit.PLUS_Z)
.whenGiven(Line3D.fromPointAndDirection(Vector3D.of(-1, 0.5, 1), Vector3D.of(1, 0, -1), TEST_PRECISION));
}
@@ -114,30 +114,30 @@
@Test
public void testLinecast_segment_simple() {
// arrange
- BoundarySourceLinecastWrapper3D wrapper = new BoundarySourceLinecastWrapper3D(UNIT_CUBE);
+ BoundarySourceLinecaster3D linecaster = new BoundarySourceLinecaster3D(UNIT_CUBE);
// act/assert
// no intersections; underlying line does not intersect
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returnsNothing()
.whenGiven(Line3D.fromPointAndDirection(Vector3D.of(0, 4, 4), Vector3D.Unit.MINUS_X, TEST_PRECISION)
.segment(-10, 10));
// no intersections; underlying line does intersect
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returnsNothing()
.whenGiven(Line3D.fromPointAndDirection(Vector3D.of(0.5, 0.5, 0.5), Vector3D.Unit.PLUS_X, TEST_PRECISION)
.segment(2, 10));
// no boundaries excluded; two directions
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(0, 0.5, 0.5), Vector3D.Unit.MINUS_X)
.and(Vector3D.of(1, 0.5, 0.5), Vector3D.Unit.PLUS_X)
.whenGiven(Line3D.fromPointAndDirection(Vector3D.of(0.5, 0.5, 0.5), Vector3D.Unit.PLUS_X, TEST_PRECISION)
.segment(-10, 10));
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(1, 0.5, 0.5), Vector3D.Unit.PLUS_X)
.and(Vector3D.of(0, 0.5, 0.5), Vector3D.Unit.MINUS_X)
.whenGiven(Line3D.fromPointAndDirection(Vector3D.of(0.5, 0.5, 0.5), Vector3D.Unit.MINUS_X, TEST_PRECISION)
@@ -147,16 +147,16 @@
@Test
public void testLinecast_segment_boundaryExcluded() {
// arrange
- BoundarySourceLinecastWrapper3D wrapper = new BoundarySourceLinecastWrapper3D(UNIT_CUBE);
+ BoundarySourceLinecaster3D linecaster = new BoundarySourceLinecaster3D(UNIT_CUBE);
// act/assert
Vector3D center = Vector3D.of(0.5, 0.5, 0.5);
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(1, 0.5, 0.5), Vector3D.Unit.PLUS_X)
.whenGiven(Line3D.fromPointAndDirection(center, Vector3D.Unit.PLUS_X, TEST_PRECISION)
.segmentFrom(center));
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(1, 0.5, 0.5), Vector3D.Unit.PLUS_X)
.whenGiven(Line3D.fromPointAndDirection(center, Vector3D.Unit.MINUS_X, TEST_PRECISION)
.segmentTo(center));
@@ -165,10 +165,10 @@
@Test
public void testLinecast_segment_startEndPointsOnBoundaries() {
// arrange
- BoundarySourceLinecastWrapper3D wrapper = new BoundarySourceLinecastWrapper3D(UNIT_CUBE);
+ BoundarySourceLinecaster3D linecaster = new BoundarySourceLinecaster3D(UNIT_CUBE);
// act/assert
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(1, 0.5, 0.5), Vector3D.Unit.PLUS_X)
.and(Vector3D.of(0, 0.5, 0.5), Vector3D.Unit.MINUS_X)
.whenGiven(Segment3D.fromPoints(Vector3D.of(1, 0.5, 0.5), Vector3D.of(0, 0.5, 0.5), TEST_PRECISION));
@@ -177,23 +177,23 @@
@Test
public void testLinecast_segment_alongFace() {
// arrange
- BoundarySourceLinecastWrapper3D wrapper = new BoundarySourceLinecastWrapper3D(UNIT_CUBE);
+ BoundarySourceLinecaster3D linecaster = new BoundarySourceLinecaster3D(UNIT_CUBE);
// act/assert
// includes two intersecting boundaries
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(0, 1, 0), Vector3D.Unit.MINUS_X)
.and(Vector3D.of(1, 1, 0), Vector3D.Unit.PLUS_X)
.whenGiven(Segment3D.fromPoints(Vector3D.of(-1, 1, 0), Vector3D.of(2, 1, 0), TEST_PRECISION));
// one intersecting boundary
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(1, 1, 0), Vector3D.Unit.PLUS_X)
.whenGiven(Segment3D.fromPoints(Vector3D.of(0.25, 1, 0), Vector3D.of(2, 1, 0), TEST_PRECISION));
// no intersecting boundary
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returnsNothing()
.whenGiven(Segment3D.fromPoints(Vector3D.of(0.25, 1, 0), Vector3D.of(0.75, 1, 0), TEST_PRECISION));
}
@@ -201,28 +201,28 @@
@Test
public void testLinecast_segment_corners() {
// arrange
- BoundarySourceLinecastWrapper3D wrapper = new BoundarySourceLinecastWrapper3D(UNIT_CUBE);
+ BoundarySourceLinecaster3D linecaster = new BoundarySourceLinecaster3D(UNIT_CUBE);
Vector3D corner = Vector3D.of(1, 1, 1);
// act/assert
// through corner
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(corner, Vector3D.Unit.PLUS_Z)
.and(corner, Vector3D.Unit.PLUS_Y)
.and(corner, Vector3D.Unit.PLUS_X)
.whenGiven(Segment3D.fromPoints(Vector3D.of(0.5, 0.5, 0.5), Vector3D.of(2, 2, 2), TEST_PRECISION));
// starts on corner
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(corner, Vector3D.Unit.PLUS_Z)
.and(corner, Vector3D.Unit.PLUS_Y)
.and(corner, Vector3D.Unit.PLUS_X)
.whenGiven(Segment3D.fromPoints(corner, Vector3D.of(2, 0, 2), TEST_PRECISION));
// ends on corner
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(corner, Vector3D.Unit.PLUS_Z)
.and(corner, Vector3D.Unit.PLUS_Y)
.and(corner, Vector3D.Unit.PLUS_X)
@@ -236,10 +236,10 @@
Facet.fromVertexLoop(Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y), TEST_PRECISION),
Facet.fromVertexLoop(Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_Y, Vector3D.Unit.MINUS_X), TEST_PRECISION)
);
- BoundarySourceLinecastWrapper3D wrapper = new BoundarySourceLinecastWrapper3D(src);
+ BoundarySourceLinecaster3D linecaster = new BoundarySourceLinecaster3D(src);
// act/assert
- LinecastChecker3D.with(wrapper)
+ LinecastChecker3D.with(linecaster)
.returns(Vector3D.of(0, 0.5, 0), Vector3D.Unit.PLUS_Z)
.whenGiven(Segment3D.fromPoints(Vector3D.of(-1, 0.5, 1), Vector3D.of(1, 0.5, -1), TEST_PRECISION));
}
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecastWrapper2DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecaster2DTest.java
similarity index 81%
rename from commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecastWrapper2DTest.java
rename to commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecaster2DTest.java
index 1a61782..bb5c940 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecastWrapper2DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/BoundarySourceLinecaster2DTest.java
@@ -21,7 +21,7 @@
import org.apache.commons.geometry.euclidean.twod.shapes.Parallelogram;
import org.junit.Test;
-public class BoundarySourceLinecastWrapper2DTest {
+public class BoundarySourceLinecaster2DTest {
private static final double TEST_EPS = 1e-10;
@@ -34,22 +34,22 @@
@Test
public void testLinecast_line_simple() {
// arrange
- BoundarySourceLinecastWrapper2D wrapper = new BoundarySourceLinecastWrapper2D(UNIT_SQUARE);
+ BoundarySourceLinecaster2D linecaster = new BoundarySourceLinecaster2D(UNIT_SQUARE);
// act/assert
// no intersections
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returnsNothing()
.whenGiven(Line.fromPointAndDirection(Vector2D.of(0, 4), Vector2D.Unit.MINUS_X, TEST_PRECISION));
// through center; two directions
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(0, 0.5), Vector2D.Unit.MINUS_X)
.and(Vector2D.of(1, 0.5), Vector2D.Unit.PLUS_X)
.whenGiven(Line.fromPointAndDirection(Vector2D.of(0.5, 0.5), Vector2D.Unit.PLUS_X, TEST_PRECISION));
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(1, 0.5), Vector2D.Unit.PLUS_X)
.and(Vector2D.of(0, 0.5), Vector2D.Unit.MINUS_X)
.whenGiven(Line.fromPointAndDirection(Vector2D.of(0.5, 0.5), Vector2D.Unit.MINUS_X, TEST_PRECISION));
@@ -58,10 +58,10 @@
@Test
public void testLinecast_line_alongFace() {
// arrange
- BoundarySourceLinecastWrapper2D wrapper = new BoundarySourceLinecastWrapper2D(UNIT_SQUARE);
+ BoundarySourceLinecaster2D linecaster = new BoundarySourceLinecaster2D(UNIT_SQUARE);
// act/assert
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(0, 1), Vector2D.Unit.MINUS_X)
.and(Vector2D.of(1, 1), Vector2D.Unit.PLUS_X)
.whenGiven(Line.fromPointAndDirection(Vector2D.of(0, 1), Vector2D.Unit.PLUS_X, TEST_PRECISION));
@@ -70,18 +70,18 @@
@Test
public void testLinecast_line_corners() {
// arrange
- BoundarySourceLinecastWrapper2D wrapper = new BoundarySourceLinecastWrapper2D(UNIT_SQUARE);
+ BoundarySourceLinecaster2D linecaster = new BoundarySourceLinecaster2D(UNIT_SQUARE);
// act/assert
// through single corner vertex
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(1, 1), Vector2D.Unit.PLUS_Y)
.and(Vector2D.of(1, 1), Vector2D.Unit.PLUS_X)
.whenGiven(Line.fromPointAndDirection(Vector2D.of(0, 2), Vector2D.of(1, -1), TEST_PRECISION));
// through two corner vertices
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.ZERO, Vector2D.Unit.MINUS_X)
.and(Vector2D.ZERO, Vector2D.Unit.MINUS_Y)
.and(Vector2D.of(1, 1), Vector2D.Unit.PLUS_Y)
@@ -96,10 +96,10 @@
Segment.fromPoints(Vector2D.of(-1, -1), Vector2D.ZERO, TEST_PRECISION),
Segment.fromPoints(Vector2D.ZERO, Vector2D.of(1, 1), TEST_PRECISION)
);
- BoundarySourceLinecastWrapper2D wrapper = new BoundarySourceLinecastWrapper2D(src);
+ BoundarySourceLinecaster2D linecaster = new BoundarySourceLinecaster2D(src);
// act/assert
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.ZERO, Vector2D.Unit.from(1, -1))
.whenGiven(Line.fromPointAndDirection(Vector2D.ZERO, Vector2D.Unit.PLUS_X, TEST_PRECISION));
}
@@ -107,30 +107,30 @@
@Test
public void testLinecast_segment_simple() {
// arrange
- BoundarySourceLinecastWrapper2D wrapper = new BoundarySourceLinecastWrapper2D(UNIT_SQUARE);
+ BoundarySourceLinecaster2D linecaster = new BoundarySourceLinecaster2D(UNIT_SQUARE);
// act/assert
// no intersections; underlying line does not intersect
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returnsNothing()
.whenGiven(Line.fromPointAndDirection(Vector2D.of(0, 4), Vector2D.Unit.MINUS_X, TEST_PRECISION)
.segment(-10, 10));
// no intersections; underlying line does intersect
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returnsNothing()
.whenGiven(Line.fromPointAndDirection(Vector2D.of(0.5, 0.5), Vector2D.Unit.PLUS_X, TEST_PRECISION)
.segment(2, 10));
// no boundaries excluded; two directions
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(0, 0.5), Vector2D.Unit.MINUS_X)
.and(Vector2D.of(1, 0.5), Vector2D.Unit.PLUS_X)
.whenGiven(Line.fromPointAndDirection(Vector2D.of(0.5, 0.5), Vector2D.Unit.PLUS_X, TEST_PRECISION)
.segment(-10, 10));
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(1, 0.5), Vector2D.Unit.PLUS_X)
.and(Vector2D.of(0, 0.5), Vector2D.Unit.MINUS_X)
.whenGiven(Line.fromPointAndDirection(Vector2D.of(0.5, 0.5), Vector2D.Unit.MINUS_X, TEST_PRECISION)
@@ -140,16 +140,16 @@
@Test
public void testLinecast_segment_boundaryExcluded() {
// arrange
- BoundarySourceLinecastWrapper2D wrapper = new BoundarySourceLinecastWrapper2D(UNIT_SQUARE);
+ BoundarySourceLinecaster2D linecaster = new BoundarySourceLinecaster2D(UNIT_SQUARE);
// act/assert
Vector2D center = Vector2D.of(0.5, 0.5);
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(1, 0.5), Vector2D.Unit.PLUS_X)
.whenGiven(Line.fromPointAndDirection(center, Vector2D.Unit.PLUS_X, TEST_PRECISION)
.segmentFrom(center));
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(1, 0.5), Vector2D.Unit.PLUS_X)
.whenGiven(Line.fromPointAndDirection(center, Vector2D.Unit.MINUS_X, TEST_PRECISION)
.segmentTo(center));
@@ -158,10 +158,10 @@
@Test
public void testLinecast_segment_startEndPointsOnBoundaries() {
// arrange
- BoundarySourceLinecastWrapper2D wrapper = new BoundarySourceLinecastWrapper2D(UNIT_SQUARE);
+ BoundarySourceLinecaster2D linecaster = new BoundarySourceLinecaster2D(UNIT_SQUARE);
// act/assert
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(1, 0.5), Vector2D.Unit.PLUS_X)
.and(Vector2D.of(0, 0.5), Vector2D.Unit.MINUS_X)
.whenGiven(Segment.fromPoints(Vector2D.of(1, 0.5), Vector2D.of(0, 0.5), TEST_PRECISION));
@@ -170,23 +170,23 @@
@Test
public void testLinecast_segment_alongFace() {
// arrange
- BoundarySourceLinecastWrapper2D wrapper = new BoundarySourceLinecastWrapper2D(UNIT_SQUARE);
+ BoundarySourceLinecaster2D linecaster = new BoundarySourceLinecaster2D(UNIT_SQUARE);
// act/assert
// includes two intersecting boundaries
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(0, 1), Vector2D.Unit.MINUS_X)
.and(Vector2D.of(1, 1), Vector2D.Unit.PLUS_X)
.whenGiven(Segment.fromPoints(Vector2D.of(-1, 1), Vector2D.of(2, 1), TEST_PRECISION));
// one intersecting boundary
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(1, 1), Vector2D.Unit.PLUS_X)
.whenGiven(Segment.fromPoints(Vector2D.of(0.25, 1), Vector2D.of(2, 1), TEST_PRECISION));
// no intersecting boundary
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returnsNothing()
.whenGiven(Segment.fromPoints(Vector2D.of(0.25, 1), Vector2D.of(0.75, 1), TEST_PRECISION));
}
@@ -194,24 +194,24 @@
@Test
public void testLinecast_segment_corners() {
// arrange
- BoundarySourceLinecastWrapper2D wrapper = new BoundarySourceLinecastWrapper2D(UNIT_SQUARE);
+ BoundarySourceLinecaster2D linecaster = new BoundarySourceLinecaster2D(UNIT_SQUARE);
// act/assert
// through corner
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(1, 1), Vector2D.Unit.PLUS_Y)
.and(Vector2D.of(1, 1), Vector2D.Unit.PLUS_X)
.whenGiven(Segment.fromPoints(Vector2D.of(0, 2), Vector2D.of(2, 0), TEST_PRECISION));
// starts on corner
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(1, 1), Vector2D.Unit.PLUS_Y)
.and(Vector2D.of(1, 1), Vector2D.Unit.PLUS_X)
.whenGiven(Segment.fromPoints(Vector2D.of(1, 1), Vector2D.of(2, 0), TEST_PRECISION));
// ends on corner
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.of(1, 1), Vector2D.Unit.PLUS_Y)
.and(Vector2D.of(1, 1), Vector2D.Unit.PLUS_X)
.whenGiven(Segment.fromPoints(Vector2D.of(0, 2), Vector2D.of(1, 1), TEST_PRECISION));
@@ -224,10 +224,10 @@
Segment.fromPoints(Vector2D.of(-1, -1), Vector2D.ZERO, TEST_PRECISION),
Segment.fromPoints(Vector2D.ZERO, Vector2D.of(1, 1), TEST_PRECISION)
);
- BoundarySourceLinecastWrapper2D wrapper = new BoundarySourceLinecastWrapper2D(src);
+ BoundarySourceLinecaster2D linecaster = new BoundarySourceLinecaster2D(src);
// act/assert
- LinecastChecker2D.with(wrapper)
+ LinecastChecker2D.with(linecaster)
.returns(Vector2D.ZERO, Vector2D.Unit.from(1, -1))
.whenGiven(Segment.fromPoints(Vector2D.ZERO, Vector2D.Unit.PLUS_X, TEST_PRECISION));
}