Commit in GeomConverter/src/org/lcsim/geometry/segmentation on MAIN
ProjectiveZPlane.java+12-131.19 -> 1.20
GL: arg validation use abs(z) rather than z

GeomConverter/src/org/lcsim/geometry/segmentation
ProjectiveZPlane.java 1.19 -> 1.20
diff -u -r1.19 -r1.20
--- ProjectiveZPlane.java	7 Feb 2006 17:10:55 -0000	1.19
+++ ProjectiveZPlane.java	15 Mar 2006 10:22:03 -0000	1.20
@@ -135,7 +135,7 @@
 
     /**
      * Return the cell which contains a given point (x,y,z), or zero.
-     * 
+     *
      * @param x,y,z
      *            cartesian coordinates of the point
      * @return ID of cell containing the point (maybe either in absorber or live
@@ -145,26 +145,21 @@
     {
 
         // validate point
-        if (z < getZMin())
-            return 0;
-        if (z > getZMax())
-            return 0;
+        if(Math.abs(z) < getZMin()) return 0;
+        if(Math.abs(z) > getZMax()) return 0;
         double rho = Math.sqrt(x * x + y * y);
-        if (rho < getRMin())
-            return 0;
-        if (rho > getRMax())
-            return 0;
+        if(rho < getRMin()) return 0;
+        if(rho > getRMax()) return 0;
 
         // ok, point is valid, so a valid ID should be returned
         int ilay = getLayerBin(rho);
 
         double phi = Math.atan2(y, x);
-        if (phi < 0)
-            phi += 2 * Math.PI;
+        if(phi < 0) phi += 2 * Math.PI;
         int iphi = (int) (phi / phiBins);
 
         double theta = Math.atan2(rho, z);
-        if (theta < 0)
+        if(theta < 0)
         {
             // If never prints out, the whole if can be dropped
             System.out.println("ProjCylinder: Is this really needed?!?");
@@ -183,7 +178,7 @@
 
     /**
      * Return the layer number based on the z-coordinate
-     * 
+     *
      * @param z
      *            z-coordinate
      * @return layer number of layer corresponding to that distance (may be
@@ -193,6 +188,10 @@
      */
     public int getLayerBin(double z)
     {
+        // validate point
+        if(Math.abs(z) < getZMin()) return -1;
+        if(Math.abs(z) > getZMax()) return -1;
+
         // In order to be general, we should not assume that all
         // layers have the same thickness. Therefore, one has to
         // guess the starting layer (based on average thickness), and
CVSspam 0.2.8