//Mike Piff, CICS, University of Sheffield (1997) public class Cartesian { public double x,y,z; public Cartesian(double x,double y,double z){ this.x=x; this.y=y; this.z=z; } public Cartesian(double x,double y){ this.x=x; this.y=y; this.z=0.0d; } public Cartesian(Cartesian c){ this.x=c.x; this.y=c.y; this.z=c.z; } public Cartesian(){ this.x=0.0d; this.y=0.0d; this.z=0.0d; } public Cartesian(Cartesian c1, Cartesian c2, double a,double b){ double a1=a/(a+b); double b1=b/(a+b); this.x=(a1*c1.x+b1*c2.x); this.y=(a1*c1.y+b1*c2.y); this.z=(a1*c1.z+b1*c2.z); } public String toString(){ return "("+x+","+y+","+z+")"; } }