This is an automated email from the ASF dual-hosted git repository. erans pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-geometry.git
commit e9b37d1d71bf646a6c5efcb150bdacdb964b5be0 Author: Matt Juntunen <matt.juntu...@hotmail.com> AuthorDate: Tue Jan 7 21:22:55 2020 -0500 GEOMETRY-81: renaming ConvexSubPlane to Facet --- .../euclidean/threed/BoundarySource3D.java | 14 +-- .../threed/BoundarySourceLinecastWrapper3D.java | 10 +- .../geometry/euclidean/threed/ConvexVolume.java | 42 ++++---- .../threed/{ConvexSubPlane.java => Facet.java} | 54 +++++------ .../commons/geometry/euclidean/threed/Plane.java | 4 +- .../geometry/euclidean/threed/RegionBSPTree3D.java | 14 +-- .../geometry/euclidean/threed/SubPlane.java | 26 ++--- .../euclidean/threed/shapes/Parallelepiped.java | 20 ++-- .../euclidean/DocumentationExamplesTest.java | 12 +-- .../euclidean/threed/BoundarySource3DTest.java | 20 ++-- .../BoundarySourceLinecastWrapper3DTest.java | 8 +- .../euclidean/threed/ConvexVolumeTest.java | 10 +- .../{ConvexSubPlaneTest.java => FacetTest.java} | 106 ++++++++++----------- .../geometry/euclidean/threed/PlaneTest.java | 2 +- .../euclidean/threed/RegionBSPTree3DTest.java | 44 ++++----- .../geometry/euclidean/threed/SubPlaneTest.java | 14 +-- .../threed/shapes/ParallelepipedTest.java | 12 +-- .../geometry/spherical/twod/SubGreatCircle.java | 2 +- src/site/xdoc/userguide/index.xml | 12 +-- 19 files changed, 213 insertions(+), 213 deletions(-) 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 @@ import org.apache.commons.geometry.core.partitioning.BoundarySource; /** 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 @@ public interface BoundarySource3D extends BoundarySource<ConvexSubPlane> { 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/BoundarySourceLinecastWrapper3D.java index 05b0b13..5060d86 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/BoundarySourceLinecastWrapper3D.java @@ -68,18 +68,18 @@ final class BoundarySourceLinecastWrapper3D implements Linecastable3D { .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..a79c14f 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.core.partitioning.Split; 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 @@ public final class ConvexVolume extends AbstractConvexHyperplaneBoundedRegion<Ve * 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 @@ public final class ConvexVolume extends AbstractConvexHyperplaneBoundedRegion<Ve 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 @@ public final class ConvexVolume extends AbstractConvexHyperplaneBoundedRegion<Ve 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,7 +126,7 @@ public final class ConvexVolume extends AbstractConvexHyperplaneBoundedRegion<Ve /** {@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} */ @@ -143,8 +143,8 @@ public final class ConvexVolume extends AbstractConvexHyperplaneBoundedRegion<Ve /** {@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 @@ public final class ConvexVolume extends AbstractConvexHyperplaneBoundedRegion<Ve * @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 @@ public final class ConvexVolume extends AbstractConvexHyperplaneBoundedRegion<Ve * 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.ConvexArea; 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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> * @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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> /** {@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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> 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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> /** {@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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> 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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> 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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> * @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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> * @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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> * @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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> * @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 @@ public final class ConvexSubPlane extends AbstractSubPlane<ConvexArea> 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 @@ public final class Plane extends AbstractHyperplane<Vector3D> /** {@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 @@ public final class RegionBSPTree3D extends AbstractRegionBSPTree<Vector3D, Regio /** {@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 @@ public final class RegionBSPTree3D extends AbstractRegionBSPTree<Vector3D, Regio * @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 @@ public final class RegionBSPTree3D extends AbstractRegionBSPTree<Vector3D, Regio * @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 @@ public final class SubPlane extends AbstractSubPlane<RegionBSPTree2D> { /** {@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 @@ public final class SubPlane extends AbstractSubPlane<RegionBSPTree2D> { 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 @@ public final class SubPlane extends AbstractSubPlane<RegionBSPTree2D> { * @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.Arrays; 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 @@ public final class Parallelepiped { 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 @@ public final class Parallelepiped { 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/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.Interval; 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 @@ public class DocumentationExamplesTest { 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 @@ public class DocumentationExamplesTest { {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 @@ public class DocumentationExamplesTest { 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 @@ public class BoundarySource3DTest { 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 @@ public class BoundarySource3DTest { @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/BoundarySourceLinecastWrapper3DTest.java index 702ea6b..45f8bd8 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/BoundarySourceLinecastWrapper3DTest.java @@ -100,8 +100,8 @@ public class BoundarySourceLinecastWrapper3DTest { 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); @@ -233,8 +233,8 @@ public class BoundarySourceLinecastWrapper3DTest { 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); 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 @@ public class ConvexVolumeTest { 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 @@ public class ConvexVolumeTest { 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 @@ public class ConvexVolumeTest { // 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.apache.commons.geometry.euclidean.twod.Vector2D; 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 @@ public class ConvexSubPlaneTest { ), TEST_PRECISION); // act - ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, area); + Facet sp = Facet.fromConvexArea(plane, area); // assert Assert.assertFalse(sp.isFull()); @@ -72,7 +72,7 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { @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 class ConvexSubPlaneTest { 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 class ConvexSubPlaneTest { 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 class ConvexSubPlaneTest { 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 class ConvexSubPlaneTest { 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 @@ public class ConvexSubPlaneTest { 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 class ConvexSubPlaneTest { 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 class ConvexSubPlaneTest { 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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { @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 class ConvexSubPlaneTest { 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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { 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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { 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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { 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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { 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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { @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 @@ public class ConvexSubPlaneTest { 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 @@ public class PlaneTest { 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 @@ public class RegionBSPTree3DTest { 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 @@ public class RegionBSPTree3DTest { 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 @@ public class RegionBSPTree3DTest { 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 @@ public class RegionBSPTree3DTest { 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 class RegionBSPTree3DTest { 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 @@ public class RegionBSPTree3DTest { // 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 @@ public class RegionBSPTree3DTest { 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 @@ public class RegionBSPTree3DTest { {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 @@ public class RegionBSPTree3DTest { 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 @@ public class RegionBSPTree3DTest { 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 @@ public class SubPlaneTest { 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 @@ public class SubPlaneTest { 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 @@ public class SubPlaneTest { ), 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 @@ public class SubPlaneTest { 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 @@ public class SubPlaneTest { // 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.DoublePrecisionContext; 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 @@ public class ParallelepipedTest { @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 @@ public class ParallelepipedTest { @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 @@ public class ParallelepipedTest { }, 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-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 @@ public final class SubGreatCircle extends AbstractSubGreatCircle { * <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 @@ Vector2D normal = pt.getNormal(); // (1.0, 0.0) </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 b2 = Vector3D.of(0.5, -0.5, 0.0); 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 @@ Vector3D[][] faces = { {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 @@ Split<RegionBSPTree3D> split = tree.split(cutter); 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>