public class Point extends Point
Constructor and Description |
---|
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.
|
Point(Point p)
Construct a point with the same two first coordinates as p.
|
Modifier and Type | Method and Description |
---|---|
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 line between points p and q
|
double |
getDistance(LineSegment s)
returns distance of this point to segment s
|
Line |
getDualLine()
Returns the line y = ax + b() where the coordinates of this point are (a,b)
|
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 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) |
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
|
add, addThis, distance, distance, distanceSquared, distanceSquared, distanceSquaredXY, distanceXY, dot, fill, get, getAngle, getCoord, getCoords, getDimensions, getMidpoint, getRandomPoint, multiplyThis, polarAngleCosXY, polarAngleSinXY, polarAngleXY, set, set, setCoord, setCoord, toConsole, toConsole, toString, toString, toVector, vectorTo
public static Point origo
public Point()
public Point(double x, double y)
public Point(double[] coords)
public Point(Point p)
public double x()
public double y()
public Point add(double a, double b)
public Point addThis(Vector v)
v
to this point and return the result (changes this object)public Point addThis(double a, double b)
public Point subtract(Vector v)
v
from this point and return the resultpublic Point subtractThis(Vector v)
v
from this point and return the result (changes this object)public static double area(Point a, Point b, Point c)
public double getSquaredDistance()
public double getSquaredDistance(Point q)
public double getSquaredDistance(LineSegment s)
public double getDistance(LineSegment s)
public static double getSignedAngle(Point p1, Point p2, Point p3)
public static double inCircle(Point p, Point q, Point r, Point s)
public double polarAngle()
public double polarAngleSin()
public double polarAngleCos()
public static boolean leftTurn(Point a, Point b, Point c)
public static boolean rightTurn(Point a, Point b, Point c)
public static Line getBisector(Point p, Point q)
public Line getDualLine()
public boolean equals(java.lang.Object o)
o
is a Point that has the same same coordinates as this.equals
in class java.lang.Object
public boolean equals(Point p)
p
has the same same coordinates as this.public void rotation(double alpha)
public Point rotationClone(double alpha)
public void rotation(double cos, double sin)
public void rotation(Point p, double angle)