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.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1557981 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2014-01-14 08:55:40 +00:00
parent ac7733fd69
commit 692142457a
3 changed files with 8 additions and 8 deletions

View File

@ -112,9 +112,9 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
* @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 Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
/** 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);

View File

@ -476,10 +476,10 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
// 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();

View File

@ -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);
}