commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1157748 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/Line.java
Date Mon, 15 Aug 2011 09:32:33 GMT
Author: luc
Date: Mon Aug 15 09:32:32 2011
New Revision: 1157748

URL: http://svn.apache.org/viewvc?rev=1157748&view=rev
Log:
simplified signature of intersection method

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/Line.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/Line.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/Line.java?rev=1157748&r1=1157747&r2=1157748&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/Line.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/Line.java
Mon Aug 15 09:32:32 2011
@@ -104,7 +104,7 @@ public class Line implements Hyperplane<
     }
 
     /** Copy constructor.
-     * <p>The created instance is completely independant from the
+     * <p>The created instance is completely independent from the
      * original instance, it is a deep copy.</p>
      * @param line line to copy
      */
@@ -192,16 +192,15 @@ public class Line implements Hyperplane<
     /** Get the intersection point of the instance and another line.
      * @param other other line
      * @return intersection point of the instance and the other line
-     * (really a {@link Vector2D Vector2D} instance)
+     * or null if there are no intersection points
      */
-    public Vector2D intersection(final Hyperplane<Euclidean2D> other) {
-        final Line otherL = (Line) other;
-        final double d = sin * otherL.cos - otherL.sin * cos;
+    public Vector2D intersection(final Line other) {
+        final double d = sin * other.cos - other.sin * cos;
         if (FastMath.abs(d) < 1.0e-10) {
             return null;
         }
-        return new Vector2D((cos * otherL.originOffset - otherL.cos * originOffset) / d,
-                           (sin * otherL.originOffset - otherL.sin * originOffset) / d);
+        return new Vector2D((cos * other.originOffset - other.cos * originOffset) / d,
+                            (sin * other.originOffset - other.sin * originOffset) / d);
     }
 
     /** {@inheritDoc} */



Mime
View raw message