ProGAL.geom3d
Class Point

java.lang.Object
  extended by ProGAL.geomNd.Point
      extended by ProGAL.geom3d.Point
All Implemented Interfaces:
java.io.Serializable, Shape, Simplex
Direct Known Subclasses:
Atom, CVertex, PointWeighted

public class Point
extends Point
implements Simplex

A point in (x,y,z)-space represented with double precision.

See Also:
Serialized Form

Constructor Summary
Point(double[] coords)
          Construct a point with the specified coordinates.
Point(double x, double y, double z)
          Construct a point with the specified coordinates.
Point(Point p)
          Construct a point that is a clone of p.
Point(Vector v)
          Construct a point at the coordinates of v.
 
Method Summary
 Point add(Vector p)
          Returns p added to this (without changing this object).
 Point addThis(Point p)
           
 Point addThis(Vector p)
          Returns p added to this (changing this object).
 Point clone()
          Return a new object that equals this object.
static boolean collinear(Point p0, Point p1, Point p2)
          Returns true if three points are on the same line.
static boolean coplanar(Point p0, Point p1, Point p2, Point p3)
          Returns true if four specified points are in the same plane
 double distance(Point q)
          Get the distance from this point to point q
 double distanceSquared(Point q)
          Get the squared distance from this point to point q.
 boolean dominates(Point q)
          Returns true if this point dominates point q.
 boolean dominates(Point q, int i, int j, int k)
          Returns true if this point dominates point q (i=0,1,2 is the most important coordinate, j=0,1,2 is the second most important coordinate and k=0,1,2 is the least important coordinate).
 double dot(Point p)
           
 double dot(Vector v)
           
 boolean equals(java.lang.Object o)
          Returns true iff o is a point that equals this point.
 boolean equals(Point p)
          Returns true iff this point and point p are overlapping.
static double getAngle(Point p1, Point p2, Point p3)
          Get the angle between the line segments p2->p1 and p2->p3.
static Plane getBisector(Point p, Point q)
          Creates a bisector between points p and q
 Point getCenter()
          Returns a clone of this point.
static Point getCircumCenter(Point a, Point b, Point c)
           
static double getCosDihedralAngle(Point p1, Point p2, Point p3, Point p4)
           
static double getDihedralAngle(Point p1, Point p2, Point p3, Point p4)
          Get the dihedral angle defined by the 4 non-collinear points p1, p2, p3, p4.
 int getDimension()
          Return the 'dimension' of this object.
static Point getEquilateralPoint(Point a, Point b, Point c)
           
static Point getMidpoint(Point p, Point q)
          Creates the midpoint of two points.
 Point getPoint(int i)
          TODO: Comment
static Point getSteinerPoint(Point a, Point b, Point c)
           
static double inSphere(Point p, Point q, Point r, Point s, Point t)
          Returns a positive double if point t is inside the sphere through points p, q, r, s.
static void main(java.lang.String[] args)
           
static double orientation(Point p, Point q, Point r, Point s)
           
static double orientation(Point p, Point q, Point r, Point s, Point t)
           
 double polarAngleCosZ()
          Returns the cosinus of the polar angle of this point with the z-axis
 double polarAngleSinZ()
          Returns the sinus of the polar angle of this point with the z-axis
 Point reflectThroughOrigoThis()
          Reflects this point through origo.
 void rotation(Vector v, double alpha)
          rotates (clockwise) the point around the line through the origo with the direction unit vector v.
 void rotation(Vector v, double alpha, Point p)
          rotates (clockwise) the point around the line through the point p with the direction unit vector v.
 void scaleThis(double s)
          Scale this point by a factor s
 void setX(double x)
          Set the first coordinate
 void setY(double y)
          Set the second coordinate
 void setZ(double z)
          Set the third coordinate
 Point subtract(Vector p)
          Returns p subtracted from this (without changing this object).
 Point subtractThis(Point p)
           
 Point subtractThis(Vector p)
          Returns p subtracted from this (changing this object).
 void toConsole()
          Writes this point to System.out.
 void toConsole(int dec)
          Writes this point to System.out with dec decimals precision.
 void toScene(J3DScene scene, double r, java.awt.Color clr)
           
 java.lang.String toString()
          Returns a string-representation of this point formatted with two decimals precision.
 java.lang.String toString(int dec)
          Returns a string-representation of this point formatted with dec decimals precision.
 Vector toVector()
          Returns the vector from origo to this point.
 void translateThis(double dx, double dy, double dz)
          Translates this point by (x,y,z).
 Vector vectorTo(Point p)
          Get the vector that points from this point to p
 double x()
          Get the first coordinate.
 double y()
          Get the second coordinate.
 double z()
          Get the third coordinate.
 
Methods inherited from class ProGAL.geomNd.Point
addThis, distance, distance, distanceSquared, distanceSquared, distanceSquaredXY, distanceXY, dot, get, getCoord, getCoords, getDimensions, multiplyThis, polarAngleCosXY, polarAngleSinXY, polarAngleXY, set, set, setCoord, setCoord, vectorTo
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Point

public Point(double x,
             double y,
             double z)
Construct a point with the specified coordinates.


Point

public Point(double[] coords)
Construct a point with the specified coordinates.


Point

public Point(Point p)
Construct a point that is a clone of p.


Point

public Point(Vector v)
Construct a point at the coordinates of v.

Method Detail

x

public double x()
Get the first coordinate.


y

public double y()
Get the second coordinate.


z

public double z()
Get the third coordinate.


setX

public void setX(double x)
Set the first coordinate


setY

public void setY(double y)
Set the second coordinate


setZ

public void setZ(double z)
Set the third coordinate


getDimension

public int getDimension()
Return the 'dimension' of this object. Required by the interface Simplex. Beware not to confuse this method with getDimensions from geomNd.Point.

Specified by:
getDimension in interface Simplex

vectorTo

public Vector vectorTo(Point p)
Get the vector that points from this point to p


collinear

public static boolean collinear(Point p0,
                                Point p1,
                                Point p2)
Returns true if three points are on the same line. This implies that overlapping points are considered collinear.


coplanar

public static boolean coplanar(Point p0,
                               Point p1,
                               Point p2,
                               Point p3)
Returns true if four specified points are in the same plane


orientation

public static double orientation(Point p,
                                 Point q,
                                 Point r,
                                 Point s)

orientation

public static double orientation(Point p,
                                 Point q,
                                 Point r,
                                 Point s,
                                 Point t)

inSphere

public static double inSphere(Point p,
                              Point q,
                              Point r,
                              Point s,
                              Point t)
Returns a positive double if point t is inside the sphere through points p, q, r, s.


translateThis

public void translateThis(double dx,
                          double dy,
                          double dz)
Translates this point by (x,y,z).


scaleThis

public void scaleThis(double s)
Scale this point by a factor s


addThis

public Point addThis(Vector p)
Returns p added to this (changing this object).


addThis

public Point addThis(Point p)

add

public Point add(Vector p)
Returns p added to this (without changing this object).


subtractThis

public Point subtractThis(Vector p)
Returns p subtracted from this (changing this object).


subtractThis

public Point subtractThis(Point p)

subtract

public Point subtract(Vector p)
Returns p subtracted from this (without changing this object).


reflectThroughOrigoThis

public Point reflectThroughOrigoThis()
Reflects this point through origo.


rotation

public void rotation(Vector v,
                     double alpha)
rotates (clockwise) the point around the line through the origo with the direction unit vector v. For counterclockwise rotation change signs within parentheses in non-diagonal terms.


rotation

public void rotation(Vector v,
                     double alpha,
                     Point p)
rotates (clockwise) the point around the line through the point p with the direction unit vector v. For counterclockwise rotation change signs within parentheses in non-diagonal terms.


polarAngleSinZ

public double polarAngleSinZ()
Returns the sinus of the polar angle of this point with the z-axis


polarAngleCosZ

public double polarAngleCosZ()
Returns the cosinus of the polar angle of this point with the z-axis


distanceSquared

public double distanceSquared(Point q)
Get the squared distance from this point to point q.


distance

public double distance(Point q)
Get the distance from this point to point q


dot

public double dot(Point p)

dot

public double dot(Vector v)

getBisector

public static Plane getBisector(Point p,
                                Point q)
Creates a bisector between points p and q


getMidpoint

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


getAngle

public static double getAngle(Point p1,
                              Point p2,
                              Point p3)
Get the angle between the line segments p2->p1 and p2->p3.


getDihedralAngle

public static double getDihedralAngle(Point p1,
                                      Point p2,
                                      Point p3,
                                      Point p4)
Get the dihedral angle defined by the 4 non-collinear points p1, p2, p3, p4.


getCosDihedralAngle

public static double getCosDihedralAngle(Point p1,
                                         Point p2,
                                         Point p3,
                                         Point p4)

dominates

public boolean dominates(Point q)
Returns true if this point dominates point q. One point is said to dominate another if it has a higher x-coordinate. If two points have identical x-coordinates, the y-coordinate is considered and so forth.


dominates

public boolean dominates(Point q,
                         int i,
                         int j,
                         int k)
Returns true if this point dominates point q (i=0,1,2 is the most important coordinate, j=0,1,2 is the second most important coordinate and k=0,1,2 is the least important coordinate).


getCenter

public Point getCenter()
Returns a clone of this point. Since a point can be interpreted as a geometric shape (a 0-simplex) the Shape interface requires the getCenter method to be implemented. TODO: Test

Specified by:
getCenter in interface Shape

getPoint

public Point getPoint(int i)
Description copied from interface: Simplex
TODO: Comment

Specified by:
getPoint in interface Simplex

equals

public boolean equals(java.lang.Object o)
Returns true iff o is a point that equals this point.

Overrides:
equals in class java.lang.Object

equals

public boolean equals(Point p)
Returns true iff this point and point p are overlapping.


getCircumCenter

public static Point getCircumCenter(Point a,
                                    Point b,
                                    Point c)

getEquilateralPoint

public static Point getEquilateralPoint(Point a,
                                        Point b,
                                        Point c)

getSteinerPoint

public static Point getSteinerPoint(Point a,
                                    Point b,
                                    Point c)

clone

public Point clone()
Return a new object that equals this object.

Overrides:
clone in class Point

toVector

public Vector toVector()
Returns the vector from origo to this point. Converts this point to a vector.

Overrides:
toVector in class Point

toString

public java.lang.String toString()
Returns a string-representation of this point formatted with two decimals precision.

Overrides:
toString in class Point

toString

public java.lang.String toString(int dec)
Returns a string-representation of this point formatted with dec decimals precision.

Overrides:
toString in class Point

toScene

public void toScene(J3DScene scene,
                    double r,
                    java.awt.Color clr)

toConsole

public void toConsole()
Writes this point to System.out.

Overrides:
toConsole in class Point

toConsole

public void toConsole(int dec)
Writes this point to System.out with dec decimals precision.

Overrides:
toConsole in class Point

main

public static void main(java.lang.String[] args)