/* Auteur: Nicolas JANEY */ /* nicolas.janey@univ-fcomte.fr */ /* Octobre 2008 */ /* Une classe coordonnees homogenes en trois dimensions */ public class CoordonneesHomogenes3D { protected double [] c; public CoordonneesHomogenes3D() { c = new double[4]; } public CoordonneesHomogenes3D(double x,double y,double z,double t) { c = new double[4]; c[0] = x; c[1] = y; c[2] = z; c[3] = t; } public CoordonneesHomogenes3D(CoordonneesHomogenes3D ch) { c = new double[4]; c[0] = ch.c[0]; c[1] = ch.c[1]; c[2] = ch.c[2]; c[3] = ch.c[3]; } public CoordonneesHomogenes3D(double [] t) { c = new double[4]; c[0] = t[0]; c[1] = t[1]; c[2] = t[2]; c[3] = t[3]; } public void setX(double x) { c[0] = x; } public double getX() { return(c[0]); } public void setY(double y) { c[1] = y; } public double getY() { return(c[1]); } public void setZ(double z) { c[2] = z; } public double getZ() { return(c[2]); } public void setT(double t) { c[3] = t; } public double getT() { return(c[3]); } public double [] getValue() { double [] nc = new double[4]; nc[0] = c[0]; nc[1] = c[1]; nc[2] = c[2]; nc[3] = c[3]; return(nc); } public String toString() { String s = "["; int i; for ( i = 0 ; i < c.length-1 ; i++ ) s += (c[i]+","); s += c[i]+"]"; return(s); } }