package ProGAL.geomNd; import java.io.Serializable; import java.util.Arrays; import ProGAL.math.Constants; import ProGAL.math.Randomization; /** * A class representing a point in an N-dimensional Euclidean space. The underlying * representation is a double-array. Changes to the elements of this double-array * will also result in a change to the point. The double-array can be specified on * construction and can be retrieved lated. * @author R. Fonseca */ public class Point implements Serializable{ private static final long serialVersionUID = -6776647998875885511L; /** The double-array that holds the value of this point */ protected final double[] coords; /** The dimension of this point. */ protected final int dim; public Point(Point p){ this.dim = p.coords.length; this.coords = new double[dim]; for(int i=0;ip and this are not the same, then the largest possible number of * coordinates are copied */ public Point set(Point p){ for(int i=0;ip and this are not the same, then the largest possible number of * coordinates are copied. */ public Point setCoord(Point p){ for(int i=0;i0) ret.append(String.format("%."+dec+"f]", coords[dim-1])); return ret.toString(); } public void toConsole() { toConsole(2); } public void toConsole(int dec) { System.out.println(toString(dec)); } }