You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ra...@apache.org on 2017/05/06 15:04:23 UTC
[10/19] [math] MATH-1284: Replace/rename Coordinate?D classes (nee
Vector?D) as Cartesian?D classes as per discussion. When there are existing
overridden methods accepting Vector and Point,
add a disambiguating method accepting
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e21d4d43/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java
index a05ab8e..6392e3f 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java
@@ -820,8 +820,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusK) coordinates are :
// sin (theta), -sin (phi) cos (theta), cos (phi) cos (theta)
// and we can choose to have theta in the interval [-PI/2 ; +PI/2]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_I);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_K);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_I);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_K);
if ((v2.getX().getReal() < -0.9999999999) || (v2.getX().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(true);
}
@@ -836,8 +836,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusJ) coordinates are :
// -sin (psi), cos (phi) cos (psi), sin (phi) cos (psi)
// and we can choose to have psi in the interval [-PI/2 ; +PI/2]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_I);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_J);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_I);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_J);
if ((v2.getX().getReal() < -0.9999999999) || (v2.getX().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(true);
}
@@ -852,8 +852,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusK) coordinates are :
// sin (theta) cos (phi), -sin (phi), cos (theta) cos (phi)
// and we can choose to have phi in the interval [-PI/2 ; +PI/2]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_J);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_K);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_J);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_K);
if ((v2.getY().getReal() < -0.9999999999) || (v2.getY().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(true);
}
@@ -868,8 +868,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusI) coordinates are :
// cos (theta) cos (psi), sin (psi), -sin (theta) cos (psi)
// and we can choose to have psi in the interval [-PI/2 ; +PI/2]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_J);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_I);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_J);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_I);
if ((v2.getY().getReal() < -0.9999999999) || (v2.getY().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(true);
}
@@ -884,8 +884,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusJ) coordinates are :
// -sin (psi) cos (phi), cos (psi) cos (phi), sin (phi)
// and we can choose to have phi in the interval [-PI/2 ; +PI/2]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_K);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_J);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_K);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_J);
if ((v2.getZ().getReal() < -0.9999999999) || (v2.getZ().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(true);
}
@@ -900,8 +900,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusI) coordinates are :
// cos (psi) cos (theta), sin (psi) cos (theta), -sin (theta)
// and we can choose to have theta in the interval [-PI/2 ; +PI/2]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_K);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_I);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_K);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_I);
if ((v2.getZ().getReal() < -0.9999999999) || (v2.getZ().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(true);
}
@@ -916,8 +916,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusI) coordinates are :
// cos (theta), sin (theta) sin (phi1), -sin (theta) cos (phi1)
// and we can choose to have theta in the interval [0 ; PI]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_I);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_I);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_I);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_I);
if ((v2.getX().getReal() < -0.9999999999) || (v2.getX().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(false);
}
@@ -932,8 +932,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusI) coordinates are :
// cos (psi), sin (psi) cos (phi1), sin (psi) sin (phi1)
// and we can choose to have psi in the interval [0 ; PI]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_I);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_I);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_I);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_I);
if ((v2.getX().getReal() < -0.9999999999) || (v2.getX().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(false);
}
@@ -948,8 +948,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusJ) coordinates are :
// sin (theta1) sin (phi), cos (phi), cos (theta1) sin (phi)
// and we can choose to have phi in the interval [0 ; PI]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_J);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_J);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_J);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_J);
if ((v2.getY().getReal() < -0.9999999999) || (v2.getY().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(false);
}
@@ -964,8 +964,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusJ) coordinates are :
// -cos (theta1) sin (psi), cos (psi), sin (theta1) sin (psi)
// and we can choose to have psi in the interval [0 ; PI]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_J);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_J);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_J);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_J);
if ((v2.getY().getReal() < -0.9999999999) || (v2.getY().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(false);
}
@@ -980,8 +980,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusK) coordinates are :
// sin (psi1) sin (phi), -cos (psi1) sin (phi), cos (phi)
// and we can choose to have phi in the interval [0 ; PI]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_K);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_K);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_K);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_K);
if ((v2.getZ().getReal() < -0.9999999999) || (v2.getZ().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(false);
}
@@ -996,8 +996,8 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
// (-r) (Vector3D.plusK) coordinates are :
// cos (psi1) sin (theta), sin (psi1) sin (theta), cos (theta)
// and we can choose to have theta in the interval [0 ; PI]
- FieldVector3D<T> v1 = applyTo(Coordinates3D.PLUS_K);
- FieldVector3D<T> v2 = applyInverseTo(Coordinates3D.PLUS_K);
+ FieldVector3D<T> v1 = applyTo(Cartesian3D.PLUS_K);
+ FieldVector3D<T> v2 = applyInverseTo(Cartesian3D.PLUS_K);
if ((v2.getZ().getReal() < -0.9999999999) || (v2.getZ().getReal() > 0.9999999999)) {
throw new CardanEulerSingularityException(false);
}
@@ -1100,7 +1100,7 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
* @param u vector to apply the rotation to
* @return a new vector which is the image of u by the rotation
*/
- public FieldVector3D<T> applyTo(final Coordinates3D u) {
+ public FieldVector3D<T> applyTo(final Cartesian3D u) {
final double x = u.getX();
final double y = u.getY();
@@ -1194,7 +1194,7 @@ public class FieldRotation<T extends RealFieldElement<T>> implements Serializabl
* @param u vector to apply the inverse of the rotation to
* @return a new vector which such that u is its image by the rotation
*/
- public FieldVector3D<T> applyInverseTo(final Coordinates3D u) {
+ public FieldVector3D<T> applyInverseTo(final Cartesian3D u) {
final double x = u.getX();
final double y = u.getY();
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e21d4d43/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java
index dc538a5..ac31622 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java
@@ -28,7 +28,7 @@ import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.MathArrays;
/**
- * This class is a re-implementation of {@link Coordinates3D} using {@link RealFieldElement}.
+ * This class is a re-implementation of {@link Cartesian3D} using {@link RealFieldElement}.
* <p>Instance of this class are guaranteed to be immutable.</p>
* @param <T> the type of the field elements
* @since 3.2
@@ -110,7 +110,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param a scale factor
* @param u base (unscaled) vector
*/
- public FieldVector3D(final T a, final Coordinates3D u) {
+ public FieldVector3D(final T a, final Cartesian3D u) {
this.x = a.multiply(u.getX());
this.y = a.multiply(u.getY());
this.z = a.multiply(u.getZ());
@@ -152,8 +152,8 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param a2 second scale factor
* @param u2 second base (unscaled) vector
*/
- public FieldVector3D(final T a1, final Coordinates3D u1,
- final T a2, final Coordinates3D u2) {
+ public FieldVector3D(final T a1, final Cartesian3D u1,
+ final T a2, final Cartesian3D u2) {
final T prototype = a1;
this.x = prototype.linearCombination(u1.getX(), a1, u2.getX(), a2);
this.y = prototype.linearCombination(u1.getY(), a1, u2.getY(), a2);
@@ -205,9 +205,9 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param a3 third scale factor
* @param u3 third base (unscaled) vector
*/
- public FieldVector3D(final T a1, final Coordinates3D u1,
- final T a2, final Coordinates3D u2,
- final T a3, final Coordinates3D u3) {
+ public FieldVector3D(final T a1, final Cartesian3D u1,
+ final T a2, final Cartesian3D u2,
+ final T a3, final Cartesian3D u3) {
final T prototype = a1;
this.x = prototype.linearCombination(u1.getX(), a1, u2.getX(), a2, u3.getX(), a3);
this.y = prototype.linearCombination(u1.getY(), a1, u2.getY(), a2, u3.getY(), a3);
@@ -267,10 +267,10 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param a4 fourth scale factor
* @param u4 fourth base (unscaled) vector
*/
- public FieldVector3D(final T a1, final Coordinates3D u1,
- final T a2, final Coordinates3D u2,
- final T a3, final Coordinates3D u3,
- final T a4, final Coordinates3D u4) {
+ public FieldVector3D(final T a1, final Cartesian3D u1,
+ final T a2, final Cartesian3D u2,
+ final T a3, final Cartesian3D u3,
+ final T a4, final Cartesian3D u4) {
final T prototype = a1;
this.x = prototype.linearCombination(u1.getX(), a1, u2.getX(), a2, u3.getX(), a3, u4.getX(), a4);
this.y = prototype.linearCombination(u1.getY(), a1, u2.getY(), a2, u3.getY(), a3, u4.getY(), a4);
@@ -338,8 +338,8 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
/** Convert to a constant vector without derivatives.
* @return a constant vector
*/
- public Coordinates3D toVector3D() {
- return new Coordinates3D(x.getReal(), y.getReal(), z.getReal());
+ public Cartesian3D toVector3D() {
+ return new Cartesian3D(x.getReal(), y.getReal(), z.getReal());
}
/** Get the L<sub>1</sub> norm for the vector.
@@ -415,7 +415,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v vector to add
* @return a new vector
*/
- public FieldVector3D<T> add(final Coordinates3D v) {
+ public FieldVector3D<T> add(final Cartesian3D v) {
return new FieldVector3D<>(x.add(v.getX()), y.add(v.getY()), z.add(v.getZ()));
}
@@ -433,7 +433,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v vector to add
* @return a new vector
*/
- public FieldVector3D<T> add(final T factor, final Coordinates3D v) {
+ public FieldVector3D<T> add(final T factor, final Cartesian3D v) {
return new FieldVector3D<>(x.add(factor.multiply(v.getX())),
y.add(factor.multiply(v.getY())),
z.add(factor.multiply(v.getZ())));
@@ -453,7 +453,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v vector to add
* @return a new vector
*/
- public FieldVector3D<T> add(final double factor, final Coordinates3D v) {
+ public FieldVector3D<T> add(final double factor, final Cartesian3D v) {
return new FieldVector3D<>(x.add(factor * v.getX()),
y.add(factor * v.getY()),
z.add(factor * v.getZ()));
@@ -471,7 +471,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v vector to subtract
* @return a new vector
*/
- public FieldVector3D<T> subtract(final Coordinates3D v) {
+ public FieldVector3D<T> subtract(final Cartesian3D v) {
return new FieldVector3D<>(x.subtract(v.getX()), y.subtract(v.getY()), z.subtract(v.getZ()));
}
@@ -489,7 +489,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v vector to subtract
* @return a new vector
*/
- public FieldVector3D<T> subtract(final T factor, final Coordinates3D v) {
+ public FieldVector3D<T> subtract(final T factor, final Cartesian3D v) {
return new FieldVector3D<>(x.subtract(factor.multiply(v.getX())),
y.subtract(factor.multiply(v.getY())),
z.subtract(factor.multiply(v.getZ())));
@@ -509,7 +509,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v vector to subtract
* @return a new vector
*/
- public FieldVector3D<T> subtract(final double factor, final Coordinates3D v) {
+ public FieldVector3D<T> subtract(final double factor, final Cartesian3D v) {
return new FieldVector3D<>(x.subtract(factor * v.getX()),
y.subtract(factor * v.getY()),
z.subtract(factor * v.getZ()));
@@ -610,7 +610,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @return angular separation between v1 and v2
* @exception MathArithmeticException if either vector has a null norm
*/
- public static <T extends RealFieldElement<T>> T angle(final FieldVector3D<T> v1, final Coordinates3D v2)
+ public static <T extends RealFieldElement<T>> T angle(final FieldVector3D<T> v1, final Cartesian3D v2)
throws MathArithmeticException {
final T normProduct = v1.getNorm().multiply(v2.getNorm());
@@ -646,7 +646,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @return angular separation between v1 and v2
* @exception MathArithmeticException if either vector has a null norm
*/
- public static <T extends RealFieldElement<T>> T angle(final Coordinates3D v1, final FieldVector3D<T> v2)
+ public static <T extends RealFieldElement<T>> T angle(final Cartesian3D v1, final FieldVector3D<T> v2)
throws MathArithmeticException {
return angle(v2, v1);
}
@@ -770,7 +770,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v second vector
* @return the dot product this.v
*/
- public T dotProduct(final Coordinates3D v) {
+ public T dotProduct(final Cartesian3D v) {
return x.linearCombination(v.getX(), x, v.getY(), y, v.getZ(), z);
}
@@ -788,7 +788,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v other vector
* @return the cross product this ^ v as a new Vector3D
*/
- public FieldVector3D<T> crossProduct(final Coordinates3D v) {
+ public FieldVector3D<T> crossProduct(final Cartesian3D v) {
return new FieldVector3D<>(x.linearCombination(v.getZ(), y, -v.getY(), z),
y.linearCombination(v.getX(), z, -v.getZ(), x),
z.linearCombination(v.getY(), x, -v.getX(), y));
@@ -815,7 +815,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v second vector
* @return the distance between the instance and p according to the L<sub>1</sub> norm
*/
- public T distance1(final Coordinates3D v) {
+ public T distance1(final Cartesian3D v) {
final T dx = x.subtract(v.getX()).abs();
final T dy = y.subtract(v.getY()).abs();
final T dz = z.subtract(v.getZ()).abs();
@@ -843,7 +843,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v second vector
* @return the distance between the instance and p according to the L<sub>2</sub> norm
*/
- public T distance(final Coordinates3D v) {
+ public T distance(final Cartesian3D v) {
final T dx = x.subtract(v.getX());
final T dy = y.subtract(v.getY());
final T dz = z.subtract(v.getZ());
@@ -883,7 +883,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v second vector
* @return the distance between the instance and p according to the L<sub>∞</sub> norm
*/
- public T distanceInf(final Coordinates3D v) {
+ public T distanceInf(final Cartesian3D v) {
final T dx = x.subtract(v.getX()).abs();
final T dy = y.subtract(v.getY()).abs();
final T dz = z.subtract(v.getZ()).abs();
@@ -923,7 +923,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param v second vector
* @return the square of the distance between the instance and p
*/
- public T distanceSq(final Coordinates3D v) {
+ public T distanceSq(final Cartesian3D v) {
final T dx = x.subtract(v.getX());
final T dy = y.subtract(v.getY());
final T dz = z.subtract(v.getZ());
@@ -948,7 +948,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @return the dot product v1.v2
*/
public static <T extends RealFieldElement<T>> T dotProduct(final FieldVector3D<T> v1,
- final Coordinates3D v2) {
+ final Cartesian3D v2) {
return v1.dotProduct(v2);
}
@@ -958,7 +958,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param <T> the type of the field elements
* @return the dot product v1.v2
*/
- public static <T extends RealFieldElement<T>> T dotProduct(final Coordinates3D v1,
+ public static <T extends RealFieldElement<T>> T dotProduct(final Cartesian3D v1,
final FieldVector3D<T> v2) {
return v2.dotProduct(v1);
}
@@ -981,7 +981,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @return the cross product v1 ^ v2 as a new Vector
*/
public static <T extends RealFieldElement<T>> FieldVector3D<T> crossProduct(final FieldVector3D<T> v1,
- final Coordinates3D v2) {
+ final Cartesian3D v2) {
return v1.crossProduct(v2);
}
@@ -991,7 +991,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param <T> the type of the field elements
* @return the cross product v1 ^ v2 as a new Vector
*/
- public static <T extends RealFieldElement<T>> FieldVector3D<T> crossProduct(final Coordinates3D v1,
+ public static <T extends RealFieldElement<T>> FieldVector3D<T> crossProduct(final Cartesian3D v1,
final FieldVector3D<T> v2) {
return new FieldVector3D<>(v2.x.linearCombination(v1.getY(), v2.z, -v1.getZ(), v2.y),
v2.y.linearCombination(v1.getZ(), v2.x, -v1.getX(), v2.z),
@@ -1022,7 +1022,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @return the distance between v1 and v2 according to the L<sub>1</sub> norm
*/
public static <T extends RealFieldElement<T>> T distance1(final FieldVector3D<T> v1,
- final Coordinates3D v2) {
+ final Cartesian3D v2) {
return v1.distance1(v2);
}
@@ -1035,7 +1035,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param <T> the type of the field elements
* @return the distance between v1 and v2 according to the L<sub>1</sub> norm
*/
- public static <T extends RealFieldElement<T>> T distance1(final Coordinates3D v1,
+ public static <T extends RealFieldElement<T>> T distance1(final Cartesian3D v1,
final FieldVector3D<T> v2) {
return v2.distance1(v1);
}
@@ -1064,7 +1064,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @return the distance between v1 and v2 according to the L<sub>2</sub> norm
*/
public static <T extends RealFieldElement<T>> T distance(final FieldVector3D<T> v1,
- final Coordinates3D v2) {
+ final Cartesian3D v2) {
return v1.distance(v2);
}
@@ -1077,7 +1077,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param <T> the type of the field elements
* @return the distance between v1 and v2 according to the L<sub>2</sub> norm
*/
- public static <T extends RealFieldElement<T>> T distance(final Coordinates3D v1,
+ public static <T extends RealFieldElement<T>> T distance(final Cartesian3D v1,
final FieldVector3D<T> v2) {
return v2.distance(v1);
}
@@ -1106,7 +1106,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @return the distance between v1 and v2 according to the L<sub>∞</sub> norm
*/
public static <T extends RealFieldElement<T>> T distanceInf(final FieldVector3D<T> v1,
- final Coordinates3D v2) {
+ final Cartesian3D v2) {
return v1.distanceInf(v2);
}
@@ -1119,7 +1119,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param <T> the type of the field elements
* @return the distance between v1 and v2 according to the L<sub>∞</sub> norm
*/
- public static <T extends RealFieldElement<T>> T distanceInf(final Coordinates3D v1,
+ public static <T extends RealFieldElement<T>> T distanceInf(final Cartesian3D v1,
final FieldVector3D<T> v2) {
return v2.distanceInf(v1);
}
@@ -1148,7 +1148,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @return the square of the distance between v1 and v2
*/
public static <T extends RealFieldElement<T>> T distanceSq(final FieldVector3D<T> v1,
- final Coordinates3D v2) {
+ final Cartesian3D v2) {
return v1.distanceSq(v2);
}
@@ -1161,7 +1161,7 @@ public class FieldVector3D<T extends RealFieldElement<T>> implements Serializabl
* @param <T> the type of the field elements
* @return the square of the distance between v1 and v2
*/
- public static <T extends RealFieldElement<T>> T distanceSq(final Coordinates3D v1,
+ public static <T extends RealFieldElement<T>> T distanceSq(final Cartesian3D v1,
final FieldVector3D<T> v2) {
return v2.distanceSq(v1);
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e21d4d43/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
index d68bb94..4ec55a3 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
@@ -22,7 +22,7 @@ import org.apache.commons.math4.geometry.Point;
import org.apache.commons.math4.geometry.Vector;
import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math4.geometry.euclidean.oned.Coordinates1D;
+import org.apache.commons.math4.geometry.euclidean.oned.Cartesian1D;
import org.apache.commons.math4.geometry.partitioning.Embedding;
import org.apache.commons.math4.util.FastMath;
import org.apache.commons.math4.util.Precision;
@@ -41,10 +41,10 @@ import org.apache.commons.math4.util.Precision;
public class Line implements Embedding<Euclidean3D, Euclidean1D> {
/** Line direction. */
- private Coordinates3D direction;
+ private Cartesian3D direction;
/** Line point closest to the origin. */
- private Coordinates3D zero;
+ private Cartesian3D zero;
/** Tolerance below which points are considered identical. */
private final double tolerance;
@@ -56,7 +56,7 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @exception MathIllegalArgumentException if the points are equal
* @since 3.3
*/
- public Line(final Coordinates3D p1, final Coordinates3D p2, final double tolerance)
+ public Line(final Cartesian3D p1, final Cartesian3D p2, final double tolerance)
throws MathIllegalArgumentException {
reset(p1, p2);
this.tolerance = tolerance;
@@ -78,14 +78,14 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @param p2 second point belonging to the line (this can be any point, different from p1)
* @exception MathIllegalArgumentException if the points are equal
*/
- public void reset(final Coordinates3D p1, final Coordinates3D p2) throws MathIllegalArgumentException {
- final Coordinates3D delta = p2.subtract(p1);
+ public void reset(final Cartesian3D p1, final Cartesian3D p2) throws MathIllegalArgumentException {
+ final Cartesian3D delta = p2.subtract(p1);
final double norm2 = delta.getNormSq();
if (norm2 == 0.0) {
throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM);
}
- this.direction = new Coordinates3D(1.0 / FastMath.sqrt(norm2), delta);
- zero = new Coordinates3D(1.0, p1, -p1.dotProduct(delta) / norm2, delta);
+ this.direction = new Cartesian3D(1.0 / FastMath.sqrt(norm2), delta);
+ zero = new Cartesian3D(1.0, p1, -p1.dotProduct(delta) / norm2, delta);
}
/** Get the tolerance below which points are considered identical.
@@ -108,14 +108,14 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
/** Get the normalized direction vector.
* @return normalized direction vector
*/
- public Coordinates3D getDirection() {
+ public Cartesian3D getDirection() {
return direction;
}
/** Get the line point closest to the origin.
* @return line point closest to the origin
*/
- public Coordinates3D getOrigin() {
+ public Cartesian3D getOrigin() {
return zero;
}
@@ -126,7 +126,7 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @param point point to check
* @return abscissa of the point
*/
- public double getAbscissa(final Coordinates3D point) {
+ public double getAbscissa(final Cartesian3D point) {
return point.subtract(zero).dotProduct(direction);
}
@@ -134,8 +134,8 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @param abscissa desired abscissa for the point
* @return one point belonging to the line, at specified abscissa
*/
- public Coordinates3D pointAt(final double abscissa) {
- return new Coordinates3D(1.0, zero, abscissa, direction);
+ public Cartesian3D pointAt(final double abscissa) {
+ return new Cartesian3D(1.0, zero, abscissa, direction);
}
/** Transform a space point into a sub-space point.
@@ -143,7 +143,7 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @return (n-1)-dimension point of the sub-space corresponding to
* the specified space point
*/
- public Coordinates1D toSubSpace(Vector<Euclidean3D> vector) {
+ public Cartesian1D toSubSpace(Vector<Euclidean3D> vector) {
return toSubSpace((Point<Euclidean3D>) vector);
}
@@ -152,24 +152,42 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @return n-dimension point of the space corresponding to the
* specified sub-space point
*/
- public Coordinates3D toSpace(Vector<Euclidean1D> vector) {
+ public Cartesian3D toSpace(Vector<Euclidean1D> vector) {
return toSpace((Point<Euclidean1D>) vector);
}
/** {@inheritDoc}
- * @see #getAbscissa(Vector3D)
+ * @see #getAbscissa(Cartesian3D)
*/
@Override
- public Coordinates1D toSubSpace(final Point<Euclidean3D> point) {
- return new Coordinates1D(getAbscissa((Coordinates3D) point));
+ public Cartesian1D toSubSpace(final Point<Euclidean3D> point) {
+ return toSubSpace((Cartesian3D) point);
}
/** {@inheritDoc}
* @see #pointAt(double)
*/
@Override
- public Coordinates3D toSpace(final Point<Euclidean1D> point) {
- return pointAt(((Coordinates1D) point).getX());
+ public Cartesian3D toSpace(final Point<Euclidean1D> point) {
+ return toSpace((Cartesian1D) point);
+ }
+
+ /** Transform a space point into a sub-space point.
+ * @param point n-dimension point of the space
+ * @return (n-1)-dimension point of the sub-space corresponding to
+ * the specified space point
+ */
+ public Cartesian1D toSubSpace(final Cartesian3D point) {
+ return new Cartesian1D(getAbscissa(point));
+ }
+
+ /** Transform a sub-space point into a space point.
+ * @param point (n-1)-dimension point of the sub-space
+ * @return n-dimension point of the space corresponding to the
+ * specified sub-space point
+ */
+ public Cartesian3D toSpace(final Cartesian1D point) {
+ return pointAt(point.getX());
}
/** Check if the instance is similar to another line.
@@ -180,7 +198,7 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @return true if the lines are similar
*/
public boolean isSimilarTo(final Line line) {
- final double angle = Coordinates3D.angle(direction, line.direction);
+ final double angle = Cartesian3D.angle(direction, line.direction);
return ((angle < tolerance) || (angle > (FastMath.PI - tolerance))) && contains(line.zero);
}
@@ -188,7 +206,7 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @param p point to check
* @return true if p belongs to the line
*/
- public boolean contains(final Coordinates3D p) {
+ public boolean contains(final Cartesian3D p) {
return distance(p) < tolerance;
}
@@ -196,9 +214,9 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @param p to check
* @return distance between the instance and the point
*/
- public double distance(final Coordinates3D p) {
- final Coordinates3D d = p.subtract(zero);
- final Coordinates3D n = new Coordinates3D(1.0, d, -d.dotProduct(direction), direction);
+ public double distance(final Cartesian3D p) {
+ final Cartesian3D d = p.subtract(zero);
+ final Cartesian3D n = new Cartesian3D(1.0, d, -d.dotProduct(direction), direction);
return n.getNorm();
}
@@ -208,7 +226,7 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
*/
public double distance(final Line line) {
- final Coordinates3D normal = Coordinates3D.crossProduct(direction, line.direction);
+ final Cartesian3D normal = Cartesian3D.crossProduct(direction, line.direction);
final double n = normal.getNorm();
if (n < Precision.SAFE_MIN) {
// lines are parallel
@@ -226,7 +244,7 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @param line line to check against the instance
* @return point of the instance closest to another line
*/
- public Coordinates3D closestPoint(final Line line) {
+ public Cartesian3D closestPoint(final Line line) {
final double cos = direction.dotProduct(line.direction);
final double n = 1 - cos * cos;
@@ -235,11 +253,11 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
return zero;
}
- final Coordinates3D delta0 = line.zero.subtract(zero);
+ final Cartesian3D delta0 = line.zero.subtract(zero);
final double a = delta0.dotProduct(direction);
final double b = delta0.dotProduct(line.direction);
- return new Coordinates3D(1, zero, (a - b * cos) / n, direction);
+ return new Cartesian3D(1, zero, (a - b * cos) / n, direction);
}
@@ -248,8 +266,8 @@ public class Line implements Embedding<Euclidean3D, Euclidean1D> {
* @return intersection point of the instance and the other line
* or null if there are no intersection points
*/
- public Coordinates3D intersection(final Line line) {
- final Coordinates3D closest = closestPoint(line);
+ public Cartesian3D intersection(final Line line) {
+ final Cartesian3D closest = closestPoint(line);
return line.contains(closest) ? closest : null;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e21d4d43/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java
index 90eeef7..71657e2 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java
@@ -21,7 +21,7 @@ import java.util.ArrayList;
import org.apache.commons.math4.geometry.Point;
import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
import org.apache.commons.math4.geometry.euclidean.twod.PolygonsSet;
-import org.apache.commons.math4.geometry.euclidean.twod.Coordinates2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Cartesian2D;
import org.apache.commons.math4.geometry.partitioning.AbstractSubHyperplane;
import org.apache.commons.math4.geometry.partitioning.BSPTree;
import org.apache.commons.math4.geometry.partitioning.BSPTreeVisitor;
@@ -38,29 +38,29 @@ import org.apache.commons.math4.util.FastMath;
public class OutlineExtractor {
/** Abscissa axis of the projection plane. */
- private final Coordinates3D u;
+ private final Cartesian3D u;
/** Ordinate axis of the projection plane. */
- private final Coordinates3D v;
+ private final Cartesian3D v;
/** Normal of the projection plane (viewing direction). */
- private final Coordinates3D w;
+ private final Cartesian3D w;
/** Build an extractor for a specific projection plane.
* @param u abscissa axis of the projection point
* @param v ordinate axis of the projection point
*/
- public OutlineExtractor(final Coordinates3D u, final Coordinates3D v) {
+ public OutlineExtractor(final Cartesian3D u, final Cartesian3D v) {
this.u = u;
this.v = v;
- w = Coordinates3D.crossProduct(u, v);
+ w = Cartesian3D.crossProduct(u, v);
}
/** Extract the outline of a polyhedrons set.
* @param polyhedronsSet polyhedrons set whose outline must be extracted
* @return an outline, as an array of loops.
*/
- public Coordinates2D[][] getOutline(final PolyhedronsSet polyhedronsSet) {
+ public Cartesian2D[][] getOutline(final PolyhedronsSet polyhedronsSet) {
// project all boundary facets into one polygons set
final BoundaryProjector projector = new BoundaryProjector(polyhedronsSet.getTolerance());
@@ -68,9 +68,9 @@ public class OutlineExtractor {
final PolygonsSet projected = projector.getProjected();
// Remove the spurious intermediate vertices from the outline
- final Coordinates2D[][] outline = projected.getVertices();
+ final Cartesian2D[][] outline = projected.getVertices();
for (int i = 0; i < outline.length; ++i) {
- final Coordinates2D[] rawLoop = outline[i];
+ final Cartesian2D[] rawLoop = outline[i];
int end = rawLoop.length;
int j = 0;
while (j < end) {
@@ -87,7 +87,7 @@ public class OutlineExtractor {
}
if (end != rawLoop.length) {
// resize the array
- outline[i] = new Coordinates2D[end];
+ outline[i] = new Cartesian2D[end];
System.arraycopy(rawLoop, 0, outline[i], 0, end);
}
}
@@ -104,10 +104,10 @@ public class OutlineExtractor {
* @param i index of the point to check (must be between 0 and n-1)
* @return true if the point is exactly between its neighbors
*/
- private boolean pointIsBetween(final Coordinates2D[] loop, final int n, final int i) {
- final Coordinates2D previous = loop[(i + n - 1) % n];
- final Coordinates2D current = loop[i];
- final Coordinates2D next = loop[(i + 1) % n];
+ private boolean pointIsBetween(final Cartesian2D[] loop, final int n, final int i) {
+ final Cartesian2D previous = loop[(i + n - 1) % n];
+ final Cartesian2D current = loop[i];
+ final Cartesian2D next = loop[(i + 1) % n];
final double dx1 = current.getX() - previous.getX();
final double dy1 = current.getY() - previous.getY();
final double dx2 = next.getX() - current.getX();
@@ -174,16 +174,16 @@ public class OutlineExtractor {
final double scal = plane.getNormal().dotProduct(w);
if (FastMath.abs(scal) > 1.0e-3) {
- Coordinates2D[][] vertices =
+ Cartesian2D[][] vertices =
((PolygonsSet) absFacet.getRemainingRegion()).getVertices();
if ((scal < 0) ^ reversed) {
// the facet is seen from the inside,
// we need to invert its boundary orientation
- final Coordinates2D[][] newVertices = new Coordinates2D[vertices.length][];
+ final Cartesian2D[][] newVertices = new Cartesian2D[vertices.length][];
for (int i = 0; i < vertices.length; ++i) {
- final Coordinates2D[] loop = vertices[i];
- final Coordinates2D[] newLoop = new Coordinates2D[loop.length];
+ final Cartesian2D[] loop = vertices[i];
+ final Cartesian2D[] newLoop = new Cartesian2D[loop.length];
if (loop[0] == null) {
newLoop[0] = null;
for (int j = 1; j < loop.length; ++j) {
@@ -204,17 +204,17 @@ public class OutlineExtractor {
// compute the projection of the facet in the outline plane
final ArrayList<SubHyperplane<Euclidean2D>> edges = new ArrayList<>();
- for (Coordinates2D[] loop : vertices) {
+ for (Cartesian2D[] loop : vertices) {
final boolean closed = loop[0] != null;
int previous = closed ? (loop.length - 1) : 1;
- Coordinates3D previous3D = plane.toSpace((Point<Euclidean2D>) loop[previous]);
+ Cartesian3D previous3D = plane.toSpace(loop[previous]);
int current = (previous + 1) % loop.length;
- Coordinates2D pPoint = new Coordinates2D(previous3D.dotProduct(u),
+ Cartesian2D pPoint = new Cartesian2D(previous3D.dotProduct(u),
previous3D.dotProduct(v));
while (current < loop.length) {
- final Coordinates3D current3D = plane.toSpace((Point<Euclidean2D>) loop[current]);
- final Coordinates2D cPoint = new Coordinates2D(current3D.dotProduct(u),
+ final Cartesian3D current3D = plane.toSpace((Point<Euclidean2D>) loop[current]);
+ final Cartesian2D cPoint = new Cartesian2D(current3D.dotProduct(u),
current3D.dotProduct(v));
final org.apache.commons.math4.geometry.euclidean.twod.Line line =
new org.apache.commons.math4.geometry.euclidean.twod.Line(pPoint, cPoint, tolerance);
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e21d4d43/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Plane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Plane.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Plane.java
index 0038194..6ecd727 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Plane.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Plane.java
@@ -19,11 +19,11 @@ package org.apache.commons.math4.geometry.euclidean.threed;
import org.apache.commons.math4.exception.MathArithmeticException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.geometry.Point;
-import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math4.geometry.euclidean.oned.Coordinates1D;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.geometry.euclidean.oned.Cartesian1D;
import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
import org.apache.commons.math4.geometry.euclidean.twod.PolygonsSet;
-import org.apache.commons.math4.geometry.euclidean.twod.Coordinates2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Cartesian2D;
import org.apache.commons.math4.geometry.partitioning.Embedding;
import org.apache.commons.math4.geometry.partitioning.Hyperplane;
import org.apache.commons.math4.util.FastMath;
@@ -37,16 +37,16 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
private double originOffset;
/** Origin of the plane frame. */
- private Coordinates3D origin;
+ private Cartesian3D origin;
/** First vector of the plane frame (in plane). */
- private Coordinates3D u;
+ private Cartesian3D u;
/** Second vector of the plane frame (in plane). */
- private Coordinates3D v;
+ private Cartesian3D v;
/** Third vector of the plane frame (plane normal). */
- private Coordinates3D w;
+ private Cartesian3D w;
/** Tolerance below which points are considered identical. */
private final double tolerance;
@@ -57,7 +57,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @exception MathArithmeticException if the normal norm is too small
* @since 3.3
*/
- public Plane(final Coordinates3D normal, final double tolerance)
+ public Plane(final Cartesian3D normal, final double tolerance)
throws MathArithmeticException {
setNormal(normal);
this.tolerance = tolerance;
@@ -72,7 +72,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @exception MathArithmeticException if the normal norm is too small
* @since 3.3
*/
- public Plane(final Coordinates3D p, final Coordinates3D normal, final double tolerance)
+ public Plane(final Cartesian3D p, final Cartesian3D normal, final double tolerance)
throws MathArithmeticException {
setNormal(normal);
this.tolerance = tolerance;
@@ -90,7 +90,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @exception MathArithmeticException if the points do not constitute a plane
* @since 3.3
*/
- public Plane(final Coordinates3D p1, final Coordinates3D p2, final Coordinates3D p3, final double tolerance)
+ public Plane(final Cartesian3D p1, final Cartesian3D p2, final Cartesian3D p3, final double tolerance)
throws MathArithmeticException {
this(p1, p2.subtract(p1).crossProduct(p3.subtract(p1)), tolerance);
}
@@ -126,7 +126,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @param normal normal direction to the plane
* @exception MathArithmeticException if the normal norm is too small
*/
- public void reset(final Coordinates3D p, final Coordinates3D normal) throws MathArithmeticException {
+ public void reset(final Cartesian3D p, final Cartesian3D normal) throws MathArithmeticException {
setNormal(normal);
originOffset = -p.dotProduct(w);
setFrame();
@@ -150,20 +150,20 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @param normal normal direction to the plane (will be copied)
* @exception MathArithmeticException if the normal norm is too small
*/
- private void setNormal(final Coordinates3D normal) throws MathArithmeticException {
+ private void setNormal(final Cartesian3D normal) throws MathArithmeticException {
final double norm = normal.getNorm();
if (norm < 1.0e-10) {
throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
}
- w = new Coordinates3D(1.0 / norm, normal);
+ w = new Cartesian3D(1.0 / norm, normal);
}
/** Reset the plane frame.
*/
private void setFrame() {
- origin = new Coordinates3D(-originOffset, w);
+ origin = new Cartesian3D(-originOffset, w);
u = w.orthogonal();
- v = Coordinates3D.crossProduct(w, u);
+ v = Cartesian3D.crossProduct(w, u);
}
/** Get the origin point of the plane frame.
@@ -172,7 +172,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @return the origin point of the plane frame (point closest to the
* 3D-space origin)
*/
- public Coordinates3D getOrigin() {
+ public Cartesian3D getOrigin() {
return origin;
}
@@ -184,7 +184,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @see #getU
* @see #getV
*/
- public Coordinates3D getNormal() {
+ public Cartesian3D getNormal() {
return w;
}
@@ -196,7 +196,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @see #getV
* @see #getNormal
*/
- public Coordinates3D getU() {
+ public Cartesian3D getU() {
return u;
}
@@ -208,7 +208,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @see #getU
* @see #getNormal
*/
- public Coordinates3D getV() {
+ public Cartesian3D getV() {
return v;
}
@@ -240,54 +240,67 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* reversed.</p>
*/
public void revertSelf() {
- final Coordinates3D tmp = u;
+ final Cartesian3D tmp = u;
u = v;
v = tmp;
w = w.negate();
originOffset = -originOffset;
}
- /** Transform a space point into a sub-space point.
- * @param vector n-dimension point of the space
- * @return (n-1)-dimension point of the sub-space corresponding to
- * the specified space point
+ /** Transform a space vector into a sub-space vector.
+ * @param vector n-dimension vector of the space
+ * @return (n-1)-dimension vector of the sub-space corresponding to
+ * the specified space vector
*/
-// public Coordinates2D toSubSpace(Vector<Euclidean3D> vector) {
-// return toSubSpace((Point<Euclidean3D>) vector);
-// }
+ public Cartesian2D toSubSpace(Vector<Euclidean3D> vector) {
+ return toSubSpace((Cartesian3D) vector);
+ }
/** Transform a sub-space point into a space point.
* @param vector (n-1)-dimension point of the sub-space
* @return n-dimension point of the space corresponding to the
* specified sub-space point
*/
-// public Coordinates3D toSpace(Vector<Euclidean2D> vector) {
-// return toSpace((Point<Euclidean2D>) vector);
-// }
+ public Cartesian3D toSpace(Vector<Euclidean2D> vector) {
+ return toSpace((Cartesian2D) vector);
+ }
/** Transform a 3D space point into an in-plane point.
- * @param point point of the space (must be a {@link Coordinates3D
- * Vector3D} instance)
- * @return in-plane point (really a {@link
- * org.apache.commons.math4.geometry.euclidean.twod.Coordinates2D Vector2D} instance)
+ * @param point point of the space (must be a {@link Cartesian3D} instance)
+ * @return in-plane point
* @see #toSpace
*/
@Override
- public Coordinates2D toSubSpace(final Point<Euclidean3D> point) {
- final Coordinates3D p3D = (Coordinates3D) point;
- return new Coordinates2D(p3D.dotProduct(u), p3D.dotProduct(v));
+ public Cartesian2D toSubSpace(final Point<Euclidean3D> point) {
+ return toSubSpace((Cartesian3D) point);
}
/** Transform an in-plane point into a 3D space point.
- * @param point in-plane point (must be a {@link
- * org.apache.commons.math4.geometry.euclidean.twod.Coordinates2D Vector2D} instance)
- * @return 3D space point (really a {@link Coordinates3D Vector3D} instance)
+ * @param point in-plane point (must be a {@link Cartesian2D} instance)
+ * @return 3D space point
* @see #toSubSpace
*/
@Override
- public Coordinates3D toSpace(final Point<Euclidean2D> point) {
- final Coordinates2D p2D = (Coordinates2D) point;
- return new Coordinates3D(p2D.getX(), u, p2D.getY(), v, -originOffset, w);
+ public Cartesian3D toSpace(final Point<Euclidean2D> point) {
+ return toSpace((Cartesian2D) point);
+ }
+
+ /** Transform a 3D space point into an in-plane point.
+ * @param point point of the space
+ * @return in-plane point
+ * @see #toSpace
+ */
+ public Cartesian2D toSubSpace(final Cartesian3D point) {
+ return new Cartesian2D(point.dotProduct(u), point.dotProduct(v));
+ }
+
+ /** Transform an in-plane point into a 3D space point.
+ * @param point in-plane point
+ * @return 3D space point
+ * @see #toSubSpace
+ */
+ public Cartesian3D toSpace(final Cartesian2D point) {
+ return new Cartesian3D(point.getX(), u, point.getY(), v, -originOffset, w);
}
/** Get one point from the 3D-space.
@@ -297,8 +310,8 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @return one point in the 3D-space, with given coordinates and offset
* relative to the plane
*/
- public Coordinates3D getPointAt(final Coordinates2D inPlane, final double offset) {
- return new Coordinates3D(inPlane.getX(), u, inPlane.getY(), v, offset - originOffset, w);
+ public Cartesian3D getPointAt(final Cartesian2D inPlane, final double offset) {
+ return new Cartesian3D(inPlane.getX(), u, inPlane.getY(), v, offset - originOffset, w);
}
/** Check if the instance is similar to another plane.
@@ -309,7 +322,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @return true if the planes are similar
*/
public boolean isSimilarTo(final Plane plane) {
- final double angle = Coordinates3D.angle(w, plane.w);
+ final double angle = Cartesian3D.angle(w, plane.w);
return ((angle < 1.0e-10) && (FastMath.abs(originOffset - plane.originOffset) < tolerance)) ||
((angle > (FastMath.PI - 1.0e-10)) && (FastMath.abs(originOffset + plane.originOffset) < tolerance));
}
@@ -320,9 +333,9 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @param rotation vectorial rotation operator
* @return a new plane
*/
- public Plane rotate(final Coordinates3D center, final Rotation rotation) {
+ public Plane rotate(final Cartesian3D center, final Rotation rotation) {
- final Coordinates3D delta = origin.subtract(center);
+ final Cartesian3D delta = origin.subtract(center);
final Plane plane = new Plane(center.add(rotation.applyTo(delta)),
rotation.applyTo(w), tolerance);
@@ -339,7 +352,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @param translation translation to apply
* @return a new plane
*/
- public Plane translate(final Coordinates3D translation) {
+ public Plane translate(final Cartesian3D translation) {
final Plane plane = new Plane(origin.add(translation), w, tolerance);
@@ -356,15 +369,15 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @return intersection point between between the line and the
* instance (null if the line is parallel to the instance)
*/
- public Coordinates3D intersection(final Line line) {
- final Coordinates3D direction = line.getDirection();
+ public Cartesian3D intersection(final Line line) {
+ final Cartesian3D direction = line.getDirection();
final double dot = w.dotProduct(direction);
if (FastMath.abs(dot) < 1.0e-10) {
return null;
}
- final Coordinates3D point = line.toSpace((Point<Euclidean1D>) Coordinates1D.ZERO);
+ final Cartesian3D point = line.toSpace(Cartesian1D.ZERO);
final double k = -(originOffset + w.dotProduct(point)) / dot;
- return new Coordinates3D(1.0, point, k, direction);
+ return new Cartesian3D(1.0, point, k, direction);
}
/** Build the line shared by the instance and another plane.
@@ -373,11 +386,11 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* other plane (really a {@link Line Line} instance)
*/
public Line intersection(final Plane other) {
- final Coordinates3D direction = Coordinates3D.crossProduct(w, other.w);
+ final Cartesian3D direction = Cartesian3D.crossProduct(w, other.w);
if (direction.getNorm() < tolerance) {
return null;
}
- final Coordinates3D point = intersection(this, other, new Plane(direction, tolerance));
+ final Cartesian3D point = intersection(this, other, new Plane(direction, tolerance));
return new Line(point, point.add(direction), tolerance);
}
@@ -387,7 +400,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @param plane3 third plane2
* @return intersection point of three planes, null if some planes are parallel
*/
- public static Coordinates3D intersection(final Plane plane1, final Plane plane2, final Plane plane3) {
+ public static Cartesian3D intersection(final Plane plane1, final Plane plane2, final Plane plane3) {
// coefficients of the three planes linear equations
final double a1 = plane1.w.getX();
@@ -416,7 +429,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
}
final double r = 1.0 / determinant;
- return new Coordinates3D(
+ return new Cartesian3D(
(-a23 * d1 - (c1 * b3 - c3 * b1) * d2 - (c2 * b1 - c1 * b2) * d3) * r,
(-b23 * d1 - (c3 * a1 - c1 * a3) * d2 - (c1 * a2 - c2 * a1) * d3) * r,
(-c23 * d1 - (b1 * a3 - b3 * a1) * d2 - (b2 * a1 - b1 * a2) * d3) * r);
@@ -444,7 +457,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
* @param p point to check
* @return true if p belongs to the plane
*/
- public boolean contains(final Coordinates3D p) {
+ public boolean contains(final Cartesian3D p) {
return FastMath.abs(getOffset(p)) < tolerance;
}
@@ -480,7 +493,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
*/
@Override
public double getOffset(final Point<Euclidean3D> point) {
- return ((Coordinates3D) point).dotProduct(w) + originOffset;
+ return ((Cartesian3D) point).dotProduct(w) + originOffset;
}
/** Check if the instance has the same orientation as another hyperplane.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e21d4d43/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java
index fcf26f5..cf15f22 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java
@@ -29,7 +29,7 @@ import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
import org.apache.commons.math4.geometry.euclidean.twod.PolygonsSet;
import org.apache.commons.math4.geometry.euclidean.twod.SubLine;
-import org.apache.commons.math4.geometry.euclidean.twod.Coordinates2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Cartesian2D;
import org.apache.commons.math4.geometry.partitioning.AbstractRegion;
import org.apache.commons.math4.geometry.partitioning.BSPTree;
import org.apache.commons.math4.geometry.partitioning.BSPTreeVisitor;
@@ -123,7 +123,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
* @exception MathIllegalArgumentException if some basic sanity checks fail
* @since 3.5
*/
- public PolyhedronsSet(final List<Coordinates3D> vertices, final List<int[]> facets,
+ public PolyhedronsSet(final List<Cartesian3D> vertices, final List<int[]> facets,
final double tolerance) {
super(buildBoundary(vertices, facets, tolerance), tolerance);
}
@@ -164,12 +164,12 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
// too thin box, build an empty polygons set
return new BSPTree<>(Boolean.FALSE);
}
- final Plane pxMin = new Plane(new Coordinates3D(xMin, 0, 0), Coordinates3D.MINUS_I, tolerance);
- final Plane pxMax = new Plane(new Coordinates3D(xMax, 0, 0), Coordinates3D.PLUS_I, tolerance);
- final Plane pyMin = new Plane(new Coordinates3D(0, yMin, 0), Coordinates3D.MINUS_J, tolerance);
- final Plane pyMax = new Plane(new Coordinates3D(0, yMax, 0), Coordinates3D.PLUS_J, tolerance);
- final Plane pzMin = new Plane(new Coordinates3D(0, 0, zMin), Coordinates3D.MINUS_K, tolerance);
- final Plane pzMax = new Plane(new Coordinates3D(0, 0, zMax), Coordinates3D.PLUS_K, tolerance);
+ final Plane pxMin = new Plane(new Cartesian3D(xMin, 0, 0), Cartesian3D.MINUS_I, tolerance);
+ final Plane pxMax = new Plane(new Cartesian3D(xMax, 0, 0), Cartesian3D.PLUS_I, tolerance);
+ final Plane pyMin = new Plane(new Cartesian3D(0, yMin, 0), Cartesian3D.MINUS_J, tolerance);
+ final Plane pyMax = new Plane(new Cartesian3D(0, yMax, 0), Cartesian3D.PLUS_J, tolerance);
+ final Plane pzMin = new Plane(new Cartesian3D(0, 0, zMin), Cartesian3D.MINUS_K, tolerance);
+ final Plane pzMax = new Plane(new Cartesian3D(0, 0, zMax), Cartesian3D.PLUS_K, tolerance);
final Region<Euclidean3D> boundary =
new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
return boundary.getTree(false);
@@ -183,15 +183,15 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
* @exception MathIllegalArgumentException if some basic sanity checks fail
* @since 3.5
*/
- private static List<SubHyperplane<Euclidean3D>> buildBoundary(final List<Coordinates3D> vertices,
+ private static List<SubHyperplane<Euclidean3D>> buildBoundary(final List<Cartesian3D> vertices,
final List<int[]> facets,
final double tolerance) {
// check vertices distances
for (int i = 0; i < vertices.size() - 1; ++i) {
- final Coordinates3D vi = vertices.get(i);
+ final Cartesian3D vi = vertices.get(i);
for (int j = i + 1; j < vertices.size(); ++j) {
- if (Coordinates3D.distance(vi, vertices.get(j)) <= tolerance) {
+ if (Cartesian3D.distance(vi, vertices.get(j)) <= tolerance) {
throw new MathIllegalArgumentException(LocalizedFormats.CLOSE_VERTICES,
vi.getX(), vi.getY(), vi.getZ());
}
@@ -216,8 +216,8 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
found = found || (v == vA);
}
if (!found) {
- final Coordinates3D start = vertices.get(vA);
- final Coordinates3D end = vertices.get(vB);
+ final Cartesian3D start = vertices.get(vA);
+ final Cartesian3D end = vertices.get(vB);
throw new MathIllegalArgumentException(LocalizedFormats.EDGE_CONNECTED_TO_ONE_FACET,
start.getX(), start.getY(), start.getZ(),
end.getX(), end.getY(), end.getZ());
@@ -235,9 +235,9 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
tolerance);
// check all points are in the plane
- final Coordinates2D[] two2Points = new Coordinates2D[facet.length];
+ final Cartesian2D[] two2Points = new Cartesian2D[facet.length];
for (int i = 0 ; i < facet.length; ++i) {
- final Coordinates3D v = vertices.get(facet[i]);
+ final Cartesian3D v = vertices.get(facet[i]);
if (!plane.contains(v)) {
throw new MathIllegalArgumentException(LocalizedFormats.OUT_OF_PLANE,
v.getX(), v.getY(), v.getZ());
@@ -261,7 +261,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
* @exception MathIllegalArgumentException if some facets have fewer than 3 vertices
* @since 3.5
*/
- private static int[][] findReferences(final List<Coordinates3D> vertices, final List<int[]> facets) {
+ private static int[][] findReferences(final List<Cartesian3D> vertices, final List<int[]> facets) {
// find the maximum number of facets a vertex belongs to
final int[] nbFacets = new int[vertices.size()];
@@ -306,7 +306,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
* once in the successors list (which means one facet orientation is wrong)
* @since 3.5
*/
- private static int[][] successors(final List<Coordinates3D> vertices, final List<int[]> facets,
+ private static int[][] successors(final List<Cartesian3D> vertices, final List<int[]> facets,
final int[][] references) {
// create an array large enough
@@ -329,8 +329,8 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
successors[v][k] = facet[(i + 1) % facet.length];
for (int l = 0; l < k; ++l) {
if (successors[v][l] == successors[v][k]) {
- final Coordinates3D start = vertices.get(v);
- final Coordinates3D end = vertices.get(successors[v][k]);
+ final Cartesian3D start = vertices.get(v);
+ final Cartesian3D end = vertices.get(successors[v][k]);
throw new MathIllegalArgumentException(LocalizedFormats.FACET_ORIENTATION_MISMATCH,
start.getX(), start.getY(), start.getZ(),
end.getX(), end.getY(), end.getZ());
@@ -361,11 +361,11 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
// the polyhedrons set as a finite outside
// surrounded by an infinite inside
setSize(Double.POSITIVE_INFINITY);
- setBarycenter((Point<Euclidean3D>) Coordinates3D.NaN);
+ setBarycenter((Point<Euclidean3D>) Cartesian3D.NaN);
} else {
// the polyhedrons set is finite, apply the remaining scaling factors
setSize(getSize() / 3.0);
- setBarycenter((Point<Euclidean3D>) new Coordinates3D(1.0 / (4 * getSize()), (Coordinates3D) getBarycenter()));
+ setBarycenter((Point<Euclidean3D>) new Cartesian3D(1.0 / (4 * getSize()), (Cartesian3D) getBarycenter()));
}
}
@@ -376,7 +376,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
/** Simple constructor. */
FacetsContributionVisitor() {
setSize(0);
- setBarycenter((Point<Euclidean3D>) new Coordinates3D(0, 0, 0));
+ setBarycenter((Point<Euclidean3D>) new Cartesian3D(0, 0, 0));
}
/** {@inheritDoc} */
@@ -415,18 +415,18 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
if (Double.isInfinite(area)) {
setSize(Double.POSITIVE_INFINITY);
- setBarycenter((Point<Euclidean3D>) Coordinates3D.NaN);
+ setBarycenter((Point<Euclidean3D>) Cartesian3D.NaN);
} else {
final Plane plane = (Plane) facet.getHyperplane();
- final Coordinates3D facetB = plane.toSpace(polygon.getBarycenter());
+ final Cartesian3D facetB = plane.toSpace(polygon.getBarycenter());
double scaled = area * facetB.dotProduct(plane.getNormal());
if (reversed) {
scaled = -scaled;
}
setSize(getSize() + scaled);
- setBarycenter((Point<Euclidean3D>) new Coordinates3D(1.0, (Coordinates3D) getBarycenter(), scaled, facetB));
+ setBarycenter((Point<Euclidean3D>) new Cartesian3D(1.0, (Cartesian3D) getBarycenter(), scaled, facetB));
}
@@ -441,7 +441,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
* given point, or null if the line does not intersect any
* sub-hyperplane
*/
- public SubHyperplane<Euclidean3D> firstIntersection(final Coordinates3D point, final Line line) {
+ public SubHyperplane<Euclidean3D> firstIntersection(final Cartesian3D point, final Line line) {
return recurseFirstIntersection(getTree(true), point, line);
}
@@ -454,7 +454,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
* sub-hyperplane
*/
private SubHyperplane<Euclidean3D> recurseFirstIntersection(final BSPTree<Euclidean3D> node,
- final Coordinates3D point,
+ final Cartesian3D point,
final Line line) {
final SubHyperplane<Euclidean3D> cut = node.getCut();
@@ -494,7 +494,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
if (!in) {
// search in the cut hyperplane
- final Coordinates3D hit3D = plane.intersection(line);
+ final Cartesian3D hit3D = plane.intersection(line);
if (hit3D != null && line.getAbscissa(hit3D) > line.getAbscissa(point)) {
final SubHyperplane<Euclidean3D> facet = boundaryFacet(hit3D, node);
if (facet != null) {
@@ -514,9 +514,9 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
* @return the boundary facet this points belongs to (or null if it
* does not belong to any boundary facet)
*/
- private SubHyperplane<Euclidean3D> boundaryFacet(final Coordinates3D point,
+ private SubHyperplane<Euclidean3D> boundaryFacet(final Cartesian3D point,
final BSPTree<Euclidean3D> node) {
- final Coordinates2D point2D = ((Plane) node.getCut().getHyperplane()).toSubSpace((Point<Euclidean3D>) point);
+ final Cartesian2D point2D = ((Plane) node.getCut().getHyperplane()).toSubSpace(point);
@SuppressWarnings("unchecked")
final BoundaryAttribute<Euclidean3D> attribute =
(BoundaryAttribute<Euclidean3D>) node.getAttribute();
@@ -537,7 +537,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
* @param rotation vectorial rotation operator
* @return a new instance representing the rotated region
*/
- public PolyhedronsSet rotate(final Coordinates3D center, final Rotation rotation) {
+ public PolyhedronsSet rotate(final Cartesian3D center, final Rotation rotation) {
return (PolyhedronsSet) applyTransform(new RotationTransform(center, rotation));
}
@@ -545,7 +545,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
private static class RotationTransform implements Transform<Euclidean3D, Euclidean2D> {
/** Center point of the rotation. */
- private final Coordinates3D center;
+ private final Cartesian3D center;
/** Vectorial rotation. */
private final Rotation rotation;
@@ -560,16 +560,16 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
* @param center center point of the rotation
* @param rotation vectorial rotation
*/
- RotationTransform(final Coordinates3D center, final Rotation rotation) {
+ RotationTransform(final Cartesian3D center, final Rotation rotation) {
this.center = center;
this.rotation = rotation;
}
/** {@inheritDoc} */
@Override
- public Coordinates3D apply(final Point<Euclidean3D> point) {
- final Coordinates3D delta = ((Coordinates3D) point).subtract(center);
- return new Coordinates3D(1.0, center, 1.0, rotation.applyTo(delta));
+ public Cartesian3D apply(final Point<Euclidean3D> point) {
+ final Cartesian3D delta = ((Cartesian3D) point).subtract(center);
+ return new Cartesian3D(1.0, center, 1.0, rotation.applyTo(delta));
}
/** {@inheritDoc} */
@@ -588,12 +588,12 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
final Plane oPlane = (Plane) original;
final Plane tPlane = (Plane) transformed;
- final Coordinates3D p00 = oPlane.getOrigin();
- final Coordinates3D p10 = oPlane.toSpace((Point<Euclidean2D>) new Coordinates2D(1.0, 0.0));
- final Coordinates3D p01 = oPlane.toSpace((Point<Euclidean2D>) new Coordinates2D(0.0, 1.0));
- final Coordinates2D tP00 = tPlane.toSubSpace((Point<Euclidean3D>) apply(p00));
- final Coordinates2D tP10 = tPlane.toSubSpace((Point<Euclidean3D>) apply(p10));
- final Coordinates2D tP01 = tPlane.toSubSpace((Point<Euclidean3D>) apply(p01));
+ final Cartesian3D p00 = oPlane.getOrigin();
+ final Cartesian3D p10 = oPlane.toSpace(new Cartesian2D(1.0, 0.0));
+ final Cartesian3D p01 = oPlane.toSpace(new Cartesian2D(0.0, 1.0));
+ final Cartesian2D tP00 = tPlane.toSubSpace(apply(p00));
+ final Cartesian2D tP10 = tPlane.toSubSpace(apply(p10));
+ final Cartesian2D tP01 = tPlane.toSubSpace(apply(p01));
cachedOriginal = (Plane) original;
cachedTransform =
@@ -615,7 +615,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
* @param translation translation to apply
* @return a new instance representing the translated region
*/
- public PolyhedronsSet translate(final Coordinates3D translation) {
+ public PolyhedronsSet translate(final Cartesian3D translation) {
return (PolyhedronsSet) applyTransform(new TranslationTransform(translation));
}
@@ -623,7 +623,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
private static class TranslationTransform implements Transform<Euclidean3D, Euclidean2D> {
/** Translation vector. */
- private final Coordinates3D translation;
+ private final Cartesian3D translation;
/** Cached original hyperplane. */
private Plane cachedOriginal;
@@ -634,14 +634,14 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
/** Build a translation transform.
* @param translation translation vector
*/
- TranslationTransform(final Coordinates3D translation) {
+ TranslationTransform(final Cartesian3D translation) {
this.translation = translation;
}
/** {@inheritDoc} */
@Override
- public Coordinates3D apply(final Point<Euclidean3D> point) {
- return new Coordinates3D(1.0, (Coordinates3D) point, 1.0, translation);
+ public Cartesian3D apply(final Point<Euclidean3D> point) {
+ return new Cartesian3D(1.0, (Cartesian3D) point, 1.0, translation);
}
/** {@inheritDoc} */
@@ -660,7 +660,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
final Plane oPlane = (Plane) original;
final Plane tPlane = (Plane) transformed;
- final Coordinates2D shift = tPlane.toSubSpace((Point<Euclidean3D>) apply(oPlane.getOrigin()));
+ final Cartesian2D shift = tPlane.toSubSpace(apply(oPlane.getOrigin()));
cachedOriginal = (Plane) original;
cachedTransform =