Author: allain.lalonde
Date: Wed Jul 15 10:48:37 2009
New Revision: 470

Modified:
     
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java

Log:
Replaced complex xor logic with Java's xor operator.

Modified:  
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java
==============================================================================
---  
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java    
 
(original)
+++  
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java    
 
Wed Jul 15 10:48:37 2009
@@ -227,29 +227,25 @@
              double maxY = getMaxY();
              double minY = getMinY();

-            if (!(bMaxX > maxX && bMinX < minX)) {
-                if (bMaxX > maxX || bMinX < minX) {
-                    double difMaxX = bMaxX - maxX;
-                    double difMinX = bMinX - minX;
-                    if (Math.abs(difMaxX) < Math.abs(difMinX)) {
-                        result.width = difMaxX;
-                    }
-                    else {
-                        result.width = difMinX;
-                    }
+            if ((bMaxX > maxX) ^ (bMinX < minX)) {
+                double difMaxX = bMaxX - maxX;
+                double difMinX = bMinX - minX;
+                if (Math.abs(difMaxX) < Math.abs(difMinX)) {
+                    result.width = difMaxX;
+                }
+                else {
+                    result.width = difMinX;
                  }
              }

-            if (!(bMaxY > maxY && bMinY < minY)) {
-                if (bMaxY > maxY || bMinY < minY) {
-                    double difMaxY = bMaxY - maxY;
-                    double difMinY = bMinY - minY;
-                    if (Math.abs(difMaxY) < Math.abs(difMinY)) {
-                        result.height = difMaxY;
-                    }
-                    else {
-                        result.height = difMinY;
-                    }
+            if ((bMaxY > maxY) ^ (bMinY < minY)) {
+                double difMaxY = bMaxY - maxY;
+                double difMinY = bMinY - minY;
+                if (Math.abs(difMaxY) < Math.abs(difMinY)) {
+                    result.height = difMaxY;
+                }
+                else {
+                    result.height = difMinY;
                  }
              }
          }

--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to