00001 package commandline.ImageStuff.util;
00002
00003 import commandline.debuggingCode.Debug;
00004
00005
00006
00007 public class Punt_3D {
00008
00012 protected float x;
00016 protected float y;
00020 protected float z;
00021 public Punt_3D(){
00022 setXYZ(0,0,0);
00023 }
00024
00025 public Punt_3D(float x,float y){
00026 setXYZ(x,y,0);
00027 }
00028
00029 public Punt_3D(float x, float y, float z) {
00030 setXYZ(x,y,z);
00031 }
00032
00033
00034 public void setXYZ(float x, float y, float z){
00035 setX(x);
00036 setY(y);
00037 setZ(z);
00038 }
00039
00040 public boolean liesOn(Punt_3D p){
00041 return p.getX_Int()==this.getX_Int() && p.getY_Int()== this.getY_Int();
00042 }
00043
00048 public void setX(float x){
00049 this.x=x;
00050 }
00051
00056 public void setY(float y){
00057 this.y=y;
00058 }
00059
00064 public void setZ(float z){
00065 this.z=z;
00066 }
00067
00072 public float getX(){
00073 return this.x;
00074 }
00075
00076 public int getX_Int(){
00077 return (int)(this.x);
00078 }
00079 public int getY_Int(){
00080 return (int)(this.y);
00081 }
00082
00087 public float getY(){
00088 return this.y;
00089 }
00090
00095 public float getZ(){
00096 return this.z;
00097 }
00098 public void print(){
00099 Debug.print(this.getX()+" " +this.getY() + " "+this.getZ());
00100 }
00101 public Punt_3D getcopy(){
00102 return new Punt_3D(this.getX(),this.getY(),this.getZ());
00103 }
00104
00105 public static Punt_3D add(Punt_3D p1, Punt_3D p2){
00106 return new Punt_3D(p1.getX()+p2.getX(),p1.getY()+p2.getY(),p1.getZ()+p2.getZ());
00107 }
00108
00109 public void add(myVector v){
00110 setX((float)(Math.round(getX()+v.getX())));
00111 setY((float)(Math.round(getY()+v.getY())));
00112 setZ(getZ()+v.getZ());
00113 }
00114
00115
00116 public static Punt_3D affieneComb(Punt_3D p1,float w1,Punt_3D p2,float w2){
00117 return new Punt_3D((float)(Math.round(p1.getX()*w1+p2.getX()*w2)),(float)(Math.round(p1.getY()*w1+p2.getY()*w2)),p1.getZ()*w1+p2.getZ()*w2);
00118 }
00119
00120
00121 }