Merge branch 'GEOMETRY-81__Matt'
Closes #52.
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/BoundarySource3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/BoundarySource3D.java
index 4f29f87..879a22a 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/BoundarySource3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/BoundarySource3D.java
@@ -24,7 +24,7 @@
/** Extension of the {@link BoundarySource} interface for Euclidean 3D
* space.
*/
-public interface BoundarySource3D extends BoundarySource<ConvexSubPlane> {
+public interface BoundarySource3D extends BoundarySource<Facet> {
/** Construct a new BSP tree from the boundaries contained in this
* instance.
@@ -36,20 +36,20 @@
return RegionBSPTree3D.from(this);
}
- /** Return a {@link BoundarySource3D} instance containing the given convex subplanes.
- * @param boundaries convex subplanes to include in the boundary source
+ /** Return a {@link BoundarySource3D} instance containing the given boundaries.
+ * @param boundaries boundaries to include in the boundary source
* @return a boundary source containing the given boundaries
*/
- static BoundarySource3D from(final ConvexSubPlane... boundaries) {
+ static BoundarySource3D from(final Facet... boundaries) {
return from(Arrays.asList(boundaries));
}
- /** Return a {@link BoundarySource3D} instance containing the given convex subplanes. The given
+ /** Return a {@link BoundarySource3D} instance containing the given boundaries. The given
* collection is used directly as the source of the subplanes; no copy is made.
- * @param boundaries convex subplanes to include in the boundary source
+ * @param boundaries boundaries to include in the boundary source
* @return a boundary source containing the given boundaries
*/
- static BoundarySource3D from(final Collection<ConvexSubPlane> boundaries) {
+ static BoundarySource3D from(final Collection<Facet> boundaries) {
return () -> boundaries.stream();
}
}
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 80%
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 05b0b13..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;
}
@@ -68,18 +68,18 @@
.filter(intersection -> intersection != null);
}
- /** Compute the intersection between a boundary subplane and linecast intersecting segment. Null is
+ /** Compute the intersection between a boundary facet and linecast intersecting segment. Null is
* returned if no intersection is discovered.
- * @param boundary boundary from the boundary source
+ * @param facet facet from the boundary source
* @param segment linecast segment to intersect with
* @return the linecast intersection between the two arguments or null if there is no such
* intersection
*/
- private LinecastPoint3D computeIntersection(final ConvexSubPlane boundary, final Segment3D segment) {
- final Vector3D intersectionPt = boundary.intersection(segment);
+ private LinecastPoint3D computeIntersection(final Facet facet, final Segment3D segment) {
+ final Vector3D intersectionPt = facet.intersection(segment);
if (intersectionPt != null) {
- final Vector3D normal = boundary.getPlane().getNormal();
+ final Vector3D normal = facet.getPlane().getNormal();
return new LinecastPoint3D(intersectionPt, normal, segment.getLine());
}
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 03ba3db..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
@@ -29,9 +29,9 @@
import org.apache.commons.geometry.euclidean.twod.ConvexArea;
/** Class representing a finite or infinite convex volume in Euclidean 3D space.
- * The boundaries of this area, if any, are composed of convex subplanes.
+ * The boundaries of this area, if any, are composed of facets.
*/
-public final class ConvexVolume extends AbstractConvexHyperplaneBoundedRegion<Vector3D, ConvexSubPlane>
+public final class ConvexVolume extends AbstractConvexHyperplaneBoundedRegion<Vector3D, Facet>
implements BoundarySource3D, Linecastable3D {
/** Instance representing the full 3D volume. */
@@ -41,13 +41,13 @@
* represents the boundary of a convex area. No validation is performed.
* @param boundaries the boundaries of the convex area
*/
- private ConvexVolume(final List<ConvexSubPlane> boundaries) {
+ private ConvexVolume(final List<Facet> boundaries) {
super(boundaries);
}
/** {@inheritDoc} */
@Override
- public Stream<ConvexSubPlane> boundaryStream() {
+ public Stream<Facet> boundaryStream() {
return getBoundaries().stream();
}
@@ -60,15 +60,15 @@
double volumeSum = 0.0;
- for (ConvexSubPlane subplane : getBoundaries()) {
- if (subplane.isInfinite()) {
+ for (final Facet facet : getBoundaries()) {
+ if (facet.isInfinite()) {
return Double.POSITIVE_INFINITY;
}
- final Plane plane = subplane.getPlane();
- final ConvexArea subarea = subplane.getSubspaceRegion();
+ final Plane plane = facet.getPlane();
+ final ConvexArea subarea = facet.getSubspaceRegion();
- final Vector3D facetBarycenter = subplane.getHyperplane().toSpace(
+ final Vector3D facetBarycenter = facet.getHyperplane().toSpace(
subarea.getBarycenter());
@@ -87,18 +87,18 @@
double sumY = 0.0;
double sumZ = 0.0;
- for (ConvexSubPlane subplane : getBoundaries()) {
- if (subplane.isInfinite()) {
+ for (final Facet facet : getBoundaries()) {
+ if (facet.isInfinite()) {
return null;
}
- final Plane plane = subplane.getPlane();
- final ConvexArea subarea = subplane.getSubspaceRegion();
+ final Plane plane = facet.getPlane();
+ final ConvexArea subarea = facet.getSubspaceRegion();
- final Vector3D facetBarycenter = subplane.getHyperplane().toSpace(
+ final Vector3D facetBarycenter = facet.getHyperplane().toSpace(
subarea.getBarycenter());
- double scaledVolume = subarea.getSize() * facetBarycenter.dot(plane.getNormal());
+ final double scaledVolume = subarea.getSize() * facetBarycenter.dot(plane.getNormal());
volumeSum += scaledVolume;
@@ -126,25 +126,25 @@
/** {@inheritDoc} */
@Override
public Split<ConvexVolume> split(final Hyperplane<Vector3D> splitter) {
- return splitInternal(splitter, this, ConvexSubPlane.class, ConvexVolume::new);
+ return splitInternal(splitter, this, Facet.class, ConvexVolume::new);
}
/** {@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} */
@Override
- public ConvexSubPlane trim(final ConvexSubHyperplane<Vector3D> convexSubHyperplane) {
- return (ConvexSubPlane) super.trim(convexSubHyperplane);
+ public Facet trim(final ConvexSubHyperplane<Vector3D> convexSubHyperplane) {
+ return (Facet) super.trim(convexSubHyperplane);
}
/** Return a new instance transformed by the argument.
@@ -152,7 +152,7 @@
* @return a new instance transformed by the argument
*/
public ConvexVolume transform(final Transform<Vector3D> transform) {
- return transformInternal(transform, this, ConvexSubPlane.class, ConvexVolume::new);
+ return transformInternal(transform, this, Facet.class, ConvexVolume::new);
}
/** Return an instance representing the full 3D volume.
@@ -189,8 +189,8 @@
* meaning that there is no region that is on the minus side of all of the bounding planes.
*/
public static ConvexVolume fromBounds(final Iterable<Plane> boundingPlanes) {
- final List<ConvexSubPlane> subplanes = new ConvexRegionBoundaryBuilder<>(ConvexSubPlane.class)
+ final List<Facet> facets = new ConvexRegionBoundaryBuilder<>(Facet.class)
.build(boundingPlanes);
- return subplanes.isEmpty() ? full() : new ConvexVolume(subplanes);
+ return facets.isEmpty() ? full() : new ConvexVolume(facets);
}
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlane.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Facet.java
similarity index 80%
rename from commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlane.java
rename to commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Facet.java
index cd0d5b4..910ffa1 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlane.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Facet.java
@@ -31,9 +31,9 @@
import org.apache.commons.geometry.euclidean.twod.Vector2D;
/** Class representing a convex subhyperplane in 3 dimensional Euclidean space, meaning
- * a 2D convex area embedded in a plane.
+ * a 2D convex area embedded in a plane. The subhyperplane may be finite or infinite.
*/
-public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea>
+public final class Facet extends AbstractSubPlane<ConvexArea>
implements ConvexSubHyperplane<Vector3D> {
/** The embedded 2D area. */
private final ConvexArea area;
@@ -42,7 +42,7 @@
* @param plane plane the the convex area is embedded in
* @param area the embedded convex area
*/
- private ConvexSubPlane(final Plane plane, final ConvexArea area) {
+ private Facet(final Plane plane, final ConvexArea area) {
super(plane);
this.area = area;
@@ -50,13 +50,13 @@
/** {@inheritDoc} */
@Override
- public List<ConvexSubPlane> toConvex() {
+ public List<Facet> toConvex() {
return Arrays.asList(this);
}
/** {@inheritDoc} */
@Override
- public ConvexSubPlane reverse() {
+ public Facet reverse() {
final Plane plane = getPlane();
final Plane rPlane = plane.reverse();
@@ -66,12 +66,12 @@
final AffineTransformMatrix2D transform =
AffineTransformMatrix2D.fromColumnVectors(rU, rV);
- return new ConvexSubPlane(rPlane, area.transform(transform));
+ return new Facet(rPlane, area.transform(transform));
}
/** {@inheritDoc} */
@Override
- public ConvexSubPlane transform(final Transform<Vector3D> transform) {
+ public Facet transform(final Transform<Vector3D> transform) {
final SubspaceTransform st = getPlane().subspaceTransform(transform);
final ConvexArea tArea = area.transform(st.getTransform());
@@ -86,15 +86,15 @@
/** {@inheritDoc} */
@Override
- public Split<ConvexSubPlane> split(Hyperplane<Vector3D> splitter) {
- return splitInternal(splitter, this, (p, r) -> new ConvexSubPlane(p, (ConvexArea) r));
+ public Split<Facet> split(final Hyperplane<Vector3D> splitter) {
+ return splitInternal(splitter, this, (p, r) -> new Facet(p, (ConvexArea) r));
}
- /** Get the unique intersection of this subplane with the given line. Null is
+ /** Get the unique intersection of this facet with the given line. Null is
* returned if no unique intersection point exists (ie, the line and plane are
- * parallel or coincident) or the line does not intersect the subplane.
- * @param line line to intersect with this subplane
- * @return the unique intersection point between the line and this subplane
+ * parallel or coincident) or the line does not intersect the facet.
+ * @param line line to intersect with this facet
+ * @return the unique intersection point between the line and this facet
* or null if no such point exists.
* @see Plane#intersection(Line3D)
*/
@@ -103,12 +103,12 @@
return (pt != null && contains(pt)) ? pt : null;
}
- /** Get the unique intersection of this subplane with the given segment. Null
+ /** Get the unique intersection of this facet with the given segment. Null
* is returned if the underlying line and plane do not have a unique intersection
* point (ie, they are parallel or coincident) or the intersection point is unique
- * but in not contained in both the segment and subplane.
+ * but is not contained in both the segment and facet.
* @param segment segment to intersect with
- * @return the unique intersection point between this subplane and the argument or
+ * @return the unique intersection point between this facet and the argument or
* null if no such point exists.
* @see Plane#intersection(Line3D)
*/
@@ -117,9 +117,9 @@
return (pt != null && segment.contains(pt)) ? pt : null;
}
- /** Get the vertices for the subplane. The vertices lie at the intersections of the
+ /** Get the vertices for the facet. The vertices lie at the intersections of the
* 2D area bounding lines.
- * @return the vertices for the subplane
+ * @return the vertices for the facets
*/
public List<Vector3D> getVertices() {
return getPlane().toSpace(area.getVertices());
@@ -130,15 +130,15 @@
* @param area area embedded in the plane
* @return a new convex sub plane instance
*/
- public static ConvexSubPlane fromConvexArea(final Plane plane, final ConvexArea area) {
- return new ConvexSubPlane(plane, area);
+ public static Facet fromConvexArea(final Plane plane, final ConvexArea area) {
+ return new Facet(plane, area);
}
/** Create a new instance from the given sequence of points. The points must define a unique plane, meaning that
* at least 3 unique vertices must be given. In contrast with the
* {@link #fromVertices(Collection, DoublePrecisionContext)} method, the first point in the sequence is included
* at the end if needed, in order to form a closed loop.
- * @param pts collection of points defining the convex subplane
+ * @param pts collection of points defining the facets
* @param precision precision context used to compare floating point values
* @return a new instance defined by the given sequence of vertices
* @throws IllegalArgumentException if fewer than 3 vertices are given or the vertices do not define a
@@ -147,14 +147,14 @@
* @see #fromVertices(Collection, boolean, DoublePrecisionContext)
* @see Plane#fromPoints(Collection, DoublePrecisionContext)
*/
- public static ConvexSubPlane fromVertexLoop(final Collection<Vector3D> pts,
+ public static Facet fromVertexLoop(final Collection<Vector3D> pts,
final DoublePrecisionContext precision) {
return fromVertices(pts, true, precision);
}
/** Create a new instance from the given sequence of points. The points must define a unique plane, meaning that
* at least 3 unique vertices must be given.
- * @param pts collection of points defining the convex subplane
+ * @param pts collection of points defining the facet
* @param precision precision context used to compare floating point values
* @return a new instance defined by the given sequence of vertices
* @throws IllegalArgumentException if fewer than 3 vertices are given or the vertices do not define a
@@ -163,7 +163,7 @@
* @see #fromVertices(Collection, boolean, DoublePrecisionContext)
* @see Plane#fromPoints(Collection, DoublePrecisionContext)
*/
- public static ConvexSubPlane fromVertices(final Collection<Vector3D> pts,
+ public static Facet fromVertices(final Collection<Vector3D> pts,
final DoublePrecisionContext precision) {
return fromVertices(pts, false, precision);
}
@@ -175,14 +175,14 @@
* @param close if true, the point sequence will implicitly include the start point again at the end; otherwise
* the vertex sequence is taken as-is
* @param precision precision context used to compare floating point values
- * @return a new convex subplane instance
+ * @return a new facet instance
* @throws IllegalArgumentException if fewer than 3 vertices are given or the vertices do not define a
* unique plane
* @see #fromVertexLoop(Collection, DoublePrecisionContext)
* @see #fromVertices(Collection, DoublePrecisionContext)
* @see Plane#fromPoints(Collection, DoublePrecisionContext)
*/
- public static ConvexSubPlane fromVertices(final Collection<Vector3D> pts, final boolean close,
+ public static Facet fromVertices(final Collection<Vector3D> pts, final boolean close,
final DoublePrecisionContext precision) {
final Plane plane = Plane.fromPoints(pts, precision);
@@ -190,6 +190,6 @@
final List<Vector2D> subspacePts = plane.toSubspace(pts);
final ConvexArea area = ConvexArea.fromVertices(subspacePts, close, precision);
- return new ConvexSubPlane(plane, area);
+ return new Facet(plane, area);
}
}
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
index 7ffe3ee..e094856 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Plane.java
@@ -426,8 +426,8 @@
/** {@inheritDoc} */
@Override
- public ConvexSubPlane span() {
- return ConvexSubPlane.fromConvexArea(this, ConvexArea.full());
+ public Facet span() {
+ return Facet.fromConvexArea(this, ConvexArea.full());
}
/**
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3D.java
index c96ed7e..39a478f 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3D.java
@@ -65,20 +65,20 @@
/** {@inheritDoc} */
@Override
- public Iterable<ConvexSubPlane> boundaries() {
- return createBoundaryIterable(b -> (ConvexSubPlane) b);
+ public Iterable<Facet> boundaries() {
+ return createBoundaryIterable(b -> (Facet) b);
}
/** {@inheritDoc} */
@Override
- public Stream<ConvexSubPlane> boundaryStream() {
+ public Stream<Facet> boundaryStream() {
return StreamSupport.stream(boundaries().spliterator(), false);
}
/** {@inheritDoc} */
@Override
- public List<ConvexSubPlane> getBoundaries() {
- return createBoundaryList(b -> (ConvexSubPlane) b);
+ public List<Facet> getBoundaries() {
+ return createBoundaryList(b -> (Facet) b);
}
/** Return a list of {@link ConvexVolume}s representing the same region
@@ -195,7 +195,7 @@
* @param boundaries boundaries to construct the tree from
* @return a new tree instance constructed from the given boundaries
*/
- public static RegionBSPTree3D from(final Iterable<ConvexSubPlane> boundaries) {
+ public static RegionBSPTree3D from(final Iterable<Facet> boundaries) {
RegionBSPTree3D tree = RegionBSPTree3D.full();
tree.insert(boundaries);
@@ -208,7 +208,7 @@
* @return a new tree instance constructed from the boundaries in the
* given source
*/
- public static RegionBSPTree3D from(final BoundarySource<ConvexSubPlane> boundarySrc) {
+ public static RegionBSPTree3D from(final BoundarySource<Facet> boundarySrc) {
RegionBSPTree3D tree = RegionBSPTree3D.full();
tree.insert(boundarySrc);
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubPlane.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubPlane.java
index 2fb4e17..8eb13c6 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubPlane.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SubPlane.java
@@ -66,17 +66,17 @@
/** {@inheritDoc} */
@Override
- public List<ConvexSubPlane> toConvex() {
+ public List<Facet> toConvex() {
final List<ConvexArea> areas = region.toConvex();
final Plane plane = getPlane();
- final List<ConvexSubPlane> subplanes = new ArrayList<>(areas.size());
+ final List<Facet> facets = new ArrayList<>(areas.size());
for (final ConvexArea area : areas) {
- subplanes.add(ConvexSubPlane.fromConvexArea(plane, area));
+ facets.add(Facet.fromConvexArea(plane, area));
}
- return subplanes;
+ return facets;
}
/** {@inheritDoc}
@@ -112,20 +112,20 @@
return new SubPlane(subTransform.getPlane(), tRegion);
}
- /** Add a convex subplane to this instance.
- * @param subplane convex subplane to add
- * @throws IllegalArgumentException if the given convex subplane is not from
+ /** Add a facet (convex subplane) to this instance.
+ * @param facet facet to add
+ * @throws IllegalArgumentException if the given facet is not from
* a plane equivalent to this instance
*/
- public void add(final ConvexSubPlane subplane) {
- validatePlane(subplane.getPlane());
+ public void add(final Facet facet) {
+ validatePlane(facet.getPlane());
- region.add(subplane.getSubspaceRegion());
+ region.add(facet.getSubspaceRegion());
}
/** Add a subplane to this instance.
* @param subplane subplane to add
- * @throws IllegalArgumentException if the given convex subplane is not from
+ * @throws IllegalArgumentException if the given subplane is not from
* a plane equivalent to this instance
*/
public void add(final SubPlane subplane) {
@@ -186,8 +186,8 @@
* @param sub the subhyperplane to add; either convex or non-convex
*/
private void addInternal(final SubHyperplane<Vector3D> sub) {
- if (sub instanceof ConvexSubPlane) {
- subplane.add((ConvexSubPlane) sub);
+ if (sub instanceof Facet) {
+ subplane.add((Facet) sub);
} else if (sub instanceof SubPlane) {
subplane.add((SubPlane) sub);
} else {
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/shapes/Parallelepiped.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/shapes/Parallelepiped.java
index 31d468c..e2355fa 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/shapes/Parallelepiped.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/shapes/Parallelepiped.java
@@ -20,7 +20,7 @@
import java.util.List;
import org.apache.commons.geometry.core.precision.DoublePrecisionContext;
-import org.apache.commons.geometry.euclidean.threed.ConvexSubPlane;
+import org.apache.commons.geometry.euclidean.threed.Facet;
import org.apache.commons.geometry.euclidean.threed.Vector3D;
/** Class containing utility methods for constructing parallelepipeds. Parallelepipeds
@@ -35,17 +35,17 @@
private Parallelepiped() {
}
- /** Return a list of {@link ConvexSubPlane}s defining an axis-aligned parallelepiped, ie, a rectangular prism.
+ /** Return a list of {@link Facet}s defining an axis-aligned parallelepiped, ie, a rectangular prism.
* The points {@code a} and {@code b} are taken to represent opposite corner points in the prism and may be
* specified in any order.
* @param a first corner point in the prism (opposite of {@code b})
* @param b second corner point in the prism (opposite of {@code a})
- * @param precision precision context used to construct convex subplane instances
+ * @param precision precision context used to construct facet instances
* @return a list containing the boundaries of the rectangular prism
* @throws IllegalArgumentException if the width, height, or depth of the defined prism is zero
* as evaluated by the precision context.
*/
- public static List<ConvexSubPlane> axisAligned(final Vector3D a, final Vector3D b,
+ public static List<Facet> axisAligned(final Vector3D a, final Vector3D b,
final DoublePrecisionContext precision) {
final double minX = Math.min(a.getX(), b.getX());
@@ -75,16 +75,16 @@
return Arrays.asList(
// -z and +z sides
- ConvexSubPlane.fromVertexLoop(Arrays.asList(vertices[0], vertices[3], vertices[2], vertices[1]), precision),
- ConvexSubPlane.fromVertexLoop(Arrays.asList(vertices[4], vertices[5], vertices[6], vertices[7]), precision),
+ Facet.fromVertexLoop(Arrays.asList(vertices[0], vertices[3], vertices[2], vertices[1]), precision),
+ Facet.fromVertexLoop(Arrays.asList(vertices[4], vertices[5], vertices[6], vertices[7]), precision),
// -x and +x sides
- ConvexSubPlane.fromVertexLoop(Arrays.asList(vertices[0], vertices[4], vertices[7], vertices[3]), precision),
- ConvexSubPlane.fromVertexLoop(Arrays.asList(vertices[5], vertices[1], vertices[2], vertices[6]), precision),
+ Facet.fromVertexLoop(Arrays.asList(vertices[0], vertices[4], vertices[7], vertices[3]), precision),
+ Facet.fromVertexLoop(Arrays.asList(vertices[5], vertices[1], vertices[2], vertices[6]), precision),
// -y and +y sides
- ConvexSubPlane.fromVertexLoop(Arrays.asList(vertices[0], vertices[1], vertices[5], vertices[4]), precision),
- ConvexSubPlane.fromVertexLoop(Arrays.asList(vertices[3], vertices[7], vertices[6], vertices[2]), precision)
+ Facet.fromVertexLoop(Arrays.asList(vertices[0], vertices[1], vertices[5], vertices[4]), precision),
+ Facet.fromVertexLoop(Arrays.asList(vertices[3], vertices[7], vertices[6], vertices[2]), precision)
);
}
}
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/DocumentationExamplesTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/DocumentationExamplesTest.java
index c04f37d..42f9c98 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
@@ -28,7 +28,7 @@
import org.apache.commons.geometry.euclidean.oned.RegionBSPTree1D;
import org.apache.commons.geometry.euclidean.oned.Vector1D;
import org.apache.commons.geometry.euclidean.threed.AffineTransformMatrix3D;
-import org.apache.commons.geometry.euclidean.threed.ConvexSubPlane;
+import org.apache.commons.geometry.euclidean.threed.Facet;
import org.apache.commons.geometry.euclidean.threed.Line3D;
import org.apache.commons.geometry.euclidean.threed.LinecastPoint3D;
import org.apache.commons.geometry.euclidean.threed.Plane;
@@ -394,7 +394,7 @@
Vector3D b3 = Vector3D.of(-0.5, -0.5, 0.0);
Vector3D b4 = Vector3D.of(-0.5, 0.5, 0.0);
- Vector3D[][] faces = {
+ Vector3D[][] faceIndices = {
{b1, a1, b2},
{b2, a1, b3},
{b3, a1, b4},
@@ -402,10 +402,10 @@
{b1, b2, b3, b4}
};
- // convert the faces to convex sub planes and insert into a bsp tree
+ // convert the vertices to facets and insert into a bsp tree
RegionBSPTree3D tree = RegionBSPTree3D.empty();
- Arrays.stream(faces)
- .map(vertices -> ConvexSubPlane.fromVertexLoop(Arrays.asList(vertices), precision))
+ Arrays.stream(faceIndices)
+ .map(vertices -> Facet.fromVertexLoop(Arrays.asList(vertices), precision))
.forEach(tree::insert);
// split the region through its barycenter along a diagonal of the base
@@ -417,7 +417,7 @@
RegionBSPTree3D minus = split.getMinus();
double minusSize = minus.getSize(); // 1/6
- List<ConvexSubPlane> minusFacets = minus.getBoundaries(); // size = 4
+ List<Facet> minusFacets = minus.getBoundaries(); // size = 4
// ---------------------
Assert.assertEquals(1.0 / 6.0, minusSize, TEST_EPS);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/BoundarySource3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/BoundarySource3DTest.java
index 5c03f66..496109a 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/BoundarySource3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/BoundarySource3DTest.java
@@ -39,22 +39,22 @@
BoundarySource3D src = BoundarySource3D.from();
// assert
- List<ConvexSubPlane> segments = src.boundaryStream().collect(Collectors.toList());
+ List<Facet> segments = src.boundaryStream().collect(Collectors.toList());
Assert.assertEquals(0, segments.size());
}
@Test
public void testFrom_varargs() {
// act
- ConvexSubPlane a = ConvexSubPlane.fromVertexLoop(
+ Facet a = Facet.fromVertexLoop(
Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y), TEST_PRECISION);
- ConvexSubPlane b = ConvexSubPlane.fromVertexLoop(
+ Facet b = Facet.fromVertexLoop(
Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_Y, Vector3D.Unit.MINUS_Z), TEST_PRECISION);
BoundarySource3D src = BoundarySource3D.from(a, b);
// assert
- List<ConvexSubPlane> boundaries = src.boundaryStream().collect(Collectors.toList());
+ List<Facet> boundaries = src.boundaryStream().collect(Collectors.toList());
Assert.assertEquals(2, boundaries.size());
Assert.assertSame(a, boundaries.get(0));
@@ -64,32 +64,32 @@
@Test
public void testFrom_list_empty() {
// arrange
- List<ConvexSubPlane> input = new ArrayList<>();
+ List<Facet> input = new ArrayList<>();
// act
BoundarySource3D src = BoundarySource3D.from(input);
// assert
- List<ConvexSubPlane> segments = src.boundaryStream().collect(Collectors.toList());
+ List<Facet> segments = src.boundaryStream().collect(Collectors.toList());
Assert.assertEquals(0, segments.size());
}
@Test
public void testFrom_list() {
// act
- ConvexSubPlane a = ConvexSubPlane.fromVertexLoop(
+ Facet a = Facet.fromVertexLoop(
Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y), TEST_PRECISION);
- ConvexSubPlane b = ConvexSubPlane.fromVertexLoop(
+ Facet b = Facet.fromVertexLoop(
Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_Y, Vector3D.Unit.MINUS_Z), TEST_PRECISION);
- List<ConvexSubPlane> input = new ArrayList<>();
+ List<Facet> input = new ArrayList<>();
input.add(a);
input.add(b);
BoundarySource3D src = BoundarySource3D.from(input);
// assert
- List<ConvexSubPlane> segments = src.boundaryStream().collect(Collectors.toList());
+ List<Facet> segments = src.boundaryStream().collect(Collectors.toList());
Assert.assertEquals(2, segments.size());
Assert.assertSame(a, segments.get(0));
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 77%
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 702ea6b..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)
@@ -100,13 +100,13 @@
public void testLinecast_line_removesDuplicatePoints() {
// arrange
BoundarySource3D src = BoundarySource3D.from(
- ConvexSubPlane.fromVertexLoop(Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y), TEST_PRECISION),
- ConvexSubPlane.fromVertexLoop(Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_Y, Vector3D.Unit.MINUS_X), TEST_PRECISION)
+ 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)
@@ -233,13 +233,13 @@
public void testLinecast_segment_removesDuplicatePoints() {
// arrange
BoundarySource3D src = BoundarySource3D.from(
- ConvexSubPlane.fromVertexLoop(Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y), TEST_PRECISION),
- ConvexSubPlane.fromVertexLoop(Arrays.asList(Vector3D.ZERO, Vector3D.Unit.PLUS_Y, Vector3D.Unit.MINUS_X), TEST_PRECISION)
+ 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/threed/ConvexVolumeTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexVolumeTest.java
index eff7ca0..064ac21 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexVolumeTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexVolumeTest.java
@@ -62,12 +62,12 @@
ConvexVolume volume = ConvexVolume.fromBounds(plane);
// act
- List<ConvexSubPlane> boundaries = volume.boundaryStream().collect(Collectors.toList());
+ List<Facet> boundaries = volume.boundaryStream().collect(Collectors.toList());
// assert
Assert.assertEquals(1, boundaries.size());
- ConvexSubPlane sp = boundaries.get(0);
+ Facet sp = boundaries.get(0);
Assert.assertEquals(0, sp.getSubspaceRegion().getBoundaries().size());
Assert.assertSame(plane, sp.getPlane());
}
@@ -78,7 +78,7 @@
ConvexVolume volume = ConvexVolume.full();
// act
- List<ConvexSubPlane> boundaries = volume.boundaryStream().collect(Collectors.toList());
+ List<Facet> boundaries = volume.boundaryStream().collect(Collectors.toList());
// assert
Assert.assertEquals(0, boundaries.size());
@@ -173,11 +173,11 @@
// arrange
ConvexVolume vol = rect(Vector3D.ZERO, 0.5, 0.5, 0.5);
- ConvexSubPlane subplane = ConvexSubPlane.fromConvexArea(
+ Facet subplane = Facet.fromConvexArea(
Plane.fromNormal(Vector3D.Unit.PLUS_X, TEST_PRECISION), ConvexArea.full());
// act
- ConvexSubPlane trimmed = vol.trim(subplane);
+ Facet trimmed = vol.trim(subplane);
// assert
Assert.assertEquals(1, trimmed.getSize(), TEST_EPS);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/FacetTest.java
similarity index 87%
rename from commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java
rename to commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/FacetTest.java
index 0f3ba79..ba6129e 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/FacetTest.java
@@ -35,7 +35,7 @@
import org.junit.Assert;
import org.junit.Test;
-public class ConvexSubPlaneTest {
+public class FacetTest {
private static final double TEST_EPS = 1e-10;
@@ -55,7 +55,7 @@
), TEST_PRECISION);
// act
- ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, area);
+ Facet sp = Facet.fromConvexArea(plane, area);
// assert
Assert.assertFalse(sp.isFull());
@@ -72,7 +72,7 @@
@Test
public void testFromVertices_infinite() {
// act
- ConvexSubPlane sp = ConvexSubPlane.fromVertices(Arrays.asList(
+ Facet sp = Facet.fromVertices(Arrays.asList(
Vector3D.of(1, 0, 0),
Vector3D.of(1, 1, 0),
Vector3D.of(1, 1, 1)
@@ -112,7 +112,7 @@
@Test
public void testFromVertices_finite() {
// act
- ConvexSubPlane sp = ConvexSubPlane.fromVertices(Arrays.asList(
+ Facet sp = Facet.fromVertices(Arrays.asList(
Vector3D.of(1, 0, 0),
Vector3D.of(1, 1, 0),
Vector3D.of(1, 1, 2),
@@ -153,7 +153,7 @@
@Test
public void testFromVertexLoop() {
// act
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(1, 0, 0),
Vector3D.of(1, 1, 0),
Vector3D.of(1, 1, 2)
@@ -193,11 +193,11 @@
@Test
public void testToConvex() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(
+ Facet sp = Facet.fromVertexLoop(
Arrays.asList(Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y, Vector3D.Unit.PLUS_Z), TEST_PRECISION);
// act
- List<ConvexSubPlane> convex = sp.toConvex();
+ List<Facet> convex = sp.toConvex();
// assert
Assert.assertEquals(1, convex.size());
@@ -208,7 +208,7 @@
public void testGetVertices_full() {
// arrange
Plane plane = Plane.fromNormal(Vector3D.Unit.PLUS_Z, TEST_PRECISION);
- ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.full());
+ Facet sp = Facet.fromConvexArea(plane, ConvexArea.full());
// act
List<Vector3D> vertices = sp.getVertices();
@@ -221,7 +221,7 @@
public void testGetVertices_twoParallelLines() {
// arrange
Plane plane = Plane.fromNormal(Vector3D.Unit.PLUS_Z, TEST_PRECISION);
- ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.fromBounds(
+ Facet sp = Facet.fromConvexArea(plane, ConvexArea.fromBounds(
Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION),
Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION)
));
@@ -237,7 +237,7 @@
public void testGetVertices_infiniteWithVertices() {
// arrange
Plane plane = Plane.fromPointAndPlaneVectors(Vector3D.of(0, 0, 1), Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y, TEST_PRECISION);
- ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.fromBounds(
+ Facet sp = Facet.fromConvexArea(plane, ConvexArea.fromBounds(
Line.fromPointAndAngle(Vector2D.of(0, 1), PlaneAngleRadians.PI, TEST_PRECISION),
Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION),
Line.fromPointAndAngle(Vector2D.of(1, 0), PlaneAngleRadians.PI_OVER_TWO, TEST_PRECISION)
@@ -257,7 +257,7 @@
public void testGetVertices_finite() {
// arrange
Plane plane = Plane.fromPointAndPlaneVectors(Vector3D.of(0, 0, 1), Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y, TEST_PRECISION);
- ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromConvexArea(plane, ConvexArea.fromVertexLoop(Arrays.asList(
Vector2D.ZERO,
Vector2D.Unit.PLUS_X,
Vector2D.Unit.PLUS_Y
@@ -282,10 +282,10 @@
Vector3D p2 = Vector3D.of(2, 0, 1);
Vector3D p3 = Vector3D.of(1, 1, 1);
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(p1, p2, p3), TEST_PRECISION);
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(p1, p2, p3), TEST_PRECISION);
// act
- ConvexSubPlane reversed = sp.reverse();
+ Facet reversed = sp.reverse();
// assert
Assert.assertEquals(sp.getPlane().reverse(), reversed.getPlane());
@@ -304,14 +304,14 @@
public void testTransform_full() {
// arrange
Plane plane = Plane.fromPointAndPlaneVectors(Vector3D.Unit.PLUS_Z, Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y, TEST_PRECISION);
- ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.full());
+ Facet sp = Facet.fromConvexArea(plane, ConvexArea.full());
AffineTransformMatrix3D transform = AffineTransformMatrix3D.identity()
.rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, PlaneAngleRadians.PI_OVER_TWO))
.translate(Vector3D.Unit.PLUS_Y);
// act
- ConvexSubPlane transformed = sp.transform(transform);
+ Facet transformed = sp.transform(transform);
// assert
Assert.assertTrue(transformed.isFull());
@@ -324,14 +324,14 @@
public void testTransform_halfSpace() {
// arrange
Plane plane = Plane.fromPointAndPlaneVectors(Vector3D.Unit.PLUS_Z, Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y, TEST_PRECISION);
- ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane,
+ Facet sp = Facet.fromConvexArea(plane,
ConvexArea.fromBounds(Line.fromPoints(Vector2D.of(1, 0), Vector2D.of(1, 1), TEST_PRECISION)));
AffineTransformMatrix3D transform = AffineTransformMatrix3D.createRotation(Vector3D.Unit.PLUS_Z,
QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
- ConvexSubPlane transformed = sp.transform(transform);
+ Facet transformed = sp.transform(transform);
// assert
Assert.assertFalse(transformed.isFull());
@@ -343,14 +343,14 @@
@Test
public void testTransform_finite() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(
+ Facet sp = Facet.fromVertexLoop(
Arrays.asList(Vector3D.of(1, 0, 0), Vector3D.of(0, 1, 0), Vector3D.of(0, 0, 1)), TEST_PRECISION);
Transform<Vector3D> transform = AffineTransformMatrix3D.createScale(2)
.rotate(QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, PlaneAngleRadians.PI_OVER_TWO));
// act
- ConvexSubPlane transformed = sp.transform(transform);
+ Facet transformed = sp.transform(transform);
// assert
Vector3D midpt = Vector3D.of(2, 2, -2).multiply(1 / 3.0);
@@ -368,13 +368,13 @@
@Test
public void testTransform_reflection() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(
+ Facet sp = Facet.fromVertexLoop(
Arrays.asList(Vector3D.of(1, 0, 0), Vector3D.of(0, 1, 0), Vector3D.of(0, 0, 1)), TEST_PRECISION);
Transform<Vector3D> transform = AffineTransformMatrix3D.createScale(-1, 1, 1);
// act
- ConvexSubPlane transformed = sp.transform(transform);
+ Facet transformed = sp.transform(transform);
// assert
Vector3D midpt = Vector3D.of(-1, 1, 1).multiply(1 / 3.0);
@@ -393,23 +393,23 @@
public void testSplit_full() {
// arrange
Plane plane = Plane.fromPointAndNormal(Vector3D.ZERO, Vector3D.Unit.PLUS_Z, TEST_PRECISION);
- ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.full());
+ Facet sp = Facet.fromConvexArea(plane, ConvexArea.full());
Plane splitter = Plane.fromPointAndNormal(Vector3D.ZERO, Vector3D.Unit.PLUS_X, TEST_PRECISION);
// act
- Split<ConvexSubPlane> split = sp.split(splitter);
+ Split<Facet> split = sp.split(splitter);
// assert
Assert.assertEquals(SplitLocation.BOTH, split.getLocation());
- ConvexSubPlane minus = split.getMinus();
+ Facet minus = split.getMinus();
Assert.assertEquals(1, minus.getSubspaceRegion().getBoundaries().size());
checkPoints(minus, RegionLocation.BOUNDARY, Vector3D.ZERO, Vector3D.Unit.PLUS_Y, Vector3D.Unit.MINUS_Y);
checkPoints(minus, RegionLocation.INSIDE, Vector3D.Unit.MINUS_X);
checkPoints(minus, RegionLocation.OUTSIDE, Vector3D.Unit.PLUS_X);
- ConvexSubPlane plus = split.getPlus();
+ Facet plus = split.getPlus();
Assert.assertEquals(1, plus.getSubspaceRegion().getBoundaries().size());
checkPoints(plus, RegionLocation.BOUNDARY, Vector3D.ZERO, Vector3D.Unit.PLUS_Y, Vector3D.Unit.MINUS_Y);
checkPoints(plus, RegionLocation.INSIDE, Vector3D.Unit.PLUS_X);
@@ -419,62 +419,62 @@
@Test
public void testSplit_both() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0)
), TEST_PRECISION);
Plane splitter = Plane.fromPointAndNormal(Vector3D.ZERO, Vector3D.Unit.PLUS_Z, TEST_PRECISION);
// act
- Split<ConvexSubPlane> split = sp.split(splitter);
+ Split<Facet> split = sp.split(splitter);
// assert
Assert.assertEquals(SplitLocation.BOTH, split.getLocation());
- ConvexSubPlane minus = split.getMinus();
+ Facet minus = split.getMinus();
checkVertices(minus, Vector3D.of(1, 1, 0), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0), Vector3D.of(1, 1, 0));
- ConvexSubPlane plus = split.getPlus();
+ Facet plus = split.getPlus();
checkVertices(plus, Vector3D.of(1, 1, 1), Vector3D.of(1, 1, 0), Vector3D.of(0, 2, 0), Vector3D.of(1, 1, 1));
}
@Test
public void testSplit_plusOnly() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0)
), TEST_PRECISION);
Plane splitter = Plane.fromPointAndNormal(Vector3D.of(0, 0, -3.1), Vector3D.Unit.PLUS_Z, TEST_PRECISION);
// act
- Split<ConvexSubPlane> split = sp.split(splitter);
+ Split<Facet> split = sp.split(splitter);
// assert
Assert.assertEquals(SplitLocation.PLUS, split.getLocation());
Assert.assertNull(split.getMinus());
- ConvexSubPlane plus = split.getPlus();
+ Facet plus = split.getPlus();
checkVertices(plus, Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0), Vector3D.of(1, 1, 1));
}
@Test
public void testSplit_minusOnly() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0)
), TEST_PRECISION);
Plane splitter = Plane.fromPointAndNormal(Vector3D.of(0, 0, 1.1), Vector3D.Unit.PLUS_Z, TEST_PRECISION);
// act
- Split<ConvexSubPlane> split = sp.split(splitter);
+ Split<Facet> split = sp.split(splitter);
// assert
Assert.assertEquals(SplitLocation.MINUS, split.getLocation());
- ConvexSubPlane minus = split.getMinus();
+ Facet minus = split.getMinus();
checkVertices(minus, Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0), Vector3D.of(1, 1, 1));
Assert.assertNull(split.getPlus());
@@ -483,14 +483,14 @@
@Test
public void testSplit_parallelSplitter_on() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0)
), TEST_PRECISION);
Plane splitter = sp.getPlane();
// act
- Split<ConvexSubPlane> split = sp.split(splitter);
+ Split<Facet> split = sp.split(splitter);
// assert
Assert.assertEquals(SplitLocation.NEITHER, split.getLocation());
@@ -502,7 +502,7 @@
@Test
public void testSplit_parallelSplitter_minus() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0)
), TEST_PRECISION);
@@ -510,7 +510,7 @@
Plane splitter = plane.translate(plane.getNormal());
// act
- Split<ConvexSubPlane> split = sp.split(splitter);
+ Split<Facet> split = sp.split(splitter);
// assert
Assert.assertEquals(SplitLocation.MINUS, split.getLocation());
@@ -522,7 +522,7 @@
@Test
public void testSplit_parallelSplitter_plus() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0)
), TEST_PRECISION);
@@ -530,7 +530,7 @@
Plane splitter = plane.translate(plane.getNormal().negate());
// act
- Split<ConvexSubPlane> split = sp.split(splitter);
+ Split<Facet> split = sp.split(splitter);
// assert
Assert.assertEquals(SplitLocation.PLUS, split.getLocation());
@@ -542,14 +542,14 @@
@Test
public void testSplit_antiParallelSplitter_on() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0)
), TEST_PRECISION);
Plane splitter = sp.getPlane().reverse();
// act
- Split<ConvexSubPlane> split = sp.split(splitter);
+ Split<Facet> split = sp.split(splitter);
// assert
Assert.assertEquals(SplitLocation.NEITHER, split.getLocation());
@@ -561,7 +561,7 @@
@Test
public void testSplit_antiParallelSplitter_minus() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0)
), TEST_PRECISION);
@@ -569,7 +569,7 @@
Plane splitter = plane.translate(plane.getNormal());
// act
- Split<ConvexSubPlane> split = sp.split(splitter);
+ Split<Facet> split = sp.split(splitter);
// assert
Assert.assertEquals(SplitLocation.MINUS, split.getLocation());
@@ -581,7 +581,7 @@
@Test
public void testSplit_antiParallelSplitter_plus() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(1, 1, 1), Vector3D.of(1, 1, -3), Vector3D.of(0, 2, 0)
), TEST_PRECISION);
@@ -589,7 +589,7 @@
Plane splitter = plane.translate(plane.getNormal().negate());
// act
- Split<ConvexSubPlane> split = sp.split(splitter);
+ Split<Facet> split = sp.split(splitter);
// assert
Assert.assertEquals(SplitLocation.PLUS, split.getLocation());
@@ -601,7 +601,7 @@
@Test
public void testIntersection_line() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(0, 0, 2), Vector3D.of(1, 0, 2), Vector3D.of(1, 1, 2), Vector3D.of(0, 1, 2)),
TEST_PRECISION);
@@ -621,7 +621,7 @@
@Test
public void testIntersection_segment() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.of(0, 0, 2), Vector3D.of(1, 0, 2), Vector3D.of(1, 1, 2), Vector3D.of(0, 1, 2)),
TEST_PRECISION);
@@ -643,7 +643,7 @@
@Test
public void testToString() {
// arrange
- ConvexSubPlane sp = ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet sp = Facet.fromVertexLoop(Arrays.asList(
Vector3D.ZERO,
Vector3D.Unit.PLUS_X,
Vector3D.Unit.PLUS_Y
@@ -682,13 +682,13 @@
EuclideanTestUtils.assertCoordinatesEqual(origin, plane.getNormal().multiply(-offset), TEST_EPS);
}
- private static void checkPoints(ConvexSubPlane sp, RegionLocation loc, Vector3D... pts) {
+ private static void checkPoints(Facet sp, RegionLocation loc, Vector3D... pts) {
for (Vector3D pt : pts) {
- Assert.assertEquals("Unexpected subplane location for point " + pt, loc, sp.classify(pt));
+ Assert.assertEquals("Unexpected location for point " + pt, loc, sp.classify(pt));
}
}
- private static void checkVertices(ConvexSubPlane sp, Vector3D... pts) {
+ private static void checkVertices(Facet sp, Vector3D... pts) {
List<Vector3D> actual = sp.getPlane().toSpace(
sp.getSubspaceRegion().getBoundaryPaths().get(0).getVertices());
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/PlaneTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/PlaneTest.java
index ba51155..a0e7044 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/PlaneTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/PlaneTest.java
@@ -948,7 +948,7 @@
Plane plane = Plane.fromPointAndNormal(Vector3D.ZERO, Vector3D.Unit.PLUS_Z, TEST_PRECISION);
// act
- ConvexSubPlane sub = plane.span();
+ Facet sub = plane.span();
// assert
Assert.assertSame(plane, sub.getPlane());
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3DTest.java
index e3e8c52..e8f3e19 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/RegionBSPTree3DTest.java
@@ -129,11 +129,11 @@
RegionBSPTree3D tree = createRect(Vector3D.ZERO, Vector3D.of(1, 1, 1));
// act
- List<ConvexSubPlane> subplanes = new ArrayList<>();
- tree.boundaries().forEach(subplanes::add);
+ List<Facet> facets = new ArrayList<>();
+ tree.boundaries().forEach(facets::add);
// assert
- Assert.assertEquals(6, subplanes.size());
+ Assert.assertEquals(6, facets.size());
}
@Test
@@ -142,10 +142,10 @@
RegionBSPTree3D tree = createRect(Vector3D.ZERO, Vector3D.of(1, 1, 1));
// act
- List<ConvexSubPlane> subplanes = tree.getBoundaries();
+ List<Facet> facets = tree.getBoundaries();
// assert
- Assert.assertEquals(6, subplanes.size());
+ Assert.assertEquals(6, facets.size());
}
@Test
@@ -154,10 +154,10 @@
RegionBSPTree3D tree = createRect(Vector3D.ZERO, Vector3D.of(1, 1, 1));
// act
- List<ConvexSubPlane> subplanes = tree.boundaryStream().collect(Collectors.toList());
+ List<Facet> facets = tree.boundaryStream().collect(Collectors.toList());
// assert
- Assert.assertEquals(6, subplanes.size());
+ Assert.assertEquals(6, facets.size());
}
@Test
@@ -166,10 +166,10 @@
RegionBSPTree3D tree = RegionBSPTree3D.full();
// act
- List<ConvexSubPlane> subplanes = tree.boundaryStream().collect(Collectors.toList());
+ List<Facet> facets = tree.boundaryStream().collect(Collectors.toList());
// assert
- Assert.assertEquals(0, subplanes.size());
+ Assert.assertEquals(0, facets.size());
}
@Test
@@ -224,9 +224,9 @@
public void testFrom_boundaries() {
// act
RegionBSPTree3D tree = RegionBSPTree3D.from(Arrays.asList(
- ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet.fromVertexLoop(Arrays.asList(
Vector3D.ZERO, Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y), TEST_PRECISION),
- ConvexSubPlane.fromVertexLoop(Arrays.asList(
+ Facet.fromVertexLoop(Arrays.asList(
Vector3D.ZERO, Vector3D.Unit.MINUS_Z, Vector3D.Unit.PLUS_X), TEST_PRECISION)
));
@@ -394,13 +394,13 @@
// arrange
RegionBSPTree3D a = RegionBSPTree3D.empty();
Parallelepiped.axisAligned(Vector3D.ZERO, Vector3D.of(0.5, 1, 1), TEST_PRECISION).stream()
- .map(ConvexSubPlane::reverse)
+ .map(Facet::reverse)
.forEach(a::insert);
a.complement();
RegionBSPTree3D b = RegionBSPTree3D.empty();
Parallelepiped.axisAligned(Vector3D.of(0.5, 0, 0), Vector3D.of(1, 1, 1), TEST_PRECISION).stream()
- .map(ConvexSubPlane::reverse)
+ .map(Facet::reverse)
.forEach(b::insert);
b.complement();
@@ -853,11 +853,11 @@
Vector3D vertex3 = Vector3D.of(2, 3, 3);
Vector3D vertex4 = Vector3D.of(1, 3, 4);
- List<ConvexSubPlane> boundaries = Arrays.asList(
- ConvexSubPlane.fromVertexLoop(Arrays.asList(vertex3, vertex2, vertex1), TEST_PRECISION),
- ConvexSubPlane.fromVertexLoop(Arrays.asList(vertex2, vertex3, vertex4), TEST_PRECISION),
- ConvexSubPlane.fromVertexLoop(Arrays.asList(vertex4, vertex3, vertex1), TEST_PRECISION),
- ConvexSubPlane.fromVertexLoop(Arrays.asList(vertex1, vertex2, vertex4), TEST_PRECISION)
+ List<Facet> boundaries = Arrays.asList(
+ Facet.fromVertexLoop(Arrays.asList(vertex3, vertex2, vertex1), TEST_PRECISION),
+ Facet.fromVertexLoop(Arrays.asList(vertex2, vertex3, vertex4), TEST_PRECISION),
+ Facet.fromVertexLoop(Arrays.asList(vertex4, vertex3, vertex1), TEST_PRECISION),
+ Facet.fromVertexLoop(Arrays.asList(vertex1, vertex2, vertex4), TEST_PRECISION)
);
// act
@@ -1455,7 +1455,7 @@
{3, 0, 4, 7}
};
- List<ConvexSubPlane> faces = indexedFacetsToBoundaries(vertices, facets);
+ List<Facet> faces = indexedFacetsToBoundaries(vertices, facets);
// act
RegionBSPTree3D tree = RegionBSPTree3D.full();
@@ -1472,8 +1472,8 @@
Vector3D.of(-1, 1, 1), Vector3D.of(4, 1, 1));
}
- private static List<ConvexSubPlane> indexedFacetsToBoundaries(Vector3D[] vertices, int[][] facets) {
- List<ConvexSubPlane> boundaries = new ArrayList<>();
+ private static List<Facet> indexedFacetsToBoundaries(Vector3D[] vertices, int[][] facets) {
+ List<Facet> boundaries = new ArrayList<>();
List<Vector3D> vertexList = new ArrayList<>();
@@ -1484,7 +1484,7 @@
vertexList.add(vertices[indices[j]]);
}
- boundaries.add(ConvexSubPlane.fromVertexLoop(vertexList, TEST_PRECISION));
+ boundaries.add(Facet.fromVertexLoop(vertexList, TEST_PRECISION));
vertexList.clear();
}
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java
index 20914a3..8df4201 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java
@@ -93,7 +93,7 @@
SubPlane sp = new SubPlane(XY_PLANE, true);
// act
- List<ConvexSubPlane> convex = sp.toConvex();
+ List<Facet> convex = sp.toConvex();
// assert
Assert.assertEquals(1, convex.size());
@@ -106,7 +106,7 @@
SubPlane sp = new SubPlane(XY_PLANE, false);
// act
- List<ConvexSubPlane> convex = sp.toConvex();
+ List<Facet> convex = sp.toConvex();
// assert
Assert.assertEquals(0, convex.size());
@@ -125,11 +125,11 @@
), TEST_PRECISION);
SubPlane sp = new SubPlane(XY_PLANE, false);
- sp.add(ConvexSubPlane.fromConvexArea(XY_PLANE, a));
- sp.add(ConvexSubPlane.fromConvexArea(XY_PLANE, b));
+ sp.add(Facet.fromConvexArea(XY_PLANE, a));
+ sp.add(Facet.fromConvexArea(XY_PLANE, b));
// act
- List<ConvexSubPlane> convex = sp.toConvex();
+ List<Facet> convex = sp.toConvex();
// assert
Assert.assertEquals(2, convex.size());
@@ -428,7 +428,7 @@
Vector3D.of(1e-16, 0, 1), Vector3D.of(1, 1e-16, 0), Vector3D.Unit.PLUS_Y, TEST_PRECISION);
// act
- builder.add(ConvexSubPlane.fromConvexArea(closePlane, a));
+ builder.add(Facet.fromConvexArea(closePlane, a));
builder.add(new SubPlane(closePlane, RegionBSPTree2D.from(b)));
SubPlane result = builder.build();
@@ -455,7 +455,7 @@
// act/assert
GeometryTestUtils.assertThrows(() -> {
- sp.add(ConvexSubPlane.fromConvexArea(
+ sp.add(Facet.fromConvexArea(
Plane.fromPointAndPlaneVectors(Vector3D.ZERO, Vector3D.Unit.PLUS_Y, Vector3D.Unit.MINUS_X, TEST_PRECISION),
ConvexArea.full()));
}, IllegalArgumentException.class);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/shapes/ParallelepipedTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/shapes/ParallelepipedTest.java
index 49769bf..1367788 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/shapes/ParallelepipedTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/shapes/ParallelepipedTest.java
@@ -23,7 +23,7 @@
import org.apache.commons.geometry.core.precision.EpsilonDoublePrecisionContext;
import org.apache.commons.geometry.euclidean.EuclideanTestUtils;
import org.apache.commons.geometry.euclidean.threed.BoundarySource3D;
-import org.apache.commons.geometry.euclidean.threed.ConvexSubPlane;
+import org.apache.commons.geometry.euclidean.threed.Facet;
import org.apache.commons.geometry.euclidean.threed.RegionBSPTree3D;
import org.apache.commons.geometry.euclidean.threed.Vector3D;
import org.junit.Assert;
@@ -39,7 +39,7 @@
@Test
public void testAxisAligned_minFirst() {
// act
- List<ConvexSubPlane> boundaries =
+ List<Facet> boundaries =
Parallelepiped.axisAligned(Vector3D.of(1, 2, 3), Vector3D.of(4, 5, 6), TEST_PRECISION);
// assert
@@ -68,7 +68,7 @@
@Test
public void testAxisAligned_maxFirst() {
// act
- List<ConvexSubPlane> boundaries =
+ List<Facet> boundaries =
Parallelepiped.axisAligned(Vector3D.of(4, 5, 6), Vector3D.of(1, 2, 3), TEST_PRECISION);
// assert
@@ -124,9 +124,9 @@
}, IllegalArgumentException.class);
}
- private static void checkVertices(ConvexSubPlane sp, Vector3D... pts) {
- List<Vector3D> actual = sp.getPlane().toSpace(
- sp.getSubspaceRegion().getBoundaryPaths().get(0).getVertices());
+ private static void checkVertices(Facet facet, Vector3D... pts) {
+ List<Vector3D> actual = facet.getPlane().toSpace(
+ facet.getSubspaceRegion().getBoundaryPaths().get(0).getVertices());
Assert.assertEquals(pts.length, actual.size());
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));
}
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubGreatCircle.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubGreatCircle.java
index 49e5c20..9194bf5 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubGreatCircle.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/SubGreatCircle.java
@@ -90,7 +90,7 @@
* <p>In all cases, the current instance is not modified. However, In order to avoid
* unnecessary copying, this method will use the current instance as the split value when
* the instance lies entirely on the plus or minus side of the splitter. For example, if
- * this instance lies entirely on the minus side of the splitter, the subplane
+ * this instance lies entirely on the minus side of the splitter, the sub great circle
* returned by {@link Split#getMinus()} will be this instance. Similarly, {@link Split#getPlus()}
* will return the current instance if it lies entirely on the plus side. Callers need to make
* special note of this, since this class is mutable.</p>
diff --git a/src/site/xdoc/userguide/index.xml b/src/site/xdoc/userguide/index.xml
index bdeb6fc..1c0fd4e 100644
--- a/src/site/xdoc/userguide/index.xml
+++ b/src/site/xdoc/userguide/index.xml
@@ -673,7 +673,7 @@
</li>
<li>
ConvexSubHyperplane -
- <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/threed/ConvexSubPlane.html">ConvexSubPlane</a>
+ <a class="code" href="../commons-geometry-euclidean/apidocs/org/apache/commons/geometry/euclidean/threed/Facet.html">Facet</a>
</li>
<li>
Region
@@ -780,7 +780,7 @@
Vector3D b3 = Vector3D.of(-0.5, -0.5, 0.0);
Vector3D b4 = Vector3D.of(-0.5, 0.5, 0.0);
-Vector3D[][] faces = {
+Vector3D[][] faceIndices = {
{b1, a1, b2},
{b2, a1, b3},
{b3, a1, b4},
@@ -788,10 +788,10 @@
{b1, b2, b3, b4}
};
-// convert the faces to convex sub planes and insert into a bsp tree
+// convert the vertices to facets and insert into a bsp tree
RegionBSPTree3D tree = RegionBSPTree3D.empty();
-Arrays.stream(faces)
- .map(vertices -> ConvexSubPlane.fromVertexLoop(Arrays.asList(vertices), precision))
+Arrays.stream(faceIndices)
+ .map(vertices -> Facet.fromVertexLoop(Arrays.asList(vertices), precision))
.forEach(tree::insert);
// split the region through its barycenter along a diagonal of the base
@@ -803,7 +803,7 @@
RegionBSPTree3D minus = split.getMinus();
double minusSize = minus.getSize(); // 1/6
-List<ConvexSubPlane> minusFacets = minus.getBoundaries(); // size = 4
+List<Facet> minusFacets = minus.getBoundaries(); // size = 4
</source>
<h5>Linecast</h5>