00001 package commandline.ImageStuff;
00002
00003 import commandline.debuggingCode.Debug;
00004
00005
00006 public class Loc{
00010 protected int x;
00011
00015 protected int y;
00016 public Loc(int x,int y) {
00017 this.x=x;
00018 this.y=y;
00019 }
00020
00025 public void setX(int x){
00026 this.x=x;
00027 }
00028
00033 public void setY(int y){
00034 this.y=y;
00035 }
00036
00041 public int getX(){
00042 return x;
00043 }
00044
00049 public int getY(){
00050 return y;
00051 }
00052
00053 public float norm(){
00054 return (float)Math.sqrt(getX()*getX()+getY()*getY());
00055 }
00056 public boolean isOn(Loc l){
00057 return getX()==l.getX() && getY()==l.getY();
00058 }
00059
00060 public Loc min(Loc l){
00061 return new Loc(getX()-l.getX(),getY()-l.getY());
00062 }
00063
00064 public float distance(Loc l){
00065 return (float)(Math.sqrt( Math.pow(this.getX()-l.getX(),2)
00066 +Math.pow(this.getY()-l.getY(),2)
00067 ));
00068 }
00069
00070 public void print(){
00071 Debug.print("Loc: (" + getX()+","+getY()+")");
00072 }
00073
00074
00075
00076 }
00077