00001 package commandline.ImageStuff;
00002
00003 import java.util.Comparator;
00004
00005 import commandline.ImageStuff.GeometricObjects.Vertex;
00006
00007 public class VertexComparator implements Comparator<Vertex> {
00008
00009
00010
00011 public int compare(Vertex a, Vertex b){
00012 int x_0=a.getX();
00013 int y_0=a.getY();
00014 int x_1=b.getX();
00015 int y_1=b.getY();
00016 float z_0=a.getZ();
00017 float z_1=a.getZ();
00018 if(x_0 < x_1) {
00019 return 1;
00020 }else{
00021 if(x_0> x_1){
00022 return -1;
00023 }
00024 else{
00025 if(y_0 < y_1){
00026 return 1;
00027 }
00028 else{
00029 if(y_0>y_1){
00030 return -1;
00031 }
00032 else{
00033 if(z_0<z_1){return 1;}
00034 else{
00035 if(z_0>z_1){return -1;}else{
00036 return 0;
00037 }
00038 }
00039 }
00040 }
00041 }
00042 }
00043
00044
00045 }
00046
00047
00048 }