commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1557981 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math3/geometry/spherical/twod/ test/java/org/apache/commons/math3/geometry/spherical/twod/
Date Tue, 14 Jan 2014 08:55:41 GMT
Author: luc
Date: Tue Jan 14 08:55:40 2014
New Revision: 1557981

URL: http://svn.apache.org/r1557981
Log:
Don't advertise an assumption we may remove soon.

We will probably extend the circle class to also represent small circles
on the 2-sphere, not only great circles. This would introduce an
aperture angle that could be different from \pi/2. In this case, the
part of a circle inside another circle may exist or not (small circles
can be disjoint), and may have a length either shorter or longer than
\pi.

This change is not done yet, but could happen any time soon, even before
3.3 is out.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Circle.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Circle.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Circle.java?rev=1557981&r1=1557980&r2=1557981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Circle.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Circle.java
Tue Jan 14 08:55:40 2014
@@ -112,9 +112,9 @@ public class Circle implements Hyperplan
      * @param newPole circle pole
      */
     public void reset(final Vector3D newPole) {
-        this.pole   = newPole.normalize();
-        this.x      = newPole.orthogonal();
-        this.y      = Vector3D.crossProduct(newPole, x).normalize();
+        this.pole = newPole.normalize();
+        this.x    = newPole.orthogonal();
+        this.y    = Vector3D.crossProduct(newPole, x).normalize();
     }
 
     /** Revert the instance.
@@ -226,7 +226,6 @@ public class Circle implements Hyperplan
     /** Get the arc of the instance that lies inside the other circle.
      * @param other other circle
      * @return arc of the instance that lies inside the other circle
-     * (guaranteed to always have a length of \( \pi \))
      */
     public Arc getInsideArc(final Circle other) {
         final double alpha  = getPhase(other.pole);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.java?rev=1557981&r1=1557980&r2=1557981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.java
Tue Jan 14 08:55:40 2014
@@ -476,10 +476,10 @@ public class SphericalPolygonsSet extend
 
             // get the inside arc, synchronizing its phase with the edge itself
             final double edgeStart        = circle.getPhase(start.getLocation().getVector());
-            final double arcRelativeStart = MathUtils.normalizeAngle(circle.getInsideArc(splitCircle).getInf(),
-                                                                     edgeStart + FastMath.PI)
- edgeStart;
-            final double arcRelativeEnd   = arcRelativeStart + FastMath.PI;
-            final double unwrappedEnd     = arcRelativeStart - FastMath.PI;
+            final Arc    arc              = circle.getInsideArc(splitCircle);
+            final double arcRelativeStart = MathUtils.normalizeAngle(arc.getInf(), edgeStart
+ FastMath.PI) - edgeStart;
+            final double arcRelativeEnd   = arcRelativeStart + arc.getSize();
+            final double unwrappedEnd     = arcRelativeEnd - MathUtils.TWO_PI;
 
             // build the sub-edges
             final double tolerance = circle.getTolerance();

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java?rev=1557981&r1=1557980&r2=1557981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/spherical/twod/CircleTest.java
Tue Jan 14 08:55:40 2014
@@ -143,6 +143,7 @@ public class CircleTest {
 
     private void checkArcIsInside(final Circle arcCircle, final Circle otherCircle) {
         Arc arc = arcCircle.getInsideArc(otherCircle);
+        Assert.assertEquals(FastMath.PI, arc.getSize(), 1.0e-10);
         for (double alpha = arc.getInf(); alpha < arc.getSup(); alpha += 0.1) {
             Assert.assertTrue(otherCircle.getOffset(arcCircle.getPointAt(alpha)) <= 2.0e-15);
         }



Mime
View raw message