/** * The Point class is an immutable data type to encapsulate a * two-dimensional point with real-value coordinates. *
* Note: in order to deal with the difference behavior of double and * Double with respect to -0.0 and +0.0, the Point2D constructor converts * any coordinates that are -0.0 to +0.0. *
* For additional documentation, * see Section 1.2 of * Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne. * */ export default class Point2D { private _x; private _y; constructor(x: number, y: number); x(): number; y(): number; /** * Returns the polar radius of this point. * @return the polar radius of this point in polar coordinates: sqrt(x*x + y*y) */ r(): number; /** * Returns the angle of this point in polar coordinates. * @return the angle (in radians) of this point in polar coordinates (between –π and π) */ theta(): number; /** * Returns the Euclidean distance between this point and that point. * @param that the other point * @return the Euclidean distance between this point and that point */ distanceTo(that: Point2D): number; /** * Plot this point using standard draw. */ draw(): void; /** * Return a string representation of this point. * @return a string representation of this point in the format (x, y) */ toString(): string; }