Point2D Class |
Namespace: Algs4Net
public sealed class Point2D : BasicVisual, IComparable<Point2D>
The Point2D type exposes the following members.
Name | Description | |
---|---|---|
R |
Returns the polar radius of this point. | |
Theta |
Returns the angle of this point in polar coordinates. | |
X |
Returns the x-coordinate. | |
Y |
Returns the y-coordinate. |
Name | Description | |
---|---|---|
Area2 |
Returns twice the signed area of the triangle a-b-c. | |
Ccw |
Returns true if a->b->c is a counterclockwise turn. | |
CompareTo |
Compares two points by y-coordinate, breaking ties by x-coordinate.
Formally, the invoking point (x0, y0) is less than the argument point (x1, y1)
if and only if either y0 < y1 or if y0 = y1 and x0 < x1. | |
DistanceSquaredTo |
Returns the square of the Euclidean distance between this point and that point. | |
DistanceTo |
Returns the Euclidean distance between this point and that point. | |
Draw |
Plot this point using standard draw. (Overrides BasicVisualDraw.) | |
DrawTo |
Plot a line from this point to that point using standard draw. | |
Equals |
Compares this point to the specified point. (Overrides ObjectEquals(Object).) | |
GetAtan2Order |
Compares two points by atan2() angle (between -pi and pi) with respect to this point. | |
GetDistanceToOrder |
Compares two points by distance to this point. | |
GetHashCode |
Returns an integer hash code for this point. (Overrides ObjectGetHashCode.) | |
GetPolarOrder |
Compares two points by polar angle (between 0 and 2pi) with respect to this point. | |
MainTest |
Demo test the point data type. | |
ToString |
Return a string representation of this point. (Overrides ObjectToString.) |
Name | Description | |
---|---|---|
R_ORDER |
Compares two points by polar radius. | |
X_ORDER | Compares two points by x-coordinate. | |
Y_ORDER | Compares two points by y-coordinate. |
For additional documentation, see Section 1.2 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
This class is a C# port from the original Java class Point2D implementation by the respective authors.