BoxBounds.java

Go to the documentation of this file.
00001 package theba.core;
00002 
00008 public class BoxBounds {
00009         public int xmin, ymin, zmin;
00010 
00011         public int xmax, ymax, zmax;
00012 
00013         public BoxBounds() {
00014                 super();
00015                 this.zmax = Short.MIN_VALUE;
00016                 this.ymax = Short.MIN_VALUE;
00017                 this.xmax = Short.MIN_VALUE;
00018                 this.xmin = Short.MAX_VALUE;
00019                 this.ymin = Short.MAX_VALUE;
00020                 this.zmin = Short.MAX_VALUE;
00021         }
00022 
00023         public void update(int x, int y, int z) {
00024                 if (x > xmax)
00025                         xmax = x;
00026                 if (x < xmin)
00027                         xmin = x;
00028 
00029                 if (y > ymax)
00030                         ymax = y;
00031                 if (y < ymin)
00032                         ymin = y;
00033 
00034                 if (z > zmax)
00035                         zmax = z;
00036                 if (z < zmin)
00037                         zmin = z;
00038         }
00039 
00040         public int getStartX() {
00041                 return xmin;
00042         }
00043 
00044         public int getStartY() {
00045                 return ymin;
00046         }
00047 
00048         public int getStartZ() {
00049                 return zmin;
00050         }
00051 
00052         public int getStopX() {
00053                 return xmax;
00054         }
00055 
00056         public int getStopY() {
00057                 return ymax;
00058         }
00059 
00060         public int getStopZ() {
00061                 return zmax;
00062         }
00063 
00064         public int getWidth() {
00065                 return xmax - xmin + 1;
00066         }
00067 
00068         public int getHeight() {
00069                 return ymax - ymin + 1;
00070         }
00071 
00072         public int getDepth() {
00073                 return zmax - zmin + 1;
00074         }
00075 
00076         public void printSize() {
00077                 System.out.println(xmin + " " + ymin + " " + zmin);
00078         }
00079 
00080         @Override
00081         public String toString() {
00082                 return getWidth() + ", " + getHeight() + ", " + getDepth();
00083         }
00084 }

Generated on Fri Nov 13 08:57:07 2009 for Theba by  doxygen 1.6.1