You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2012/09/02 16:22:53 UTC

svn commit: r1379977 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math3/geometry/ main/java/org/apache/commons/math3/geometry/euclidean/oned/ main/java/org/apache/commons/math3/geometry/euclidean/threed/ main/java/org/apache/common...

Author: luc
Date: Sun Sep  2 14:22:52 2012
New Revision: 1379977

URL: http://svn.apache.org/viewvc?rev=1379977&view=rev
Log:
Populate throws declarations for geometry package.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/Space.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/Vector.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1D.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1DFormat.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Line.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Plane.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSet.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Rotation.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormat.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DFormat.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PlaneTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormatAbstractTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/LineTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/Space.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/Space.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/Space.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/Space.java Sun Sep  2 14:22:52 2012
@@ -18,6 +18,8 @@ package org.apache.commons.math3.geometr
 
 import java.io.Serializable;
 
+import org.apache.commons.math3.exception.MathUnsupportedOperationException;
+
 /** This interface represents a generic space, with affine and vectorial counterparts.
  * @version $Id$
  * @see Vector
@@ -33,7 +35,9 @@ public interface Space extends Serializa
     /** Get the n-1 dimension subspace of this space.
      * @return n-1 dimension sub-space of this space
      * @see #getDimension()
+     * @exception MathUnsupportedOperationException for dimension-1 spaces
+     * which do not have sub-spaces
      */
-    Space getSubSpace();
+    Space getSubSpace() throws MathUnsupportedOperationException;
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/Vector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/Vector.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/Vector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/Vector.java Sun Sep  2 14:22:52 2012
@@ -19,6 +19,8 @@ package org.apache.commons.math3.geometr
 import java.io.Serializable;
 import java.text.NumberFormat;
 
+import org.apache.commons.math3.exception.MathArithmeticException;
+
 /** This interface represents a generic vector in a vectorial space or a point in an affine space.
  * @param <S> Type of the space.
  * @version $Id$
@@ -91,9 +93,9 @@ public interface Vector<S extends Space>
 
     /** Get a normalized vector aligned with the instance.
      * @return a new normalized vector
-     * @exception ArithmeticException if the norm is zero
+     * @exception MathArithmeticException if the norm is zero
      */
-    Vector<S> normalize();
+    Vector<S> normalize() throws MathArithmeticException;
 
     /** Multiply the instance by a scalar.
      * @param a scalar

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1D.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1D.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1D.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1D.java Sun Sep  2 14:22:52 2012
@@ -183,7 +183,7 @@ public class Vector1D implements Vector<
     }
 
     /** {@inheritDoc} */
-    public Vector1D normalize() {
+    public Vector1D normalize() throws MathArithmeticException {
         double s = getNorm();
         if (s == 0) {
             throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1DFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1DFormat.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1DFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1DFormat.java Sun Sep  2 14:22:52 2012
@@ -109,7 +109,7 @@ public class Vector1DFormat extends Vect
 
     /** {@inheritDoc} */
     @Override
-    public Vector1D parse(final String source) {
+    public Vector1D parse(final String source) throws MathParseException {
         ParsePosition parsePosition = new ParsePosition(0);
         Vector1D result = parse(source, parsePosition);
         if (parsePosition.getIndex() == 0) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Line.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Line.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Line.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Line.java Sun Sep  2 14:22:52 2012
@@ -16,7 +16,9 @@
  */
 package org.apache.commons.math3.geometry.euclidean.threed;
 
+import org.apache.commons.math3.exception.MathArithmeticException;
 import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math3.exception.MathInternalError;
 import org.apache.commons.math3.exception.util.LocalizedFormats;
 import org.apache.commons.math3.geometry.Vector;
 import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
@@ -51,7 +53,7 @@ public class Line implements Embedding<E
      * @param p2 second point belonging to the line (this can be any point, different from p1)
      * @exception MathIllegalArgumentException if the points are equal
      */
-    public Line(final Vector3D p1, final Vector3D p2) {
+    public Line(final Vector3D p1, final Vector3D p2) throws MathIllegalArgumentException {
         reset(p1, p2);
     }
 
@@ -70,7 +72,7 @@ public class Line implements Embedding<E
      * @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 Vector3D p1, final Vector3D p2) {
+    public void reset(final Vector3D p1, final Vector3D p2) throws MathIllegalArgumentException {
         final Vector3D delta = p2.subtract(p1);
         final double norm2 = delta.getNormSq();
         if (norm2 == 0.0) {
@@ -84,7 +86,12 @@ public class Line implements Embedding<E
      * @return a new instance, with reversed direction
      */
     public Line revert() {
-        return new Line(zero, zero.subtract(direction));
+        try {
+            return new Line(zero, zero.subtract(direction));
+        } catch (MathIllegalArgumentException miae) {
+            // this should never happen has the instance was already built without error
+            throw new MathInternalError(miae);
+        }
     }
 
     /** Get the normalized direction vector.
@@ -142,8 +149,13 @@ public class Line implements Embedding<E
      * @return true if the lines are similar
      */
     public boolean isSimilarTo(final Line line) {
-        final double angle = Vector3D.angle(direction, line.direction);
-        return ((angle < 1.0e-10) || (angle > (FastMath.PI - 1.0e-10))) && contains(line.zero);
+        try {
+            final double angle = Vector3D.angle(direction, line.direction);
+            return ((angle < 1.0e-10) || (angle > (FastMath.PI - 1.0e-10))) && contains(line.zero);
+        } catch (MathArithmeticException mae) {
+            // this should never happen as directions are non-zero vectors
+            throw new MathInternalError(mae);
+        }
     }
 
     /** Check if the instance contains a point.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Plane.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Plane.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Plane.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Plane.java Sun Sep  2 14:22:52 2012
@@ -17,12 +17,14 @@
 package org.apache.commons.math3.geometry.euclidean.threed;
 
 import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math3.exception.MathInternalError;
 import org.apache.commons.math3.exception.util.LocalizedFormats;
 import org.apache.commons.math3.geometry.Vector;
 import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
 import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
 import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
+import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
 import org.apache.commons.math3.geometry.partitioning.Embedding;
 import org.apache.commons.math3.geometry.partitioning.Hyperplane;
 import org.apache.commons.math3.util.FastMath;
@@ -52,7 +54,7 @@ public class Plane implements Hyperplane
      * @param normal normal direction to the plane
      * @exception MathArithmeticException if the normal norm is too small
      */
-    public Plane(final Vector3D normal) {
+    public Plane(final Vector3D normal) throws MathArithmeticException {
         setNormal(normal);
         originOffset = 0;
         setFrame();
@@ -63,7 +65,7 @@ public class Plane implements Hyperplane
      * @param normal normal direction to the plane
      * @exception MathArithmeticException if the normal norm is too small
      */
-    public Plane(final Vector3D p, final Vector3D normal) {
+    public Plane(final Vector3D p, final Vector3D normal) throws MathArithmeticException {
         setNormal(normal);
         originOffset = -p.dotProduct(w);
         setFrame();
@@ -77,7 +79,8 @@ public class Plane implements Hyperplane
      * @param p3 third point belonging to the plane
      * @exception MathArithmeticException if the points do not constitute a plane
      */
-    public Plane(final Vector3D p1, final Vector3D p2, final Vector3D p3) {
+    public Plane(final Vector3D p1, final Vector3D p2, final Vector3D p3)
+        throws MathArithmeticException {
         this(p1, p2.subtract(p1).crossProduct(p3.subtract(p1)));
     }
 
@@ -108,8 +111,9 @@ public class Plane implements Hyperplane
     /** Reset the instance as if built from a point and a normal.
      * @param p point belonging to the plane
      * @param normal normal direction to the plane
+     * @exception MathArithmeticException if the normal norm is too small
      */
-    public void reset(final Vector3D p, final Vector3D normal) {
+    public void reset(final Vector3D p, final Vector3D normal) throws MathArithmeticException {
         setNormal(normal);
         originOffset = -p.dotProduct(w);
         setFrame();
@@ -133,7 +137,7 @@ public class Plane implements Hyperplane
      * @param normal normal direction to the plane (will be copied)
      * @exception MathArithmeticException if the normal norm is too small
      */
-    private void setNormal(final Vector3D normal) {
+    private void setNormal(final Vector3D normal) throws MathArithmeticException {
         final double norm = normal.getNorm();
         if (norm < 1.0e-10) {
             throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
@@ -144,9 +148,14 @@ public class Plane implements Hyperplane
     /** Reset the plane frame.
      */
     private void setFrame() {
-        origin = new Vector3D(-originOffset, w);
-        u = w.orthogonal();
-        v = Vector3D.crossProduct(w, u);
+        try {
+            origin = new Vector3D(-originOffset, w);
+            u = w.orthogonal();
+            v = Vector3D.crossProduct(w, u);
+        } catch (MathArithmeticException mae) {
+            // this should never happen as w is built to be non-zero
+            throw new MathInternalError(mae);
+        }
     }
 
     /** Get the origin point of the plane frame.
@@ -255,9 +264,14 @@ public class Plane implements Hyperplane
      * @return true if the planes are similar
      */
     public boolean isSimilarTo(final Plane plane) {
-        final double angle = Vector3D.angle(w, plane.w);
-        return ((angle < 1.0e-10) && (FastMath.abs(originOffset - plane.originOffset) < 1.0e-10)) ||
-               ((angle > (FastMath.PI - 1.0e-10)) && (FastMath.abs(originOffset + plane.originOffset) < 1.0e-10));
+        try {
+            final double angle = Vector3D.angle(w, plane.w);
+            return ((angle < 1.0e-10) && (FastMath.abs(originOffset - plane.originOffset) < 1.0e-10)) ||
+                    ((angle > (FastMath.PI - 1.0e-10)) && (FastMath.abs(originOffset + plane.originOffset) < 1.0e-10));
+        } catch (MathArithmeticException mae) {
+            // this should never happen as w vectors are built to be non-zero
+            throw new MathInternalError(mae);
+        }
     }
 
     /** Rotate the plane around the specified point.
@@ -268,15 +282,20 @@ public class Plane implements Hyperplane
      */
     public Plane rotate(final Vector3D center, final Rotation rotation) {
 
-        final Vector3D delta = origin.subtract(center);
-        final Plane plane = new Plane(center.add(rotation.applyTo(delta)),
-                                rotation.applyTo(w));
-
-        // make sure the frame is transformed as desired
-        plane.u = rotation.applyTo(u);
-        plane.v = rotation.applyTo(v);
-
-        return plane;
+        try {
+            final Vector3D delta = origin.subtract(center);
+            final Plane plane = new Plane(center.add(rotation.applyTo(delta)),
+                                          rotation.applyTo(w));
+
+            // make sure the frame is transformed as desired
+            plane.u = rotation.applyTo(u);
+            plane.v = rotation.applyTo(v);
+
+            return plane;
+        } catch (MathArithmeticException mae) {
+            // this should never happen as w vector is built to be non-zero
+            throw new MathInternalError(mae);
+        }
 
     }
 
@@ -287,13 +306,18 @@ public class Plane implements Hyperplane
      */
     public Plane translate(final Vector3D translation) {
 
-        final Plane plane = new Plane(origin.add(translation), w);
-
-        // make sure the frame is transformed as desired
-        plane.u = u;
-        plane.v = v;
+        try {
+            final Plane plane = new Plane(origin.add(translation), w);
 
-        return plane;
+            // make sure the frame is transformed as desired
+            plane.u = u;
+            plane.v = v;
+
+            return plane;
+        } catch (MathArithmeticException mae) {
+            // this should never happen as w vector is built to be non-zero
+            throw new MathInternalError(mae);
+        }
 
     }
 
@@ -319,12 +343,20 @@ public class Plane implements Hyperplane
      * other plane (really a {@link Line Line} instance)
      */
     public Line intersection(final Plane other) {
-        final Vector3D direction = Vector3D.crossProduct(w, other.w);
-        if (direction.getNorm() < 1.0e-10) {
-            return null;
+        try {
+            final Vector3D direction = Vector3D.crossProduct(w, other.w);
+            if (direction.getNorm() < 1.0e-10) {
+                return null;
+            }
+            final Vector3D point = intersection(this, other, new Plane(direction));
+            return new Line(point, point.add(direction));
+        } catch (MathIllegalArgumentException miae) {
+            // this should never happen as direction has been checked to have non-zero norm
+            throw new MathInternalError(miae);
+        } catch (MathArithmeticException mae) {
+            // this should never happen as direction has been checked to have non-zero norm
+            throw new MathInternalError(mae);
         }
-        final Vector3D point = intersection(this, other, new Plane(direction));
-        return new Line(point, point.add(direction));
     }
 
     /** Get the intersection point of three planes.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSet.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSet.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSet.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSet.java Sun Sep  2 14:22:52 2012
@@ -19,6 +19,9 @@ package org.apache.commons.math3.geometr
 import java.awt.geom.AffineTransform;
 import java.util.Collection;
 
+import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math3.exception.MathInternalError;
 import org.apache.commons.math3.geometry.Vector;
 import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
 import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
@@ -91,17 +94,39 @@ public class PolyhedronsSet extends Abst
      * @param zMin low bound along the z direction
      * @param zMax high bound along the z direction
      */
-    @SuppressWarnings("unchecked")
     public PolyhedronsSet(final double xMin, final double xMax,
                           final double yMin, final double yMax,
                           final double zMin, final double zMax) {
-        this(new RegionFactory<Euclidean3D>().buildConvex(
-            new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I),
-            new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I),
-            new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J),
-            new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J),
-            new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K),
-            new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K)).getTree(false));
+        super(buildBoundary(xMin, xMax, yMin, yMax, zMin, zMax));
+    }
+
+    /** Build a parallellepipedic box boundary.
+     * @param xMin low bound along the x direction
+     * @param xMax high bound along the x direction
+     * @param yMin low bound along the y direction
+     * @param yMax high bound along the y direction
+     * @param zMin low bound along the z direction
+     * @param zMax high bound along the z direction
+     * @return boundary tree
+     */
+    private static BSPTree<Euclidean3D> buildBoundary(final double xMin, final double xMax,
+                                                      final double yMin, final double yMax,
+                                                      final double zMin, final double zMax) {
+        try {
+            final Plane pxMin = new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I);
+            final Plane pxMax = new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I);
+            final Plane pyMin = new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J);
+            final Plane pyMax = new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J);
+            final Plane pzMin = new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K);
+            final Plane pzMax = new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K);
+            @SuppressWarnings("unchecked")
+            final Region<Euclidean3D> boundary =
+                    new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
+            return boundary.getTree(false);
+        } catch (MathArithmeticException mae) {
+            // this should never happen as provided normals are all non-zero
+            throw new MathInternalError(mae);
+        }
     }
 
     /** {@inheritDoc} */
@@ -345,16 +370,21 @@ public class PolyhedronsSet extends Abst
                 final Vector3D p00    = oPlane.getOrigin();
                 final Vector3D p10    = oPlane.toSpace(new Vector2D(1.0, 0.0));
                 final Vector3D p01    = oPlane.toSpace(new Vector2D(0.0, 1.0));
-                final Vector2D  tP00   = tPlane.toSubSpace(apply(p00));
-                final Vector2D  tP10   = tPlane.toSubSpace(apply(p10));
-                final Vector2D  tP01   = tPlane.toSubSpace(apply(p01));
+                final Vector2D tP00   = tPlane.toSubSpace(apply(p00));
+                final Vector2D tP10   = tPlane.toSubSpace(apply(p10));
+                final Vector2D tP01   = tPlane.toSubSpace(apply(p01));
                 final AffineTransform at =
                     new AffineTransform(tP10.getX() - tP00.getX(), tP10.getY() - tP00.getY(),
                                         tP01.getX() - tP00.getX(), tP01.getY() - tP00.getY(),
                                         tP00.getX(), tP00.getY());
 
                 cachedOriginal  = (Plane) original;
-                cachedTransform = org.apache.commons.math3.geometry.euclidean.twod.Line.getTransform(at);
+                try {
+                    cachedTransform = org.apache.commons.math3.geometry.euclidean.twod.Line.getTransform(at);
+                } catch (MathIllegalArgumentException miae) {
+                    // this should never happen as the transform built on p00, p10, p01 is invertible
+                    throw new MathInternalError(miae);
+                }
 
             }
             return ((SubLine) sub).applyTransform(cachedTransform);
@@ -414,8 +444,13 @@ public class PolyhedronsSet extends Abst
                     AffineTransform.getTranslateInstance(shift.getX(), shift.getY());
 
                 cachedOriginal  = (Plane) original;
-                cachedTransform =
-                    org.apache.commons.math3.geometry.euclidean.twod.Line.getTransform(at);
+                try {
+                    cachedTransform =
+                            org.apache.commons.math3.geometry.euclidean.twod.Line.getTransform(at);
+                } catch (MathIllegalArgumentException miae) {
+                    // this should never happen as a translation is always invertible
+                    throw new MathInternalError(miae);
+                }
 
             }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Rotation.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Rotation.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Rotation.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Rotation.java Sun Sep  2 14:22:52 2012
@@ -19,7 +19,9 @@ package org.apache.commons.math3.geometr
 
 import java.io.Serializable;
 
+import org.apache.commons.math3.exception.MathArithmeticException;
 import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math3.exception.MathInternalError;
 import org.apache.commons.math3.exception.util.LocalizedFormats;
 import org.apache.commons.math3.util.FastMath;
 import org.apache.commons.math3.util.MathArrays;
@@ -171,7 +173,7 @@ public class Rotation implements Seriali
    * @param angle rotation angle.
    * @exception MathIllegalArgumentException if the axis norm is zero
    */
-  public Rotation(Vector3D axis, double angle) {
+  public Rotation(Vector3D axis, double angle) throws MathIllegalArgumentException {
 
     double norm = axis.getNorm();
     if (norm == 0) {
@@ -266,11 +268,11 @@ public class Rotation implements Seriali
    * @param u2 second vector of the origin pair
    * @param v1 desired image of u1 by the rotation
    * @param v2 desired image of u2 by the rotation
-   * @exception MathIllegalArgumentException if the norm of one of the vectors is zero,
+   * @exception MathArithmeticException if the norm of one of the vectors is zero,
    * or if one of the pair is degenerated (i.e. the vectors of the pair are colinear)
    */
   public Rotation(Vector3D u1, Vector3D u2, Vector3D v1, Vector3D v2)
-      throws MathIllegalArgumentException {
+      throws MathArithmeticException {
 
       // build orthonormalized base from u1, u2
       // this fails when vectors are null or colinear, which is forbidden to define a rotation
@@ -322,13 +324,13 @@ public class Rotation implements Seriali
 
    * @param u origin vector
    * @param v desired image of u by the rotation
-   * @exception MathIllegalArgumentException if the norm of one of the vectors is zero
+   * @exception MathArithmeticException if the norm of one of the vectors is zero
    */
-  public Rotation(Vector3D u, Vector3D v) {
+  public Rotation(Vector3D u, Vector3D v) throws MathArithmeticException {
 
     double normProduct = u.getNorm() * v.getNorm();
     if (normProduct == 0) {
-        throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR);
+        throw new MathArithmeticException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR);
     }
 
     double dot = u.dotProduct(v);
@@ -375,14 +377,20 @@ public class Rotation implements Seriali
    */
   public Rotation(RotationOrder order,
                   double alpha1, double alpha2, double alpha3) {
-    Rotation r1 = new Rotation(order.getA1(), alpha1);
-    Rotation r2 = new Rotation(order.getA2(), alpha2);
-    Rotation r3 = new Rotation(order.getA3(), alpha3);
-    Rotation composed = r1.applyTo(r2.applyTo(r3));
-    q0 = composed.q0;
-    q1 = composed.q1;
-    q2 = composed.q2;
-    q3 = composed.q3;
+      try {
+          Rotation r1 = new Rotation(order.getA1(), alpha1);
+          Rotation r2 = new Rotation(order.getA2(), alpha2);
+          Rotation r3 = new Rotation(order.getA3(), alpha3);
+          Rotation composed = r1.applyTo(r2.applyTo(r3));
+          q0 = composed.q0;
+          q1 = composed.q1;
+          q2 = composed.q2;
+          q3 = composed.q3;
+      } catch (MathIllegalArgumentException miae) {
+          // this should never happen as RotationOrder axes are all normalized,
+          // and hence never null
+          throw new MathInternalError(miae);
+      }
   }
 
   /** Convert an orthogonal rotation matrix to a quaternion.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java Sun Sep  2 14:22:52 2012
@@ -19,6 +19,7 @@ package org.apache.commons.math3.geometr
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.math3.exception.MathIllegalArgumentException;
 import org.apache.commons.math3.geometry.euclidean.oned.Interval;
 import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
 import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
@@ -48,15 +49,18 @@ public class SubLine {
     /** Create a sub-line from two endpoints.
      * @param start start point
      * @param end end point
+     * @exception MathIllegalArgumentException if the points are equal
      */
-    public SubLine(final Vector3D start, final Vector3D end) {
+    public SubLine(final Vector3D start, final Vector3D end)
+        throws MathIllegalArgumentException {
         this(new Line(start, end), buildIntervalSet(start, end));
     }
 
     /** Create a sub-line from a segment.
      * @param segment single segment forming the sub-line
+     * @exception MathIllegalArgumentException if the segment endpoints are equal
      */
-    public SubLine(final Segment segment) {
+    public SubLine(final Segment segment) throws MathIllegalArgumentException {
         this(segment.getLine(), buildIntervalSet(segment.getStart(), segment.getEnd()));
     }
 
@@ -126,8 +130,10 @@ public class SubLine {
      * @param start start point
      * @param end end point
      * @return an interval set
+     * @exception MathIllegalArgumentException if the points are equal
      */
-    private static IntervalsSet buildIntervalSet(final Vector3D start, final Vector3D end) {
+    private static IntervalsSet buildIntervalSet(final Vector3D start, final Vector3D end)
+        throws MathIllegalArgumentException {
         final Line line = new Line(start, end);
         return new IntervalsSet(line.toSubSpace(start).getX(),
                                 line.toSubSpace(end).getX());

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.java Sun Sep  2 14:22:52 2012
@@ -293,7 +293,7 @@ public class Vector3D implements Seriali
     }
 
     /** {@inheritDoc} */
-    public Vector3D normalize() {
+    public Vector3D normalize() throws MathArithmeticException {
         double s = getNorm();
         if (s == 0) {
             throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
@@ -316,7 +316,7 @@ public class Vector3D implements Seriali
      * @return a new normalized vector orthogonal to the instance
      * @exception MathArithmeticException if the norm of the instance is null
      */
-    public Vector3D orthogonal() {
+    public Vector3D orthogonal() throws MathArithmeticException {
 
         double threshold = 0.6 * getNorm();
         if (threshold == 0) {
@@ -346,7 +346,7 @@ public class Vector3D implements Seriali
      * @return angular separation between v1 and v2
      * @exception MathArithmeticException if either vector has a null norm
      */
-    public static double angle(Vector3D v1, Vector3D v2) {
+    public static double angle(Vector3D v1, Vector3D v2) throws MathArithmeticException {
 
         double normProduct = v1.getNorm() * v2.getNorm();
         if (normProduct == 0) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormat.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormat.java Sun Sep  2 14:22:52 2012
@@ -124,7 +124,7 @@ public class Vector3DFormat extends Vect
      * cannot be parsed.
      */
     @Override
-    public Vector3D parse(final String source) {
+    public Vector3D parse(final String source) throws MathParseException {
         ParsePosition parsePosition = new ParsePosition(0);
         Vector3D result = parse(source, parsePosition);
         if (parsePosition.getIndex() == 0) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.java Sun Sep  2 14:22:52 2012
@@ -221,7 +221,7 @@ public class Vector2D implements Vector<
     }
 
     /** {@inheritDoc} */
-    public Vector2D normalize() {
+    public Vector2D normalize() throws MathArithmeticException {
         double s = getNorm();
         if (s == 0) {
             throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DFormat.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DFormat.java Sun Sep  2 14:22:52 2012
@@ -112,7 +112,7 @@ public class Vector2DFormat extends Vect
 
     /** {@inheritDoc} */
     @Override
-    public Vector2D parse(final String source) {
+    public Vector2D parse(final String source) throws MathParseException {
         ParsePosition parsePosition = new ParsePosition(0);
         Vector2D result = parse(source, parsePosition);
         if (parsePosition.getIndex() == 0) {

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/LineTest.java Sun Sep  2 14:22:52 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.math3.geometry.euclidean.threed;
 
+import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math3.exception.MathIllegalArgumentException;
 import org.apache.commons.math3.geometry.euclidean.threed.Line;
 import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
 import org.apache.commons.math3.util.FastMath;
@@ -25,7 +27,7 @@ import org.junit.Test;
 public class LineTest {
 
     @Test
-    public void testContains() {
+    public void testContains() throws MathIllegalArgumentException, MathArithmeticException {
         Vector3D p1 = new Vector3D(0, 0, 1);
         Line l = new Line(p1, new Vector3D(0, 0, 2));
         Assert.assertTrue(l.contains(p1));
@@ -39,7 +41,7 @@ public class LineTest {
     }
 
     @Test
-    public void testSimilar() {
+    public void testSimilar() throws MathIllegalArgumentException, MathArithmeticException {
         Vector3D p1  = new Vector3D (1.2, 3.4, -5.8);
         Vector3D p2  = new Vector3D (3.4, -5.8, 1.2);
         Line     lA  = new Line(p1, p2);
@@ -49,14 +51,14 @@ public class LineTest {
     }
 
     @Test
-    public void testPointDistance() {
+    public void testPointDistance() throws MathIllegalArgumentException {
         Line l = new Line(new Vector3D(0, 1, 1), new Vector3D(0, 2, 2));
         Assert.assertEquals(FastMath.sqrt(3.0 / 2.0), l.distance(new Vector3D(1, 0, 1)), 1.0e-10);
         Assert.assertEquals(0, l.distance(new Vector3D(0, -4, -4)), 1.0e-10);
     }
 
     @Test
-    public void testLineDistance() {
+    public void testLineDistance() throws MathIllegalArgumentException {
         Line l = new Line(new Vector3D(0, 1, 1), new Vector3D(0, 2, 2));
         Assert.assertEquals(1.0,
                             l.distance(new Line(new Vector3D(1, 0, 1), new Vector3D(1, 0, 2))),
@@ -82,7 +84,7 @@ public class LineTest {
     }
 
     @Test
-    public void testClosest() {
+    public void testClosest() throws MathIllegalArgumentException {
         Line l = new Line(new Vector3D(0, 1, 1), new Vector3D(0, 2, 2));
         Assert.assertEquals(0.0,
                             l.closestPoint(new Line(new Vector3D(1, 0, 1), new Vector3D(1, 0, 2))).distance(new Vector3D(0, 0, 0)),
@@ -108,7 +110,7 @@ public class LineTest {
     }
 
     @Test
-    public void testIntersection() {
+    public void testIntersection() throws MathIllegalArgumentException {
         Line l = new Line(new Vector3D(0, 1, 1), new Vector3D(0, 2, 2));
         Assert.assertNull(l.intersection(new Line(new Vector3D(1, 0, 1), new Vector3D(1, 0, 2))));
         Assert.assertNull(l.intersection(new Line(new Vector3D(-0.5, 0, 0), new Vector3D(-0.5, -1, -1))));

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PlaneTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PlaneTest.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PlaneTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PlaneTest.java Sun Sep  2 14:22:52 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.math3.geometry.euclidean.threed;
 
+import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math3.exception.MathIllegalArgumentException;
 import org.apache.commons.math3.geometry.euclidean.threed.Line;
 import org.apache.commons.math3.geometry.euclidean.threed.Plane;
 import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
@@ -26,7 +28,7 @@ import org.junit.Test;
 public class PlaneTest {
 
     @Test
-    public void testContains() {
+    public void testContains() throws MathArithmeticException {
         Plane p = new Plane(new Vector3D(0, 0, 1), new Vector3D(0, 0, 1));
         Assert.assertTrue(p.contains(new Vector3D(0, 0, 1)));
         Assert.assertTrue(p.contains(new Vector3D(17, -32, 1)));
@@ -34,7 +36,7 @@ public class PlaneTest {
     }
 
     @Test
-    public void testOffset() {
+    public void testOffset() throws MathArithmeticException {
         Vector3D p1 = new Vector3D(1, 1, 1);
         Plane p = new Plane(p1, new Vector3D(0.2, 0, 0));
         Assert.assertEquals(-5.0, p.getOffset(new Vector3D(-4, 0, 0)), 1.0e-10);
@@ -48,13 +50,13 @@ public class PlaneTest {
     }
 
     @Test
-    public void testPoint() {
+    public void testPoint() throws MathArithmeticException {
         Plane p = new Plane(new Vector3D(2, -3, 1), new Vector3D(1, 4, 9));
         Assert.assertTrue(p.contains(p.getOrigin()));
     }
 
     @Test
-    public void testThreePoints() {
+    public void testThreePoints() throws MathArithmeticException {
         Vector3D p1 = new Vector3D(1.2, 3.4, -5.8);
         Vector3D p2 = new Vector3D(3.4, -5.8, 1.2);
         Vector3D p3 = new Vector3D(-2.0, 4.3, 0.7);
@@ -65,7 +67,7 @@ public class PlaneTest {
     }
 
     @Test
-    public void testRotate() {
+    public void testRotate() throws MathArithmeticException, MathIllegalArgumentException {
         Vector3D p1 = new Vector3D(1.2, 3.4, -5.8);
         Vector3D p2 = new Vector3D(3.4, -5.8, 1.2);
         Vector3D p3 = new Vector3D(-2.0, 4.3, 0.7);
@@ -90,7 +92,7 @@ public class PlaneTest {
     }
 
     @Test
-    public void testTranslate() {
+    public void testTranslate() throws MathArithmeticException {
         Vector3D p1 = new Vector3D(1.2, 3.4, -5.8);
         Vector3D p2 = new Vector3D(3.4, -5.8, 1.2);
         Vector3D p3 = new Vector3D(-2.0, 4.3, 0.7);
@@ -114,7 +116,7 @@ public class PlaneTest {
     }
 
     @Test
-    public void testIntersection() {
+    public void testIntersection() throws MathArithmeticException, MathIllegalArgumentException {
         Plane p = new Plane(new Vector3D(1, 2, 3), new Vector3D(-4, 1, -5));
         Line  l = new Line(new Vector3D(0.2, -3.5, 0.7), new Vector3D(1.2, -2.5, -0.3));
         Vector3D point = p.intersection(l);
@@ -125,7 +127,7 @@ public class PlaneTest {
     }
 
     @Test
-    public void testIntersection2() {
+    public void testIntersection2() throws MathArithmeticException {
         Vector3D p1  = new Vector3D (1.2, 3.4, -5.8);
         Vector3D p2  = new Vector3D (3.4, -5.8, 1.2);
         Plane    pA  = new Plane(p1, p2, new Vector3D (-2.0, 4.3, 0.7));
@@ -137,7 +139,7 @@ public class PlaneTest {
     }
 
     @Test
-    public void testIntersection3() {
+    public void testIntersection3() throws MathArithmeticException {
         Vector3D reference = new Vector3D (1.2, 3.4, -5.8);
         Plane p1 = new Plane(reference, new Vector3D(1, 3, 3));
         Plane p2 = new Plane(reference, new Vector3D(-2, 4, 0));
@@ -149,7 +151,7 @@ public class PlaneTest {
     }
 
     @Test
-    public void testSimilar() {
+    public void testSimilar() throws MathArithmeticException {
         Vector3D p1  = new Vector3D (1.2, 3.4, -5.8);
         Vector3D p2  = new Vector3D (3.4, -5.8, 1.2);
         Vector3D p3  = new Vector3D (-2.0, 4.3, 0.7);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSetTest.java Sun Sep  2 14:22:52 2012
@@ -18,6 +18,8 @@ package org.apache.commons.math3.geometr
 
 import java.util.ArrayList;
 
+import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math3.exception.MathIllegalArgumentException;
 import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
 import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
 import org.apache.commons.math3.geometry.euclidean.twod.SubLine;
@@ -74,7 +76,7 @@ public class PolyhedronsSetTest {
     }
 
     @Test
-    public void testTetrahedron() {
+    public void testTetrahedron() throws MathArithmeticException {
         Vector3D vertex1 = new Vector3D(1, 2, 3);
         Vector3D vertex2 = new Vector3D(2, 2, 4);
         Vector3D vertex3 = new Vector3D(2, 3, 3);
@@ -109,7 +111,7 @@ public class PolyhedronsSetTest {
     }
 
     @Test
-    public void testIsometry() {
+    public void testIsometry() throws MathArithmeticException, MathIllegalArgumentException {
         Vector3D vertex1 = new Vector3D(1.1, 2.2, 3.3);
         Vector3D vertex2 = new Vector3D(2.0, 2.4, 4.2);
         Vector3D vertex3 = new Vector3D(2.8, 3.3, 3.7);
@@ -234,7 +236,7 @@ public class PolyhedronsSetTest {
     }
 
     @Test
-    public void testIssue780() {
+    public void testIssue780() throws MathArithmeticException {
         float[] coords = {
             1.000000f, -1.000000f, -1.000000f, 
             1.000000f, -1.000000f, 1.000000f, 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/RotationTest.java Sun Sep  2 14:22:52 2012
@@ -51,7 +51,7 @@ public class RotationTest {
   }
 
   @Test
-  public void testAxisAngle() {
+  public void testAxisAngle() throws MathIllegalArgumentException {
 
     Rotation r = new Rotation(new Vector3D(10, 10, 10), 2 * FastMath.PI / 3);
     checkVector(r.applyTo(Vector3D.PLUS_I), Vector3D.PLUS_J);
@@ -90,7 +90,7 @@ public class RotationTest {
   }
 
   @Test
-  public void testVectorOnePair() {
+  public void testVectorOnePair() throws MathArithmeticException {
 
     Vector3D u = new Vector3D(3, 2, 1);
     Vector3D v = new Vector3D(-4, 2, 2);
@@ -102,14 +102,14 @@ public class RotationTest {
     try {
         new Rotation(u, Vector3D.ZERO);
         Assert.fail("an exception should have been thrown");
-    } catch (IllegalArgumentException e) {
+    } catch (MathArithmeticException e) {
         // expected behavior
     }
 
   }
 
   @Test
-  public void testVectorTwoPairs() {
+  public void testVectorTwoPairs() throws MathArithmeticException {
 
     Vector3D u1 = new Vector3D(3, 0, 0);
     Vector3D u2 = new Vector3D(0, 5, 0);
@@ -382,7 +382,7 @@ public class RotationTest {
   }
 
   @Test
-  public void testQuaternion() {
+  public void testQuaternion() throws MathIllegalArgumentException {
 
     Rotation r1 = new Rotation(new Vector3D(2, -3, 5), 1.7);
     double n = 23.5;
@@ -404,7 +404,7 @@ public class RotationTest {
   }
 
   @Test
-  public void testCompose() {
+  public void testCompose() throws MathIllegalArgumentException {
 
     Rotation r1 = new Rotation(new Vector3D(2, -3, 5), 1.7);
     Rotation r2 = new Rotation(new Vector3D(-1, 3, 2), 0.3);
@@ -422,7 +422,7 @@ public class RotationTest {
   }
 
   @Test
-  public void testComposeInverse() {
+  public void testComposeInverse() throws MathIllegalArgumentException {
 
     Rotation r1 = new Rotation(new Vector3D(2, -3, 5), 1.7);
     Rotation r2 = new Rotation(new Vector3D(-1, 3, 2), 0.3);
@@ -440,7 +440,7 @@ public class RotationTest {
   }
 
   @Test
-  public void testArray() {
+  public void testArray() throws MathIllegalArgumentException {
 
       Rotation r = new Rotation(new Vector3D(2, -3, 5), 1.7);
 
@@ -465,7 +465,7 @@ public class RotationTest {
   }
 
   @Test
-  public void testApplyInverseTo() {
+  public void testApplyInverseTo() throws MathIllegalArgumentException {
 
     Rotation r = new Rotation(new Vector3D(2, -3, 5), 1.7);
     for (double lambda = 0; lambda < 6.2; lambda += 0.2) {
@@ -504,7 +504,7 @@ public class RotationTest {
   }
 
   @Test
-  public void testIssue639(){
+  public void testIssue639() throws MathArithmeticException{
       Vector3D u1 = new Vector3D(-1321008684645961.0 /  268435456.0,
                                  -5774608829631843.0 /  268435456.0,
                                  -3822921525525679.0 / 4294967296.0);
@@ -519,7 +519,7 @@ public class RotationTest {
   }
 
   @Test
-  public void testIssue801() {
+  public void testIssue801() throws MathArithmeticException {
       Vector3D u1 = new Vector3D(0.9999988431610581, -0.0015210774290851095, 0.0);
       Vector3D u2 = new Vector3D(0.0, 0.0, 1.0);
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/SubLineTest.java Sun Sep  2 14:22:52 2012
@@ -18,6 +18,7 @@ package org.apache.commons.math3.geometr
 
 import java.util.List;
 
+import org.apache.commons.math3.exception.MathIllegalArgumentException;
 import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
 import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
 import org.apache.commons.math3.geometry.partitioning.RegionFactory;
@@ -27,7 +28,7 @@ import org.junit.Test;
 public class SubLineTest {
 
     @Test
-    public void testEndPoints() {
+    public void testEndPoints() throws MathIllegalArgumentException {
         Vector3D p1 = new Vector3D(-1, -7, 2);
         Vector3D p2 = new Vector3D(7, -1, 0);
         Segment segment = new Segment(p1, p2, new Line(p1, p2));
@@ -39,7 +40,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testNoEndPoints() {
+    public void testNoEndPoints() throws MathIllegalArgumentException {
         SubLine wholeLine = new Line(new Vector3D(-1, 7, 2), new Vector3D(7, 1, 0)).wholeLine();
         List<Segment> segments = wholeLine.getSegments();
         Assert.assertEquals(1, segments.size());
@@ -58,7 +59,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testNoSegments() {
+    public void testNoSegments() throws MathIllegalArgumentException {
         SubLine empty = new SubLine(new Line(new Vector3D(-1, -7, 2), new Vector3D(7, -1, 0)),
                                     (IntervalsSet) new RegionFactory<Euclidean1D>().getComplement(new IntervalsSet()));
         List<Segment> segments = empty.getSegments();
@@ -66,7 +67,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testSeveralSegments() {
+    public void testSeveralSegments() throws MathIllegalArgumentException {
         SubLine twoSubs = new SubLine(new Line(new Vector3D(-1, -7, 2), new Vector3D(7, -1, 0)),
                                       (IntervalsSet) new RegionFactory<Euclidean1D>().union(new IntervalsSet(1, 2),
                                                                                             new IntervalsSet(3, 4)));
@@ -75,7 +76,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testHalfInfiniteNeg() {
+    public void testHalfInfiniteNeg() throws MathIllegalArgumentException {
         SubLine empty = new SubLine(new Line(new Vector3D(-1, -7, 2), new Vector3D(7, -1, -2)),
                                     new IntervalsSet(Double.NEGATIVE_INFINITY, 0.0));
         List<Segment> segments = empty.getSegments();
@@ -90,7 +91,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testHalfInfinitePos() {
+    public void testHalfInfinitePos() throws MathIllegalArgumentException {
         SubLine empty = new SubLine(new Line(new Vector3D(-1, -7, 2), new Vector3D(7, -1, -2)),
                                     new IntervalsSet(0.0, Double.POSITIVE_INFINITY));
         List<Segment> segments = empty.getSegments();
@@ -105,7 +106,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testIntersectionInsideInside() {
+    public void testIntersectionInsideInside() throws MathIllegalArgumentException {
         SubLine sub1 = new SubLine(new Vector3D(1, 1, 1), new Vector3D(3, 1, 1));
         SubLine sub2 = new SubLine(new Vector3D(2, 0, 0), new Vector3D(2, 2, 2));
         Assert.assertEquals(0.0, new Vector3D(2, 1, 1).distance(sub1.intersection(sub2, true)),  1.0e-12);
@@ -113,7 +114,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testIntersectionInsideBoundary() {
+    public void testIntersectionInsideBoundary() throws MathIllegalArgumentException {
         SubLine sub1 = new SubLine(new Vector3D(1, 1, 1), new Vector3D(3, 1, 1));
         SubLine sub2 = new SubLine(new Vector3D(2, 0, 0), new Vector3D(2, 1, 1));
         Assert.assertEquals(0.0, new Vector3D(2, 1, 1).distance(sub1.intersection(sub2, true)),  1.0e-12);
@@ -121,7 +122,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testIntersectionInsideOutside() {
+    public void testIntersectionInsideOutside() throws MathIllegalArgumentException {
         SubLine sub1 = new SubLine(new Vector3D(1, 1, 1), new Vector3D(3, 1, 1));
         SubLine sub2 = new SubLine(new Vector3D(2, 0, 0), new Vector3D(2, 0.5, 0.5));
         Assert.assertNull(sub1.intersection(sub2, true));
@@ -129,7 +130,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testIntersectionBoundaryBoundary() {
+    public void testIntersectionBoundaryBoundary() throws MathIllegalArgumentException {
         SubLine sub1 = new SubLine(new Vector3D(1, 1, 1), new Vector3D(2, 1, 1));
         SubLine sub2 = new SubLine(new Vector3D(2, 0, 0), new Vector3D(2, 1, 1));
         Assert.assertEquals(0.0, new Vector3D(2, 1, 1).distance(sub1.intersection(sub2, true)),  1.0e-12);
@@ -137,7 +138,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testIntersectionBoundaryOutside() {
+    public void testIntersectionBoundaryOutside() throws MathIllegalArgumentException {
         SubLine sub1 = new SubLine(new Vector3D(1, 1, 1), new Vector3D(2, 1, 1));
         SubLine sub2 = new SubLine(new Vector3D(2, 0, 0), new Vector3D(2, 0.5, 0.5));
         Assert.assertNull(sub1.intersection(sub2, true));
@@ -145,7 +146,7 @@ public class SubLineTest {
     }
 
     @Test
-    public void testIntersectionOutsideOutside() {
+    public void testIntersectionOutsideOutside() throws MathIllegalArgumentException {
         SubLine sub1 = new SubLine(new Vector3D(1, 1, 1), new Vector3D(1.5, 1, 1));
         SubLine sub2 = new SubLine(new Vector3D(2, 0, 0), new Vector3D(2, 0.5, 0.5));
         Assert.assertNull(sub1.intersection(sub2, true));

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormatAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormatAbstractTest.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormatAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormatAbstractTest.java Sun Sep  2 14:22:52 2012
@@ -21,6 +21,7 @@ import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
+import org.apache.commons.math3.exception.MathParseException;
 import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
 import org.apache.commons.math3.geometry.euclidean.threed.Vector3DFormat;
 import org.junit.Test;
@@ -160,7 +161,7 @@ public abstract class Vector3DFormatAbst
     }
 
     @Test
-    public void testParseSimpleNoDecimals() {
+    public void testParseSimpleNoDecimals() throws MathParseException {
         String source = "{1; 1; 1}";
         Vector3D expected = new Vector3D(1, 1, 1);
         Vector3D actual = vector3DFormat.parse(source);
@@ -181,7 +182,7 @@ public abstract class Vector3DFormatAbst
     }
 
     @Test
-    public void testParseSimpleWithDecimals() {
+    public void testParseSimpleWithDecimals() throws MathParseException {
         String source =
             "{1" + getDecimalCharacter() +
             "23; 1" + getDecimalCharacter() +
@@ -193,7 +194,7 @@ public abstract class Vector3DFormatAbst
     }
 
     @Test
-    public void testParseSimpleWithDecimalsTrunc() {
+    public void testParseSimpleWithDecimalsTrunc() throws MathParseException {
         String source =
             "{1" + getDecimalCharacter() +
             "2323; 1" + getDecimalCharacter() +
@@ -205,7 +206,7 @@ public abstract class Vector3DFormatAbst
     }
 
     @Test
-    public void testParseNegativeX() {
+    public void testParseNegativeX() throws MathParseException {
         String source =
             "{-1" + getDecimalCharacter() +
             "2323; 1" + getDecimalCharacter() +
@@ -217,7 +218,7 @@ public abstract class Vector3DFormatAbst
     }
 
     @Test
-    public void testParseNegativeY() {
+    public void testParseNegativeY() throws MathParseException {
         String source =
             "{1" + getDecimalCharacter() +
             "2323; -1" + getDecimalCharacter() +
@@ -229,7 +230,7 @@ public abstract class Vector3DFormatAbst
     }
 
     @Test
-    public void testParseNegativeZ() {
+    public void testParseNegativeZ() throws MathParseException {
         String source =
             "{1" + getDecimalCharacter() +
             "2323; 1" + getDecimalCharacter() +
@@ -241,7 +242,7 @@ public abstract class Vector3DFormatAbst
     }
 
     @Test
-    public void testParseNegativeAll() {
+    public void testParseNegativeAll() throws MathParseException {
         String source =
             "{-1" + getDecimalCharacter() +
             "2323; -1" + getDecimalCharacter() +
@@ -253,7 +254,7 @@ public abstract class Vector3DFormatAbst
     }
 
     @Test
-    public void testParseZeroX() {
+    public void testParseZeroX() throws MathParseException {
         String source =
             "{0" + getDecimalCharacter() +
             "0; -1" + getDecimalCharacter() +
@@ -265,7 +266,7 @@ public abstract class Vector3DFormatAbst
     }
 
     @Test
-    public void testParseNonDefaultSetting() {
+    public void testParseNonDefaultSetting() throws MathParseException {
         String source =
             "[1" + getDecimalCharacter() +
             "2323 : 1" + getDecimalCharacter() +
@@ -277,21 +278,21 @@ public abstract class Vector3DFormatAbst
     }
 
     @Test
-    public void testParseNan() {
+    public void testParseNan() throws MathParseException {
         String source = "{(NaN); (NaN); (NaN)}";
         Vector3D actual = vector3DFormat.parse(source);
         Assert.assertEquals(Vector3D.NaN, actual);
     }
 
     @Test
-    public void testParsePositiveInfinity() {
+    public void testParsePositiveInfinity() throws MathParseException {
         String source = "{(Infinity); (Infinity); (Infinity)}";
         Vector3D actual = vector3DFormat.parse(source);
         Assert.assertEquals(Vector3D.POSITIVE_INFINITY, actual);
     }
 
     @Test
-    public void testParseNegativeInfinity() {
+    public void testParseNegativeInfinity() throws MathParseException {
         String source = "{(-Infinity); (-Infinity); (-Infinity)}";
         Vector3D actual = vector3DFormat.parse(source);
         Assert.assertEquals(Vector3D.NEGATIVE_INFINITY, actual);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DTest.java Sun Sep  2 14:22:52 2012
@@ -26,7 +26,7 @@ import org.junit.Test;
 
 public class Vector3DTest {
     @Test
-    public void testConstructors() {
+    public void testConstructors() throws DimensionMismatchException {
         double r = FastMath.sqrt(2) /2;
         checkVector(new Vector3D(2, new Vector3D(FastMath.PI / 3, -FastMath.PI / 4)),
                     r, r * FastMath.sqrt(3), -2 * r);
@@ -47,7 +47,7 @@ public class Vector3DTest {
     }
 
     @Test(expected=DimensionMismatchException.class)
-    public void testWrongDimension() {
+    public void testWrongDimension() throws DimensionMismatchException {
         new Vector3D(new double[] { 2,  5 });
     }
 
@@ -191,7 +191,7 @@ public class Vector3DTest {
     }
 
     @Test
-    public void testAngularSeparation() {
+    public void testAngularSeparation() throws MathArithmeticException {
         Vector3D v1 = new Vector3D(2, -1, 4);
 
         Vector3D  k = v1.normalize();
@@ -202,7 +202,7 @@ public class Vector3DTest {
   }
 
     @Test
-    public void testNormalize() {
+    public void testNormalize() throws MathArithmeticException {
         Assert.assertEquals(1.0, new Vector3D(5, -4, 2).normalize().getNorm(), 1.0e-12);
         try {
             Vector3D.ZERO.normalize();
@@ -213,7 +213,7 @@ public class Vector3DTest {
     }
 
     @Test
-    public void testOrthogonal() {
+    public void testOrthogonal() throws MathArithmeticException {
         Vector3D v1 = new Vector3D(0.1, 2.5, 1.3);
         Assert.assertEquals(0.0, Vector3D.dotProduct(v1, v1.orthogonal()), 1.0e-12);
         Vector3D v2 = new Vector3D(2.3, -0.003, 7.6);
@@ -229,7 +229,7 @@ public class Vector3DTest {
     }
 
     @Test
-    public void testAngle() {
+    public void testAngle() throws MathArithmeticException {
         Assert.assertEquals(0.22572612855273393616,
                             Vector3D.angle(new Vector3D(1, 2, 3), new Vector3D(4, 5, 6)),
                             1.0e-12);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/LineTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/LineTest.java?rev=1379977&r1=1379976&r2=1379977&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/LineTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/geometry/euclidean/twod/LineTest.java Sun Sep  2 14:22:52 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.math3.geometry.euclidean.twod;
 
+import org.apache.commons.math3.exception.MathIllegalArgumentException;
 import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
 import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
 import org.apache.commons.math3.geometry.euclidean.twod.Line;
@@ -98,7 +99,7 @@ public class LineTest {
     }
 
     @Test
-    public void testTransform() {
+    public void testTransform() throws MathIllegalArgumentException {
 
         Line l1 = new Line(new Vector2D(1.0 ,1.0), new Vector2D(4.0 ,1.0));
         Transform<Euclidean2D, Euclidean1D> t1 =