ProGAL.geomNd
Class Point

java.lang.Object
  extended by ProGAL.geomNd.Point
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Point, Point, Vertex

public class Point
extends java.lang.Object
implements java.io.Serializable

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
See Also:
Serialized Form

Constructor Summary
Point(double[] coords)
           
Point(int dimensions)
           
Point(Point p)
           
 
Method Summary
 Point addThis(Vector v)
          Add the specified vector to this point.
 Point clone()
           
static boolean collinear(Point p1, Point p2, Point p3)
           
 double distance()
          Returns distance to the origo
 double distance(Point p)
          Returns distance to the point p
 double distanceSquared()
          Returns squared distance to the origo
 double distanceSquared(Point p)
          Returns squared distance to the point p
 double distanceSquaredXY()
          Returns the squared distance to the origo of this point projected onto xy plane
 double distanceXY()
          Returns the distance to the origo of this point projected onto xy plane
 double dot(Point p)
           
 double get(int d)
          Get the d'th coordinate.
static double getAngle(Point p1, Point p2, Point p3)
           
 double getCoord(int d)
          Get the d'th coordinate.
 double[] getCoords()
          Get all coordinates in an array.
 int getDimensions()
          Return the dimensionality of this point.
static Point getMidpoint(Point p, Point q)
          Creates the midpoint of two points.
 Point multiplyThis(double s)
          Scale this point by the specified value
 double polarAngleCosXY()
          Returns the cosinus of the polar angle of this point projected onto xy plane
 double polarAngleSinXY()
          Returns the sinus of the polar angle of this point projected onto xy plane
 double polarAngleXY()
          Returns polar angle of this point projected onto xy plane
 void set(int d, double v)
          Set the d'th coordinate.
 Point set(Point p)
          Set the coordinates to be identical to those in the specified point.
 void setCoord(int d, double v)
          Set the d'th coordinate.
 Point setCoord(Point p)
          Set the coordinates to be identical to those in the specified point.
 void toConsole()
           
 void toConsole(int dec)
           
 java.lang.String toString()
           
 java.lang.String toString(int dec)
           
 Vector toVector()
           
 Vector vectorTo(Point p1)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Point

public Point(Point p)

Point

public Point(double[] coords)

Point

public Point(int dimensions)
Method Detail

get

public double get(int d)
Get the d'th coordinate.


getCoord

public double getCoord(int d)
Get the d'th coordinate.


getCoords

public double[] getCoords()
Get all coordinates in an array.


getDimensions

public int getDimensions()
Return the dimensionality of this point. If it is a point in xyz-space then the dimensionality is 3. The method getDimensions should not be confused with getDimension (in Simplex and geom3d.Point) which is always 0 for points.


set

public void set(int d,
                double v)
Set the d'th coordinate.


setCoord

public void setCoord(int d,
                     double v)
Set the d'th coordinate.


set

public Point set(Point p)
Set the coordinates to be identical to those in the specified point. If the dimensions of p and this are not the same, then the largest possible number of coordinates are copied


setCoord

public Point setCoord(Point p)
Set the coordinates to be identical to those in the specified point. If the dimensions of p and this are not the same, then the largest possible number of coordinates are copied.


addThis

public Point addThis(Vector v)
Add the specified vector to this point.


multiplyThis

public Point multiplyThis(double s)
Scale this point by the specified value


distanceSquared

public double distanceSquared(Point p)
Returns squared distance to the point p


distanceSquared

public double distanceSquared()
Returns squared distance to the origo


distance

public double distance(Point p)
Returns distance to the point p


dot

public double dot(Point p)

distance

public double distance()
Returns distance to the origo


getMidpoint

public static Point getMidpoint(Point p,
                                Point q)
Creates the midpoint of two points.


collinear

public static boolean collinear(Point p1,
                                Point p2,
                                Point p3)

getAngle

public static double getAngle(Point p1,
                              Point p2,
                              Point p3)

distanceSquaredXY

public double distanceSquaredXY()
Returns the squared distance to the origo of this point projected onto xy plane


distanceXY

public double distanceXY()
Returns the distance to the origo of this point projected onto xy plane


polarAngleSinXY

public double polarAngleSinXY()
Returns the sinus of the polar angle of this point projected onto xy plane


polarAngleCosXY

public double polarAngleCosXY()
Returns the cosinus of the polar angle of this point projected onto xy plane


polarAngleXY

public double polarAngleXY()
Returns polar angle of this point projected onto xy plane


vectorTo

public Vector vectorTo(Point p1)

toVector

public Vector toVector()

clone

public Point clone()
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(int dec)

toConsole

public void toConsole()

toConsole

public void toConsole(int dec)