Seed.java

Go to the documentation of this file.
00001 package theba.core;
00002 
00003 import theba.core.math.Point3D;
00004 
00012 public class Seed extends Point3D {
00013 
00014         public byte[] prevMask;
00015 
00016         private int crackCount; // Can be negative, sign shows direction
00017 
00018         private int filledPixels;
00019 
00020         private int direction;
00021 
00022         int rating;
00023 
00034         public Seed(int x, int y, int z, int direction, byte[] mask, Seed parent,
00035                         int filledPixels) {
00036 
00037                 super(x, y, z);
00038                 this.direction = direction;
00039 
00040                 this.prevMask = mask;
00041 
00042                 this.filledPixels = filledPixels;
00043 
00044                 if (parent != null) {
00045 
00046                         // inherit crackcount from parent and reset crackcount if the
00047                         // direction has changed
00048                         if (direction == parent.getDirection())
00049                                 crackCount = parent.getCrackCount() + 1;
00050                         else {
00051                                 crackCount = 0;
00052                         }
00053 
00054                 } else
00055                         crackCount = 0;
00056         }
00057 
00058         public void setCrackCount(int crackCount) {
00059                 this.crackCount = crackCount;
00060         }
00061 
00066         public int getCrackCount() {
00067                 return Math.abs(crackCount);
00068         }
00069 
00070         public int countPixels(byte[][] voxels, byte id) {
00071                 int count = 0;
00072                 for (int i = 0; i < voxels[z].length; i++) {
00073                         if (voxels[z][i] == id)
00074                                 count++;
00075                 }
00076                 System.out.println(count);
00077                 return count;
00078         }
00079 
00080         public int getFilledPixels() {
00081                 return filledPixels;
00082         }
00083 
00084         public void setFilledPixels(int filledPixels) {
00085                 this.filledPixels = filledPixels;
00086         }
00087 
00088         public int getDirection() {
00089                 return direction;
00090         }
00091 
00092         public void setDirection(int direction) {
00093                 this.direction = direction;
00094         }
00095 
00096 }

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