left side of DoubleRect, must be less than right
bottom of DoubleRect, must be less than top
right side of DoubleRect
top of DoubleRect
when left > right or bottom > top
Static
Readonly
EMPTY_The empty rectangle (0, 0, 0, 0).
Returns true
if the given point is within this rectangle.
the point to test
true
if the point is within this rectangle, or exactly on an edge
Returns a copy of this DoubleRect expanded by the given margin in x and y dimension.
the margin to add at left and right
Optional
marginY: numberthe margin to add at top and bottom; if undefined then
marginX
is used for both x and y dimension
a DoubleRect with same center as this DoubleRect, but expanded or contracted
Returns a rectangle that is the intersection of this and another rectangle.
the other rectangle to form the intersection with
the intersection of this and the other rectangle, possibly an empty rectangle.
Returns true
if width or height of this DoubleRect are zero (within given
tolerance).
Optional
opt_tolerance: numberoptional tolerance for the test; a width or height smaller than this is regarded as zero; default is 1E-16
true
if width or height of this DoubleRect are zero (within given
tolerance)
Returns true if the line between the two points might be visible in the rectangle.
first end point of line
second end point of line
true if the line between the two points might be visible in the rectangle
Returns true
if this DoubleRect is nearly equal to another DoubleRect.
The optional tolerance value corresponds to the epsilon
in
Util.veryDifferent, so the actual tolerance used depends on the
magnitude of the numbers being compared.
the DoubleRect to compare with
Optional
opt_tolerance: numberoptional tolerance for equality test
true
if this DoubleRect is nearly equal to another DoubleRect
Returns a copy of this DoubleRect expanded by the given factors in both x and y dimension. Expands (or contracts) about the center of this DoubleRect by the given expansion factor in x and y dimensions.
the factor to expand width by; 1.1 gives a 10 percent expansion; 0.9 gives a 10 percent contraction
Optional
factorY: numberfactor to expand height by; if undefined then factorX
is
used for both x and y dimension
a DoubleRect with same center as this DoubleRect, but expanded or contracted
Returns a copy of this rectangle translated by the given amount.
horizontal amount to translate by, or Vector to translate by
Optional
y: numbervertical amount to translate by; required when x
is a number.
a copy of this rectangle translated by the given amount
when x
is a number and y
is not defined
Returns a rectangle that is the union of this and another rectangle.
the other rectangle to form the union with
the union of this and the other rectangle
Returns a rectangle that is the union of this rectangle and a point
the point to form the union with
the union of this rectangle and the point
Static
cloneReturns a copy of the given DoubleRect.
the DoubleRect to copy
a copy of the given DoubleRect
Static
makeReturns a DoubleRect spanning the two given points.
a DoubleRect spanning the two given points
Static
makeReturns a DoubleRect centered at the given point with given height and width.
center of the DoubleRect
width of the DoubleRect
height of the DoubleRect
a DoubleRect centered at the given point with given height and width
Static
makeReturns a DoubleRect centered at the given point with given size.
center of the DoubleRect
width and height as a Vector
a DoubleRect centered at the given point with given size
Generated using TypeDoc
An immutable rectangle whose boundaries are stored with double floating point precision.
Note that for DoubleRect we regard the vertical coordinate as increasing upwards, so the top coordinate is greater than the bottom coordinate. This is in contrast to HTML5 canvas where vertical coordinates increase downwards.
to do: consider implementing a 'real' equals method, see Bloch, Effective Java
to do: consider making a mutable version, and providing methods that work on that.