package ruum; public class Punkt extends Ese{ public int x, y, z; public Punkt(){x=0; y=0; z=0;} public Punkt(int ux, int uy, int uz){ x=ux; y=uy; z=uz; } public Punkt(Punkt uk){ x=uk.x; y=uk.y; z=uk.z;} public void liida(int ux, int uy, int uz){ x+=ux; y+=uy; z+=uz; } public void liida(Punkt uk){ x+=uk.x; y+=uk.y; z+=uk.z; } public static Punkt liida(Punkt u1, Punkt u2){ Punkt u=new Punkt(); u.x=u1.x+u2.x; u.y=u1.y+u2.y; u.z=u1.z+u2.z; return u; } public void lahuta(int ux, int uy, int uz){ x-=ux; y-=uy; z-=uz; } public void lahuta(Punkt uk){ x-=uk.x; y-=uk.y; z-=uk.z; } public static Punkt lahuta(Punkt u1, Punkt u2){ Punkt u=new Punkt(); u.x=u1.x-u2.x; u.y=u1.y-u2.y; u.z=u1.z-u2.z; return u; } public void korruta(double d){ x=(int)Math.round(d*x); y=(int)Math.round(d*y); z=(int)Math.round(d*z); } public static Punkt korruta(Punkt p, double d){ Punkt u=new Punkt(); u.x=(int)Math.round(d*p.x); u.y=(int)Math.round(d*p.y); u.z=(int)Math.round(d*p.z); return u; } public String toString(){ return x+" "+y+" "+z;} public Object clone(){ Punkt u=new Punkt(); u.x=x; u.y=y; u.z=z; return u; } }