package t3d; public class Vector3D{ public double x; public double y; public double z; public Vector3D(){} public Vector3D( double x , double y , double z ){ this.x = x; this.y = y; this.z = z; } public Vector3D( Vector3D v1){ this( v1.x , v1.y , v1.z ); } public void setValue( double x , double y , double z ){ this.x = x; this.y = y; this.z = z; } public void add ( double x , double y , double z ){ this.x += x; this.y += y; this.z += z; } public void add (Vector3D v1){ this.add( v1.x , v1.y , v1.z ); } public void subtract( double x , double y , double z ){ this.x -= x; this.y -= y; this.z -= z; } public void subtract (Vector3D v1){ this.subtract( v1.x , v1.y , v1.z ); } public void multiply ( double x , double y , double z ){ this.x = this.x * x; this.y = this.y * y; this.z = this.z * z; } public void multiply( Vector3D v1 ){ this.multiply( v1.x , v1.y , v1.z ); } public double abs( double x , double y , double z ){ return Math.sqrt( Math.pow((this.x - x ) , 2 ) + Math.pow((this.y - y ) , 2) + Math.pow((this.z - z ) , 2) ); } public double abs( Vector3D v1 ){ return this.abs( v1.x , v1.y , v1.z ); } }