00001 package commandline.ImageStuff.GeometricObjects;
00002
00003 import junit.framework.Assert;
00004
00005 import commandline.CodingUtils.CommitDataStructure;
00006 import commandline.ImageStuff.Loc;
00007 import commandline.ImageStuff.Pixel;
00008
00009
00010 public class Vertex extends Pixel {
00011
00012 public final static int NO_AREAO=-1;
00013 public final static int AREA_BASEVERTICES=0;
00014 private GenericEdge leftEdge;
00015 private GenericEdge rightEdge;
00016 int verticalOffset;
00017 float normalisation=NO_AREAO;
00018
00019 protected boolean isRegistered;
00020
00021
00022
00023 public Vertex(int x, int y, float z,int verticalOffset,float normalisation) {
00024 super(x, y, z);
00025
00026
00027 this.verticalOffset=verticalOffset;
00028 this.normalisation=normalisation;
00029 }
00030
00031 public Vertex(Loc l,float z,int verticalOffset,float A_I){
00032 this(l.getX(),l.getY(),z,verticalOffset,A_I);
00033
00034 }
00035
00036 public Vertex(Pixel p){
00037 this(p.getX(),p.getY(),p.getZ(),0,0);
00038 }
00039
00040
00041 public int getVerticalOffset(){
00042 return verticalOffset;
00043 }
00044
00045 public void setLeftEdge(GenericEdge left){
00046 this.leftEdge=left;
00047 }
00048 public void setRightEdge(GenericEdge right){
00049 this.rightEdge=right;
00050 }
00051
00052 public GenericEdge getLeftEdge(){
00053 return leftEdge;
00054 }
00055 public GenericEdge getRightEdge(){
00056 return rightEdge;
00057 }
00058
00059
00063 public float getNormalisation(){
00064 Assert.assertTrue(normalisation!=NO_AREAO);
00065 return this.normalisation;
00066 }
00067
00068
00069 public boolean hasLinkedEdges(){
00070 return (rightEdge!=null || leftEdge !=null);
00071 }
00072
00073
00077 public void register(CommitDataStructure dataStructure){
00078 if(!isRegistered()){
00079 dataStructure.addVertex(this);
00080
00081 this.isRegistered=true;
00082 }
00083 }
00084
00085 private boolean isRegistered(){
00086 return isRegistered;
00087 }
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 }