Spherical.R2.Rectangle
Represents a closed axis-aligned rectangle in ℝ².
Describes every point in two-dimensional space by means of two coordinates.
Summary
| add_point(rectangle, point) | Expands the |
| add_rectangle(first, second) | Expands the |
| approx_equals(first, second) | Returns true if the x- and y-intervals of the two rectangles are the same up to the given tolerance |
| center(rectangle) | Returns the center of the |
| clamp_point(rectangle, point) | Returns the closest point in the |
| contains?(first, second) | Checks whether the |
| contains_point?(rectangle, point) | Checks whether the |
| expanded(rectangle, margin) | Returns a |
| expanded_by_margin(rectangle, margin) | Returns a |
| from_center(center, size) | Returns a rectangle with the given |
| from_points(list1) | Returns a rectangle that contains the given |
| interior_contains?(first, second) | Checks whether the interior of the |
| interior_contains_point?(rectangle, point) | Returns true if the given |
| interior_intersects?(first, second) | Checks whether the interior of the |
| intersection(first, second) | Returns the smallest rectangle containing the intersection of the
|
| intersects?(first, second) | Checks whether the |
| is_empty?(rectangle) | Checks whether the |
| is_valid?(rectangle) | Checks whether the |
| new() | Returns an empty rectangle |
| new(x, y) | Returns a rectangle with the given intervals |
| size(rectangle) | Returns the width and height of this |
| union(first, second) | Returns the smallest rectangle containing the union of the |
| vertices(rectangle) | Returns all four vertices of the |
Types
t :: %Spherical.R2.Rectangle{x: Spherical.R1.Interval.t, y: Spherical.R1.Interval.t}
Functions
Expands the rectangle to include the given point.
The rectangle is expanded by the minimum amount possible.
Expands the first rectangle to include the second.
This is the same as replacing the one rectangle by the union of the two rectangles, but is more efficient.
Returns true if the x- and y-intervals of the two rectangles are the same up to the given tolerance.
Returns the center of the rectangle in ℝ²
Returns the closest point in the rectangle to the given point.
The rectangle must be non-empty.
Checks whether the first rectangle contains the second.
Checks whether the rectangle contains the given point.
Rectangles are closed regions, i.e. they contain their boundary.
Returns a rectangle that has been expanded in the x-direction by
margin.x and in y-direction by margin.y.
If either margin is empty, then shrink the interval on the
corresponding sides instead. The resulting rectangle may be
empty. Any expansion of an empty rectangle remains empty.
Returns a rectangle that has been expanded by the amount on all
sides by margin.
Returns a rectangle with the given center and size.
Both dimensions of size must be non-negative.
Returns a rectangle that contains the given points.
Checks whether the interior of the first rectangle contains all of
the points of the second (including its boundary).
Returns true if the given point is contained in the interior of the
rectangle (i.e. the region excluding its boundary).
Checks whether the interior of the first rectangle intersects any
point (including the boundary) of the second.
Returns the smallest rectangle containing the intersection of the
first and second rectangles.
Checks whether the first rectangle and the second have any
points in common.
Checks whether the rectangle is empty.
Checks whether the rectangle is valid.
This requires the width to be empty if the height is empty.
Returns an empty rectangle.
Returns a rectangle with the given intervals.
Returns the width and height of this rectangle in (x,y)-space.
Empty rectangles have a negative width and height.
Returns the smallest rectangle containing the union of the first
and second rectangles.
Returns all four vertices of the rectangle.
Vertices are returned in CCW direction starting with the lower left corner.