ProGAL.geom2d
Class Point

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

public class Point
extends Point

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

Author:
R.Fonseca
See Also:
Serialized Form

Field Summary
static Point origo
           
 
Constructor Summary
Point()
          Construct a point at (0,0)
Point(double[] coords)
          Construct a point with the specified coordinates.
Point(double x, double y)
          Construct a point with the specified coordinates.
 
Method Summary
 Point add(double a, double b)
           
 Point add(Vector v)
          Add the vector v to this point and return the result
 Point addThis(double a, double b)
           
 Point addThis(Point p)
           
 Point addThis(Vector v)
          Add the vector v to this point and return the result (changes this object)
static double area(Point a, Point b, Point c)
          Returns the signed area of the triangle defined by the three points a, b and c (positive if counterclockwise)
 Point clone()
           
static boolean collinear(Point a, Point b, Point c)
           
 boolean equals(java.lang.Object o)
          Return true iff o is a Point that has the same same coordinates as this.
 boolean equals(Point p)
          Return true iff p has the same same coordinates as this.
static Line getBisector(Point p, Point q)
          Creates a bisector between points p and q
 double getDistance(LineSegment s)
          returns distance of this point to segment s
static double getSignedAngle(Point p1, Point p2, Point p3)
          Returns the angle between the points, but if they make a left turn the angle will be negative.
 double getSquaredDistance()
          returns squared distance of this point to the origo.
 double getSquaredDistance(LineSegment s)
          returns squared distance of this point to segment s
 double getSquaredDistance(Point q)
          returns squared distance of this point to point q.
static double inCircle(Point p, Point q, Point r, Point s)
          Returns a positive double if the point is inside the circle through the 3 specified points (must be in clockwise order).
static boolean leftTurn(Point a, Point b, Point c)
          Returns true if points a, b and c make a left turn at b
static void main(java.lang.String[] args)
           
static Point midPoint(Point p, Point q)
          Returns the midpoint of two points.
 double polarAngle()
          Returns polar angle of this point
 double polarAngleCos()
          Returns the cosinus of the polar angle of this point
 double polarAngleSin()
          Returns the sinus of the polar angle of this point
static boolean rightTurn(Point a, Point b, Point c)
          Returns true if points a, b and c make a right turn at b or are colinear
 void rotation(double alpha)
          rotates the point around the origo (counterclockwise)
 void rotation(double cos, double sin)
           
 void rotation(Point p, double angle)
          rotates point p around this point by angle
 Point rotationClone(double alpha)
           
 Point subtract(Vector v)
          Subtract the vector v from this point and return the result
 Point subtractThis(Point p)
           
 Point subtractThis(Vector v)
          Subtract the vector v from this point and return the result (changes this object)
 void toScene(J2DScene scene, double rad, java.awt.Color col)
           
 Vector vectorTo(Point p)
          Return a vector pointing from this point to p
 double x()
          Return the x-coordinate
 double y()
          Return the y-coordinate
 
Methods inherited from class ProGAL.geomNd.Point
addThis, distance, distance, distanceSquared, distanceSquared, distanceSquaredXY, distanceXY, dot, get, getAngle, getCoord, getCoords, getDimensions, getMidpoint, multiplyThis, polarAngleCosXY, polarAngleSinXY, polarAngleXY, set, set, setCoord, setCoord, toConsole, toConsole, toString, toString, toVector, vectorTo
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

origo

public static Point origo
Constructor Detail

Point

public Point()
Construct a point at (0,0)


Point

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


Point

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

Method Detail

x

public double x()
Return the x-coordinate


y

public double y()
Return the y-coordinate


clone

public Point clone()
Overrides:
clone in class Point

vectorTo

public Vector vectorTo(Point p)
Return a vector pointing from this point to p


add

public Point add(Vector v)
Add the vector v to this point and return the result


add

public Point add(double a,
                 double b)

addThis

public Point addThis(Vector v)
Add the vector v to this point and return the result (changes this object)


addThis

public Point addThis(Point p)

addThis

public Point addThis(double a,
                     double b)

subtract

public Point subtract(Vector v)
Subtract the vector v from this point and return the result


subtractThis

public Point subtractThis(Vector v)
Subtract the vector v from this point and return the result (changes this object)


subtractThis

public Point subtractThis(Point p)

area

public static double area(Point a,
                          Point b,
                          Point c)
Returns the signed area of the triangle defined by the three points a, b and c (positive if counterclockwise)


collinear

public static boolean collinear(Point a,
                                Point b,
                                Point c)

getSquaredDistance

public double getSquaredDistance()
returns squared distance of this point to the origo.


getSquaredDistance

public double getSquaredDistance(Point q)
returns squared distance of this point to point q.


getSquaredDistance

public double getSquaredDistance(LineSegment s)
returns squared distance of this point to segment s


getDistance

public double getDistance(LineSegment s)
returns distance of this point to segment s


getSignedAngle

public static double getSignedAngle(Point p1,
                                    Point p2,
                                    Point p3)
Returns the angle between the points, but if they make a left turn the angle will be negative.


inCircle

public static double inCircle(Point p,
                              Point q,
                              Point r,
                              Point s)
Returns a positive double if the point is inside the circle through the 3 specified points (must be in clockwise order).


polarAngle

public double polarAngle()
Returns polar angle of this point


polarAngleSin

public double polarAngleSin()
Returns the sinus of the polar angle of this point


polarAngleCos

public double polarAngleCos()
Returns the cosinus of the polar angle of this point


leftTurn

public static boolean leftTurn(Point a,
                               Point b,
                               Point c)
Returns true if points a, b and c make a left turn at b


rightTurn

public static boolean rightTurn(Point a,
                                Point b,
                                Point c)
Returns true if points a, b and c make a right turn at b or are colinear


midPoint

public static Point midPoint(Point p,
                             Point q)
Returns the midpoint of two points.


getBisector

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


equals

public boolean equals(java.lang.Object o)
Return true iff o is a Point that has the same same coordinates as this.

Overrides:
equals in class java.lang.Object

equals

public boolean equals(Point p)
Return true iff p has the same same coordinates as this.


rotation

public void rotation(double alpha)
rotates the point around the origo (counterclockwise)


rotationClone

public Point rotationClone(double alpha)

rotation

public void rotation(double cos,
                     double sin)

rotation

public void rotation(Point p,
                     double angle)
rotates point p around this point by angle


toScene

public void toScene(J2DScene scene,
                    double rad,
                    java.awt.Color col)

main

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