sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rlaid...@apache.org
Subject svn commit: r1358466 - /incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java
Date Fri, 06 Jul 2012 22:49:51 GMT
Author: rlaidlaw
Date: Fri Jul  6 22:49:50 2012
New Revision: 1358466

URL: http://svn.apache.org/viewvc?rev=1358466&view=rev
Log:
SIS-49: changed bearingIncrement from int to double, added check to prevent ArithmeticException
for divide by zero if numberOfPoints is zero

Modified:
    incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java

Modified: incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java?rev=1358466&r1=1358465&r2=1358466&view=diff
==============================================================================
--- incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java
(original)
+++ incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java
Fri Jul  6 22:49:50 2012
@@ -69,7 +69,10 @@ public class LatLonPointRadius {
     }
     // plus one to add closing point
     LatLon[] points = new LatLon[numberOfPoints + 1];
-    int bearingIncrement = 360/numberOfPoints;
+    
+    double bearingIncrement = 0;
+    if (numberOfPoints > 0) { bearingIncrement = 360/numberOfPoints; }
+
     for (int i = 0; i < numberOfPoints; i++) 
     {
       points[i] = DistanceUtils.getPointOnGreatCircle(this.center.getLat(),



Mime
View raw message