Add missing @Override tags, use final for private fields where possible.
This commit is contained in:
parent
7c172a091a
commit
fbf5a51ea5
|
@ -58,6 +58,7 @@ public class WelzlEncloser<S extends Space, P extends Point<S>> implements Enclo
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public EnclosingBall<S, P> enclose(final Iterable<P> points) {
|
||||
|
||||
if (points == null || !points.iterator().hasNext()) {
|
||||
|
|
|
@ -45,6 +45,7 @@ public class Euclidean1D implements Serializable, Space {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getDimension() {
|
||||
return 1;
|
||||
}
|
||||
|
@ -57,6 +58,7 @@ public class Euclidean1D implements Serializable, Space {
|
|||
* @return nothing
|
||||
* @throws NoSubSpaceException in all cases
|
||||
*/
|
||||
@Override
|
||||
public Space getSubSpace() throws NoSubSpaceException {
|
||||
throw new NoSubSpaceException();
|
||||
}
|
||||
|
|
|
@ -511,6 +511,7 @@ public class IntervalsSet extends AbstractRegion<Euclidean1D, Euclidean1D> imple
|
|||
* </p>
|
||||
* @since 3.3
|
||||
*/
|
||||
@Override
|
||||
public Iterator<double[]> iterator() {
|
||||
return new SubIntervalsIterator();
|
||||
}
|
||||
|
@ -599,11 +600,13 @@ public class IntervalsSet extends AbstractRegion<Euclidean1D, Euclidean1D> imple
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return pending != null;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double[] next() {
|
||||
if (pending == null) {
|
||||
throw new NoSuchElementException();
|
||||
|
@ -614,6 +617,7 @@ public class IntervalsSet extends AbstractRegion<Euclidean1D, Euclidean1D> imple
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.commons.math4.geometry.partitioning.Hyperplane;
|
|||
public class OrientedPoint implements Hyperplane<Euclidean1D> {
|
||||
|
||||
/** Vector location. */
|
||||
private Vector1D location;
|
||||
private final Vector1D location;
|
||||
|
||||
/** Orientation. */
|
||||
private boolean direct;
|
||||
|
@ -55,6 +55,7 @@ public class OrientedPoint implements Hyperplane<Euclidean1D> {
|
|||
* the instance.</p>
|
||||
* @return the instance itself
|
||||
*/
|
||||
@Override
|
||||
public OrientedPoint copySelf() {
|
||||
return this;
|
||||
}
|
||||
|
@ -68,6 +69,7 @@ public class OrientedPoint implements Hyperplane<Euclidean1D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double getOffset(final Point<Euclidean1D> point) {
|
||||
final double delta = ((Vector1D) point).getX() - location.getX();
|
||||
return direct ? delta : -delta;
|
||||
|
@ -84,6 +86,7 @@ public class OrientedPoint implements Hyperplane<Euclidean1D> {
|
|||
* <em>not</em> be used otherwise.</p>
|
||||
* @return a dummy sub hyperplane
|
||||
*/
|
||||
@Override
|
||||
public SubOrientedPoint wholeHyperplane() {
|
||||
return new SubOrientedPoint(this, null);
|
||||
}
|
||||
|
@ -92,11 +95,13 @@ public class OrientedPoint implements Hyperplane<Euclidean1D> {
|
|||
* @return a region containing the instance (really an {@link
|
||||
* IntervalsSet IntervalsSet} instance)
|
||||
*/
|
||||
@Override
|
||||
public IntervalsSet wholeSpace() {
|
||||
return new IntervalsSet(tolerance);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean sameOrientationAs(final Hyperplane<Euclidean1D> other) {
|
||||
return !(direct ^ ((OrientedPoint) other).direct);
|
||||
}
|
||||
|
@ -104,6 +109,7 @@ public class OrientedPoint implements Hyperplane<Euclidean1D> {
|
|||
/** {@inheritDoc}
|
||||
* @since 3.3
|
||||
*/
|
||||
@Override
|
||||
public Point<Euclidean1D> project(Point<Euclidean1D> point) {
|
||||
return location;
|
||||
}
|
||||
|
@ -111,6 +117,7 @@ public class OrientedPoint implements Hyperplane<Euclidean1D> {
|
|||
/** {@inheritDoc}
|
||||
* @since 3.3
|
||||
*/
|
||||
@Override
|
||||
public double getTolerance() {
|
||||
return tolerance;
|
||||
}
|
||||
|
|
|
@ -44,11 +44,13 @@ public class Euclidean3D implements Serializable, Space {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getDimension() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Euclidean2D getSubSpace() {
|
||||
return Euclidean2D.getInstance();
|
||||
}
|
||||
|
|
|
@ -159,6 +159,7 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
|
|||
/** {@inheritDoc}
|
||||
* @see #getAbscissa(Vector3D)
|
||||
*/
|
||||
@Override
|
||||
public Vector1D toSubSpace(final Point<Euclidean3D> point) {
|
||||
return new Vector1D(getAbscissa((Vector3D) point));
|
||||
}
|
||||
|
@ -166,6 +167,7 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
|
|||
/** {@inheritDoc}
|
||||
* @see #pointAt(double)
|
||||
*/
|
||||
@Override
|
||||
public Vector3D toSpace(final Point<Euclidean1D> point) {
|
||||
return pointAt(((Vector1D) point).getX());
|
||||
}
|
||||
|
|
|
@ -38,13 +38,13 @@ import org.apache.commons.math4.util.FastMath;
|
|||
public class OutlineExtractor {
|
||||
|
||||
/** Abscissa axis of the projection plane. */
|
||||
private Vector3D u;
|
||||
private final Vector3D u;
|
||||
|
||||
/** Ordinate axis of the projection plane. */
|
||||
private Vector3D v;
|
||||
private final Vector3D v;
|
||||
|
||||
/** Normal of the projection plane (viewing direction). */
|
||||
private Vector3D w;
|
||||
private final Vector3D w;
|
||||
|
||||
/** Build an extractor for a specific projection plane.
|
||||
* @param u abscissa axis of the projection point
|
||||
|
@ -136,11 +136,13 @@ public class OutlineExtractor {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Order visitOrder(final BSPTree<Euclidean3D> node) {
|
||||
return Order.MINUS_SUB_PLUS;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitInternalNode(final BSPTree<Euclidean3D> node) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final BoundaryAttribute<Euclidean3D> attribute =
|
||||
|
@ -154,6 +156,7 @@ public class OutlineExtractor {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitLeafNode(final BSPTree<Euclidean3D> node) {
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
|
|||
* shared (except for immutable objects).</p>
|
||||
* @return a new hyperplane, copy of the instance
|
||||
*/
|
||||
@Override
|
||||
public Plane copySelf() {
|
||||
return new Plane(this);
|
||||
}
|
||||
|
@ -215,6 +216,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
|
|||
/** {@inheritDoc}
|
||||
* @since 3.3
|
||||
*/
|
||||
@Override
|
||||
public Point<Euclidean3D> project(Point<Euclidean3D> point) {
|
||||
return toSpace(toSubSpace(point));
|
||||
}
|
||||
|
@ -222,6 +224,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
|
|||
/** {@inheritDoc}
|
||||
* @since 3.3
|
||||
*/
|
||||
@Override
|
||||
public double getTolerance() {
|
||||
return tolerance;
|
||||
}
|
||||
|
@ -270,6 +273,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
|
|||
* org.apache.commons.math4.geometry.euclidean.twod.Vector2D Vector2D} instance)
|
||||
* @see #toSpace
|
||||
*/
|
||||
@Override
|
||||
public Vector2D toSubSpace(final Point<Euclidean3D> point) {
|
||||
final Vector3D p3D = (Vector3D) point;
|
||||
return new Vector2D(p3D.dotProduct(u), p3D.dotProduct(v));
|
||||
|
@ -281,6 +285,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
|
|||
* @return 3D space point (really a {@link Vector3D Vector3D} instance)
|
||||
* @see #toSubSpace
|
||||
*/
|
||||
@Override
|
||||
public Vector3D toSpace(final Point<Euclidean2D> point) {
|
||||
final Vector2D p2D = (Vector2D) point;
|
||||
return new Vector3D(p2D.getX(), u, p2D.getY(), v, -originOffset, w);
|
||||
|
@ -422,6 +427,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
|
|||
/** Build a region covering the whole hyperplane.
|
||||
* @return a region covering the whole hyperplane
|
||||
*/
|
||||
@Override
|
||||
public SubPlane wholeHyperplane() {
|
||||
return new SubPlane(this, new PolygonsSet(tolerance));
|
||||
}
|
||||
|
@ -430,6 +436,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
|
|||
* @return a region containing the instance (really a {@link
|
||||
* PolyhedronsSet PolyhedronsSet} instance)
|
||||
*/
|
||||
@Override
|
||||
public PolyhedronsSet wholeSpace() {
|
||||
return new PolyhedronsSet(tolerance);
|
||||
}
|
||||
|
@ -472,6 +479,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
|
|||
* @param point point to check
|
||||
* @return offset of the point
|
||||
*/
|
||||
@Override
|
||||
public double getOffset(final Point<Euclidean3D> point) {
|
||||
return ((Vector3D) point).dotProduct(w) + originOffset;
|
||||
}
|
||||
|
@ -481,6 +489,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
|
|||
* @return true if the instance and the other hyperplane have
|
||||
* the same orientation
|
||||
*/
|
||||
@Override
|
||||
public boolean sameOrientationAs(final Hyperplane<Euclidean3D> other) {
|
||||
return (((Plane) other).w).dotProduct(w) > 0.0;
|
||||
}
|
||||
|
|
|
@ -183,11 +183,13 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Order visitOrder(final BSPTree<Euclidean3D> node) {
|
||||
return Order.MINUS_SUB_PLUS;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitInternalNode(final BSPTree<Euclidean3D> node) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final BoundaryAttribute<Euclidean3D> attribute =
|
||||
|
@ -201,6 +203,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitLeafNode(final BSPTree<Euclidean3D> node) {
|
||||
}
|
||||
|
||||
|
@ -345,10 +348,10 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
|
|||
private static class RotationTransform implements Transform<Euclidean3D, Euclidean2D> {
|
||||
|
||||
/** Center point of the rotation. */
|
||||
private Vector3D center;
|
||||
private final Vector3D center;
|
||||
|
||||
/** Vectorial rotation. */
|
||||
private Rotation rotation;
|
||||
private final Rotation rotation;
|
||||
|
||||
/** Cached original hyperplane. */
|
||||
private Plane cachedOriginal;
|
||||
|
@ -366,17 +369,20 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Vector3D apply(final Point<Euclidean3D> point) {
|
||||
final Vector3D delta = ((Vector3D) point).subtract(center);
|
||||
return new Vector3D(1.0, center, 1.0, rotation.applyTo(delta));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Plane apply(final Hyperplane<Euclidean3D> hyperplane) {
|
||||
return ((Plane) hyperplane).rotate(center, rotation);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public SubHyperplane<Euclidean2D> apply(final SubHyperplane<Euclidean2D> sub,
|
||||
final Hyperplane<Euclidean3D> original,
|
||||
final Hyperplane<Euclidean3D> transformed) {
|
||||
|
@ -418,7 +424,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
|
|||
private static class TranslationTransform implements Transform<Euclidean3D, Euclidean2D> {
|
||||
|
||||
/** Translation vector. */
|
||||
private Vector3D translation;
|
||||
private final Vector3D translation;
|
||||
|
||||
/** Cached original hyperplane. */
|
||||
private Plane cachedOriginal;
|
||||
|
@ -434,16 +440,19 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Vector3D apply(final Point<Euclidean3D> point) {
|
||||
return new Vector3D(1.0, (Vector3D) point, 1.0, translation);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Plane apply(final Hyperplane<Euclidean3D> hyperplane) {
|
||||
return ((Plane) hyperplane).translate(translation);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public SubHyperplane<Euclidean2D> apply(final SubHyperplane<Euclidean2D> sub,
|
||||
final Hyperplane<Euclidean3D> original,
|
||||
final Hyperplane<Euclidean3D> transformed) {
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.commons.math4.util.FastMath;
|
|||
public class SphereGenerator implements SupportBallGenerator<Euclidean3D, Vector3D> {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public EnclosingBall<Euclidean3D, Vector3D> ballOnSupport(final List<Vector3D> support) {
|
||||
|
||||
if (support.size() < 1) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.commons.math4.util.FastMath;
|
|||
public class DiskGenerator implements SupportBallGenerator<Euclidean2D, Vector2D> {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public EnclosingBall<Euclidean2D, Vector2D> ballOnSupport(final List<Vector2D> support) {
|
||||
|
||||
if (support.size() < 1) {
|
||||
|
|
|
@ -44,11 +44,13 @@ public class Euclidean2D implements Serializable, Space {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getDimension() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Euclidean1D getSubSpace() {
|
||||
return Euclidean1D.getInstance();
|
||||
}
|
||||
|
|
|
@ -136,6 +136,7 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Line copySelf() {
|
||||
return new Line(this);
|
||||
}
|
||||
|
@ -241,12 +242,14 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Vector1D toSubSpace(final Point<Euclidean2D> point) {
|
||||
Vector2D p2 = (Vector2D) point;
|
||||
return new Vector1D(MathArrays.linearCombination(cos, p2.getX(), sin, p2.getY()));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Vector2D toSpace(final Point<Euclidean1D> point) {
|
||||
final double abscissa = ((Vector1D) point).getX();
|
||||
return new Vector2D(MathArrays.linearCombination(abscissa, cos, -originOffset, sin),
|
||||
|
@ -270,6 +273,7 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
|
|||
/** {@inheritDoc}
|
||||
* @since 3.3
|
||||
*/
|
||||
@Override
|
||||
public Point<Euclidean2D> project(Point<Euclidean2D> point) {
|
||||
return toSpace(toSubSpace(point));
|
||||
}
|
||||
|
@ -277,11 +281,13 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
|
|||
/** {@inheritDoc}
|
||||
* @since 3.3
|
||||
*/
|
||||
@Override
|
||||
public double getTolerance() {
|
||||
return tolerance;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public SubLine wholeHyperplane() {
|
||||
return new SubLine(this, new IntervalsSet(tolerance));
|
||||
}
|
||||
|
@ -290,6 +296,7 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
|
|||
* @return a region containing the instance (really a {@link
|
||||
* PolygonsSet PolygonsSet} instance)
|
||||
*/
|
||||
@Override
|
||||
public PolygonsSet wholeSpace() {
|
||||
return new PolygonsSet(tolerance);
|
||||
}
|
||||
|
@ -318,12 +325,14 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double getOffset(final Point<Euclidean2D> point) {
|
||||
Vector2D p2 = (Vector2D) point;
|
||||
return MathArrays.linearCombination(sin, p2.getX(), -cos, p2.getY(), 1.0, originOffset);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean sameOrientationAs(final Hyperplane<Euclidean2D> other) {
|
||||
final Line otherL = (Line) other;
|
||||
return MathArrays.linearCombination(sin, otherL.sin, cos, otherL.cos) >= 0.0;
|
||||
|
@ -439,16 +448,16 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
|
|||
private static class LineTransform implements Transform<Euclidean2D, Euclidean1D> {
|
||||
|
||||
// CHECKSTYLE: stop JavadocVariable check
|
||||
private double cXX;
|
||||
private double cXY;
|
||||
private double cX1;
|
||||
private double cYX;
|
||||
private double cYY;
|
||||
private double cY1;
|
||||
private final double cXX;
|
||||
private final double cXY;
|
||||
private final double cX1;
|
||||
private final double cYX;
|
||||
private final double cYY;
|
||||
private final double cY1;
|
||||
|
||||
private double c1Y;
|
||||
private double c1X;
|
||||
private double c11;
|
||||
private final double c1Y;
|
||||
private final double c1X;
|
||||
private final double c11;
|
||||
// CHECKSTYLE: resume JavadocVariable check
|
||||
|
||||
/** Build an affine line transform from a n {@code AffineTransform}.
|
||||
|
@ -479,6 +488,7 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Vector2D apply(final Point<Euclidean2D> point) {
|
||||
final Vector2D p2D = (Vector2D) point;
|
||||
final double x = p2D.getX();
|
||||
|
@ -488,6 +498,7 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Line apply(final Hyperplane<Euclidean2D> hyperplane) {
|
||||
final Line line = (Line) hyperplane;
|
||||
final double rOffset = MathArrays.linearCombination(c1X, line.cos, c1Y, line.sin, c11, line.originOffset);
|
||||
|
@ -500,6 +511,7 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public SubHyperplane<Euclidean1D> apply(final SubHyperplane<Euclidean1D> sub,
|
||||
final Hyperplane<Euclidean2D> original,
|
||||
final Hyperplane<Euclidean2D> transformed) {
|
||||
|
|
|
@ -1002,11 +1002,13 @@ public class PolygonsSet extends AbstractRegion<Euclidean2D, Euclidean1D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Order visitOrder(final BSPTree<Euclidean2D> node) {
|
||||
return Order.MINUS_SUB_PLUS;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitInternalNode(final BSPTree<Euclidean2D> node) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final BoundaryAttribute<Euclidean2D> attribute = (BoundaryAttribute<Euclidean2D>) node.getAttribute();
|
||||
|
@ -1020,6 +1022,7 @@ public class PolygonsSet extends AbstractRegion<Euclidean2D, Euclidean1D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitLeafNode(final BSPTree<Euclidean2D> node) {
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ abstract class AbstractConvexHullGenerator2D implements ConvexHullGenerator2D {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public ConvexHull2D generate(final Collection<Vector2D> points)
|
||||
throws NullArgumentException, ConvergenceException {
|
||||
// check for null points
|
||||
|
|
|
@ -106,6 +106,7 @@ public class ConvexHull2D implements ConvexHull<Euclidean2D, Vector2D>, Serializ
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Vector2D[] getVertices() {
|
||||
return vertices.clone();
|
||||
}
|
||||
|
@ -157,6 +158,7 @@ public class ConvexHull2D implements ConvexHull<Euclidean2D, Vector2D>, Serializ
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Region<Euclidean2D> createRegion() throws InsufficientDataException {
|
||||
if (vertices.length < 3) {
|
||||
throw new InsufficientDataException();
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.commons.math4.geometry.hull.ConvexHullGenerator;
|
|||
public interface ConvexHullGenerator2D extends ConvexHullGenerator<Euclidean2D, Vector2D> {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
ConvexHull2D generate(Collection<Vector2D> points) throws NullArgumentException, ConvergenceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ public class MonotoneChain extends AbstractConvexHullGenerator2D {
|
|||
|
||||
// sort the points in increasing order on the x-axis
|
||||
Collections.sort(pointsSortedByXAxis, new Comparator<Vector2D>() {
|
||||
@Override
|
||||
public int compare(final Vector2D o1, final Vector2D o2) {
|
||||
final double tolerance = getTolerance();
|
||||
// need to take the tolerance value into account, otherwise collinear points
|
||||
|
|
|
@ -110,6 +110,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
// (we don't want equal size elements to be removed, so
|
||||
// we use a trick to fool the TreeSet)
|
||||
final TreeSet<SubHyperplane<S>> ordered = new TreeSet<SubHyperplane<S>>(new Comparator<SubHyperplane<S>>() {
|
||||
@Override
|
||||
public int compare(final SubHyperplane<S> o1, final SubHyperplane<S> o2) {
|
||||
final double size1 = o1.getSize();
|
||||
final double size2 = o2.getSize();
|
||||
|
@ -126,15 +127,18 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
tree.visit(new BSPTreeVisitor<S>() {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Order visitOrder(final BSPTree<S> node) {
|
||||
return Order.PLUS_SUB_MINUS;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitInternalNode(final BSPTree<S> node) {
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitLeafNode(final BSPTree<S> node) {
|
||||
if (node.getParent() == null || node == node.getParent().getMinus()) {
|
||||
node.setAttribute(Boolean.TRUE);
|
||||
|
@ -179,6 +183,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public abstract AbstractRegion<S, T> buildNew(BSPTree<S> newTree);
|
||||
|
||||
/** Get the tolerance below which points are considered to belong to hyperplanes.
|
||||
|
@ -240,16 +245,19 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public AbstractRegion<S, T> copySelf() {
|
||||
return buildNew(tree.copySelf());
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return isEmpty(tree);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isEmpty(final BSPTree<S> node) {
|
||||
|
||||
// we use a recursive function rather than the BSPTreeVisitor
|
||||
|
@ -267,11 +275,13 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isFull() {
|
||||
return isFull(tree);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isFull(final BSPTree<S> node) {
|
||||
|
||||
// we use a recursive function rather than the BSPTreeVisitor
|
||||
|
@ -289,6 +299,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean contains(final Region<S> region) {
|
||||
return new RegionFactory<S>().difference(region, this).isEmpty();
|
||||
}
|
||||
|
@ -296,6 +307,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
/** {@inheritDoc}
|
||||
* @since 3.3
|
||||
*/
|
||||
@Override
|
||||
public BoundaryProjection<S> projectToBoundary(final Point<S> point) {
|
||||
final BoundaryProjector<S, T> projector = new BoundaryProjector<S, T>(point);
|
||||
getTree(true).visit(projector);
|
||||
|
@ -313,6 +325,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Location checkPoint(final Point<S> point) {
|
||||
return checkPoint(tree, point);
|
||||
}
|
||||
|
@ -350,6 +363,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public BSPTree<S> getTree(final boolean includeBoundaryAttributes) {
|
||||
if (includeBoundaryAttributes && (tree.getCut() != null) && (tree.getAttribute() == null)) {
|
||||
// compute the boundary attributes
|
||||
|
@ -359,6 +373,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double getBoundarySize() {
|
||||
final BoundarySizeVisitor<S> visitor = new BoundarySizeVisitor<S>();
|
||||
getTree(true).visit(visitor);
|
||||
|
@ -366,6 +381,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double getSize() {
|
||||
if (barycenter == null) {
|
||||
computeGeometricalProperties();
|
||||
|
@ -381,6 +397,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Point<S> getBarycenter() {
|
||||
if (barycenter == null) {
|
||||
computeGeometricalProperties();
|
||||
|
@ -408,6 +425,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
protected abstract void computeGeometricalProperties();
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Side side(final Hyperplane<S> hyperplane) {
|
||||
final InsideFinder<S> finder = new InsideFinder<S>(this);
|
||||
finder.recurseSides(tree, hyperplane.wholeHyperplane());
|
||||
|
@ -417,6 +435,7 @@ public abstract class AbstractRegion<S extends Space, T extends Space> implement
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public SubHyperplane<S> intersection(final SubHyperplane<S> sub) {
|
||||
return recurseIntersection(tree, sub);
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ public abstract class AbstractSubHyperplane<S extends Space, T extends Space>
|
|||
final Region<T> remaining);
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public AbstractSubHyperplane<S, T> copySelf() {
|
||||
return buildNew(hyperplane.copySelf(), remainingRegion);
|
||||
}
|
||||
|
@ -70,6 +71,7 @@ public abstract class AbstractSubHyperplane<S extends Space, T extends Space>
|
|||
/** Get the underlying hyperplane.
|
||||
* @return underlying hyperplane
|
||||
*/
|
||||
@Override
|
||||
public Hyperplane<S> getHyperplane() {
|
||||
return hyperplane;
|
||||
}
|
||||
|
@ -86,11 +88,13 @@ public abstract class AbstractSubHyperplane<S extends Space, T extends Space>
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double getSize() {
|
||||
return remainingRegion.getSize();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public AbstractSubHyperplane<S, T> reunite(final SubHyperplane<S> other) {
|
||||
@SuppressWarnings("unchecked")
|
||||
AbstractSubHyperplane<S, T> o = (AbstractSubHyperplane<S, T>) other;
|
||||
|
@ -175,12 +179,15 @@ public abstract class AbstractSubHyperplane<S extends Space, T extends Space>
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public abstract Side side(Hyperplane<S> hyper);
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public abstract SplitSubHyperplane<S> split(Hyperplane<S> hyper);
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return remainingRegion.isEmpty();
|
||||
}
|
||||
|
|
|
@ -29,11 +29,13 @@ import org.apache.commons.math4.geometry.Space;
|
|||
class BoundaryBuilder<S extends Space> implements BSPTreeVisitor<S> {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Order visitOrder(BSPTree<S> node) {
|
||||
return Order.PLUS_MINUS_SUB;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitInternalNode(BSPTree<S> node) {
|
||||
|
||||
SubHyperplane<S> plusOutside = null;
|
||||
|
@ -89,6 +91,7 @@ class BoundaryBuilder<S extends Space> implements BSPTreeVisitor<S> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitLeafNode(BSPTree<S> node) {
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ class BoundaryProjector<S extends Space, T extends Space> implements BSPTreeVisi
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Order visitOrder(final BSPTree<S> node) {
|
||||
// we want to visit the tree so that the first encountered
|
||||
// leaf is the one closest to the test point
|
||||
|
@ -65,6 +66,7 @@ class BoundaryProjector<S extends Space, T extends Space> implements BSPTreeVisi
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitInternalNode(final BSPTree<S> node) {
|
||||
|
||||
// project the point on the cut sub-hyperplane
|
||||
|
@ -111,6 +113,7 @@ class BoundaryProjector<S extends Space, T extends Space> implements BSPTreeVisi
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitLeafNode(final BSPTree<S> node) {
|
||||
if (leaf == null) {
|
||||
// this is the first leaf we visit,
|
||||
|
|
|
@ -34,11 +34,13 @@ class BoundarySizeVisitor<S extends Space> implements BSPTreeVisitor<S> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc}*/
|
||||
@Override
|
||||
public Order visitOrder(final BSPTree<S> node) {
|
||||
return Order.MINUS_SUB_PLUS;
|
||||
}
|
||||
|
||||
/** {@inheritDoc}*/
|
||||
@Override
|
||||
public void visitInternalNode(final BSPTree<S> node) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final BoundaryAttribute<S> attribute =
|
||||
|
@ -52,6 +54,7 @@ class BoundarySizeVisitor<S extends Space> implements BSPTreeVisitor<S> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc}*/
|
||||
@Override
|
||||
public void visitLeafNode(final BSPTree<S> node) {
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.commons.math4.geometry.Space;
|
|||
public class NodesSet<S extends Space> implements Iterable<BSPTree<S>> {
|
||||
|
||||
/** List of sub-hyperplanes. */
|
||||
private List<BSPTree<S>> list;
|
||||
private final List<BSPTree<S>> list;
|
||||
|
||||
/** Simple constructor.
|
||||
*/
|
||||
|
@ -65,6 +65,7 @@ public class NodesSet<S extends Space> implements Iterable<BSPTree<S>> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Iterator<BSPTree<S>> iterator() {
|
||||
return list.iterator();
|
||||
}
|
||||
|
|
|
@ -206,6 +206,7 @@ public class RegionFactory<S extends Space> {
|
|||
/** BSP tree leaf merger computing union of two regions. */
|
||||
private class UnionMerger implements BSPTree.LeafMerger<S> {
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public BSPTree<S> merge(final BSPTree<S> leaf, final BSPTree<S> tree,
|
||||
final BSPTree<S> parentTree,
|
||||
final boolean isPlusChild, final boolean leafFromInstance) {
|
||||
|
@ -223,6 +224,7 @@ public class RegionFactory<S extends Space> {
|
|||
/** BSP tree leaf merger computing intersection of two regions. */
|
||||
private class IntersectionMerger implements BSPTree.LeafMerger<S> {
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public BSPTree<S> merge(final BSPTree<S> leaf, final BSPTree<S> tree,
|
||||
final BSPTree<S> parentTree,
|
||||
final boolean isPlusChild, final boolean leafFromInstance) {
|
||||
|
@ -240,6 +242,7 @@ public class RegionFactory<S extends Space> {
|
|||
/** BSP tree leaf merger computing symmetric difference (exclusive or) of two regions. */
|
||||
private class XorMerger implements BSPTree.LeafMerger<S> {
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public BSPTree<S> merge(final BSPTree<S> leaf, final BSPTree<S> tree,
|
||||
final BSPTree<S> parentTree, final boolean isPlusChild,
|
||||
final boolean leafFromInstance) {
|
||||
|
@ -272,6 +275,7 @@ public class RegionFactory<S extends Space> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public BSPTree<S> merge(final BSPTree<S> leaf, final BSPTree<S> tree,
|
||||
final BSPTree<S> parentTree, final boolean isPlusChild,
|
||||
final boolean leafFromInstance) {
|
||||
|
@ -290,6 +294,7 @@ public class RegionFactory<S extends Space> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public BSPTree<S> fixNode(final BSPTree<S> node) {
|
||||
// get a representative point in the degenerate cell
|
||||
final BSPTree<S> cell = node.pruneAroundConvexCell(Boolean.TRUE, Boolean.FALSE, null);
|
||||
|
@ -305,16 +310,19 @@ public class RegionFactory<S extends Space> {
|
|||
private class NodesCleaner implements BSPTreeVisitor<S> {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Order visitOrder(final BSPTree<S> node) {
|
||||
return Order.PLUS_SUB_MINUS;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitInternalNode(final BSPTree<S> node) {
|
||||
node.setAttribute(null);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitLeafNode(final BSPTree<S> node) {
|
||||
}
|
||||
|
||||
|
@ -334,6 +342,7 @@ public class RegionFactory<S extends Space> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public BSPTree<S> fixNode(final BSPTree<S> node) {
|
||||
if (node.getPlus().getAttribute().equals(node.getMinus().getAttribute())) {
|
||||
// no ambiguity
|
||||
|
|
|
@ -580,6 +580,7 @@ public class ArcsSet extends AbstractRegion<Sphere1D, Sphere1D> implements Itera
|
|||
* The iterator does <em>not</em> support the optional {@code remove} operation.
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public Iterator<double[]> iterator() {
|
||||
return new SubArcsIterator();
|
||||
}
|
||||
|
@ -676,11 +677,13 @@ public class ArcsSet extends AbstractRegion<Sphere1D, Sphere1D> implements Itera
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return pending != null;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double[] next() {
|
||||
if (pending == null) {
|
||||
throw new NoSuchElementException();
|
||||
|
@ -691,6 +694,7 @@ public class ArcsSet extends AbstractRegion<Sphere1D, Sphere1D> implements Itera
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
@ -27,10 +27,10 @@ import org.apache.commons.math4.geometry.partitioning.Hyperplane;
|
|||
public class LimitAngle implements Hyperplane<Sphere1D> {
|
||||
|
||||
/** Angle location. */
|
||||
private S1Point location;
|
||||
private final S1Point location;
|
||||
|
||||
/** Orientation. */
|
||||
private boolean direct;
|
||||
private final boolean direct;
|
||||
|
||||
/** Tolerance below which angles are considered identical. */
|
||||
private final double tolerance;
|
||||
|
@ -52,11 +52,13 @@ public class LimitAngle implements Hyperplane<Sphere1D> {
|
|||
* the instance.</p>
|
||||
* @return the instance itself
|
||||
*/
|
||||
@Override
|
||||
public LimitAngle copySelf() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double getOffset(final Point<Sphere1D> point) {
|
||||
final double delta = ((S1Point) point).getAlpha() - location.getAlpha();
|
||||
return direct ? delta : -delta;
|
||||
|
@ -90,6 +92,7 @@ public class LimitAngle implements Hyperplane<Sphere1D> {
|
|||
* <em>not</em> be used otherwise.</p>
|
||||
* @return a dummy sub hyperplane
|
||||
*/
|
||||
@Override
|
||||
public SubLimitAngle wholeHyperplane() {
|
||||
return new SubLimitAngle(this, null);
|
||||
}
|
||||
|
@ -98,11 +101,13 @@ public class LimitAngle implements Hyperplane<Sphere1D> {
|
|||
* @return a region containing the instance (really an {@link
|
||||
* ArcsSet IntervalsSet} instance)
|
||||
*/
|
||||
@Override
|
||||
public ArcsSet wholeSpace() {
|
||||
return new ArcsSet(tolerance);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean sameOrientationAs(final Hyperplane<Sphere1D> other) {
|
||||
return !(direct ^ ((LimitAngle) other).direct);
|
||||
}
|
||||
|
@ -115,11 +120,13 @@ public class LimitAngle implements Hyperplane<Sphere1D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Point<Sphere1D> project(Point<Sphere1D> point) {
|
||||
return location;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double getTolerance() {
|
||||
return tolerance;
|
||||
}
|
||||
|
|
|
@ -77,16 +77,19 @@ public class S1Point implements Point<Sphere1D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Space getSpace() {
|
||||
return Sphere1D.getInstance();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isNaN() {
|
||||
return Double.isNaN(alpha);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double distance(final Point<Sphere1D> point) {
|
||||
return distance(this, (S1Point) point);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public class Sphere1D implements Serializable, Space {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getDimension() {
|
||||
return 1;
|
||||
}
|
||||
|
@ -63,6 +64,7 @@ public class Sphere1D implements Serializable, Space {
|
|||
* @return nothing
|
||||
* @throws NoSubSpaceException in all cases
|
||||
*/
|
||||
@Override
|
||||
public Space getSubSpace() throws NoSubSpaceException {
|
||||
throw new NoSubSpaceException();
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Circle copySelf() {
|
||||
return new Circle(this);
|
||||
}
|
||||
|
@ -134,11 +135,13 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Point<Sphere2D> project(Point<Sphere2D> point) {
|
||||
return toSpace(toSubSpace(point));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double getTolerance() {
|
||||
return tolerance;
|
||||
}
|
||||
|
@ -146,6 +149,7 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
|
|||
/** {@inheritDoc}
|
||||
* @see #getPhase(Vector3D)
|
||||
*/
|
||||
@Override
|
||||
public S1Point toSubSpace(final Point<Sphere2D> point) {
|
||||
return new S1Point(getPhase(((S2Point) point).getVector()));
|
||||
}
|
||||
|
@ -167,6 +171,7 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
|
|||
/** {@inheritDoc}
|
||||
* @see #getPointAt(double)
|
||||
*/
|
||||
@Override
|
||||
public S2Point toSpace(final Point<Sphere1D> point) {
|
||||
return new S2Point(getPointAt(((S1Point) point).getAlpha()));
|
||||
}
|
||||
|
@ -236,6 +241,7 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public SubCircle wholeHyperplane() {
|
||||
return new SubCircle(this, new ArcsSet(tolerance));
|
||||
}
|
||||
|
@ -244,6 +250,7 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
|
|||
* @return a region containing the instance (really a {@link
|
||||
* SphericalPolygonsSet SphericalPolygonsSet} instance)
|
||||
*/
|
||||
@Override
|
||||
public SphericalPolygonsSet wholeSpace() {
|
||||
return new SphericalPolygonsSet(tolerance);
|
||||
}
|
||||
|
@ -251,6 +258,7 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
|
|||
/** {@inheritDoc}
|
||||
* @see #getOffset(Vector3D)
|
||||
*/
|
||||
@Override
|
||||
public double getOffset(final Point<Sphere2D> point) {
|
||||
return getOffset(((S2Point) point).getVector());
|
||||
}
|
||||
|
@ -269,6 +277,7 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean sameOrientationAs(final Hyperplane<Sphere2D> other) {
|
||||
final Circle otherC = (Circle) other;
|
||||
return Vector3D.dotProduct(pole, otherC.pole) >= 0.0;
|
||||
|
@ -300,11 +309,13 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public S2Point apply(final Point<Sphere2D> point) {
|
||||
return new S2Point(rotation.applyTo(((S2Point) point).getVector()));
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Circle apply(final Hyperplane<Sphere2D> hyperplane) {
|
||||
final Circle circle = (Circle) hyperplane;
|
||||
return new Circle(rotation.applyTo(circle.pole),
|
||||
|
@ -314,6 +325,7 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public SubHyperplane<Sphere1D> apply(final SubHyperplane<Sphere1D> sub,
|
||||
final Hyperplane<Sphere2D> original,
|
||||
final Hyperplane<Sphere2D> transformed) {
|
||||
|
|
|
@ -60,11 +60,13 @@ class EdgesBuilder implements BSPTreeVisitor<Sphere2D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Order visitOrder(final BSPTree<Sphere2D> node) {
|
||||
return Order.MINUS_SUB_PLUS;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitInternalNode(final BSPTree<Sphere2D> node) {
|
||||
nodeToEdgesList.put(node, new ArrayList<Edge>());
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -78,6 +80,7 @@ class EdgesBuilder implements BSPTreeVisitor<Sphere2D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitLeafNode(final BSPTree<Sphere2D> node) {
|
||||
}
|
||||
|
||||
|
|
|
@ -54,16 +54,19 @@ class PropertiesComputer implements BSPTreeVisitor<Sphere2D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Order visitOrder(final BSPTree<Sphere2D> node) {
|
||||
return Order.MINUS_SUB_PLUS;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitInternalNode(final BSPTree<Sphere2D> node) {
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void visitLeafNode(final BSPTree<Sphere2D> node) {
|
||||
if ((Boolean) node.getAttribute()) {
|
||||
|
||||
|
|
|
@ -152,11 +152,13 @@ public class S2Point implements Point<Sphere2D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Space getSpace() {
|
||||
return Sphere2D.getInstance();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isNaN() {
|
||||
return Double.isNaN(theta) || Double.isNaN(phi);
|
||||
}
|
||||
|
@ -169,6 +171,7 @@ public class S2Point implements Point<Sphere2D> {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public double distance(final Point<Sphere2D> point) {
|
||||
return distance(this, (S2Point) point);
|
||||
}
|
||||
|
|
|
@ -50,11 +50,13 @@ public class Sphere2D implements Serializable, Space {
|
|||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int getDimension() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Sphere1D getSubSpace() {
|
||||
return Sphere1D.getInstance();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue