import Interval1D from '../Interval1D'; import Point2D from '../Point2D'; /** * The `Interval2D` class represents a closed two-dimensional interval, * which represents all points (x, y) with both `xmin <= x <= xmax` and * `ymin <= y <= ymax`. * Two-dimensional intervals are immutable: their values cannot be changed * after they are created. * The class `Interval2D` includes methods for checking whether * a two-dimensional interval contains a point and determining whether * two two-dimensional intervals intersect. *

* For additional documentation, * see Section 1.2 of * Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne. */ export default class Interval2D { private readonly _x; private readonly _y; constructor(x: Interval1D, y: Interval1D); /** * Returns the area of this two-dimensional interval. * @return the area of this two-dimensional interval */ area(): number; /** * Does this two-dimensional interval contain the point p? * @param p the two-dimensional point * @return true if this two-dimensional interval contains the point p; false otherwise */ contains(p: Point2D): boolean; x(): Interval1D; y(): Interval1D; /** * Does this two-dimensional interval intersect that two-dimensional interval? * @param that the other two-dimensional interval * @return true if this two-dimensional interval intersects * that two-dimensional interval; false otherwise */ intersects(that: Interval2D): boolean; /** * Draws this two-dimensional interval to standard draw. */ draw(): void; }