Description Usage Arguments Details Value
We have points (x1, y1) and (x2, y2) in
Cartesian space. We wish to draw a line between these two
points.
1 2 | coordinatesBetweenRectangles(x1, y1, x2, y2, w1, h1, w2,
h2)
|
x1 |
The x-coordinate of the first point |
y1 |
The y-coordinate of the first point |
x2 |
The x-coordinate of the second point |
y2 |
The y-coordinate of the second point |
w1 |
The width of the bounding box around |
h1 |
The height of the bounding box around
|
w2 |
The width of the bounding box around |
h2 |
The height of the bounding box around
|
However, these two points have rectangles centred around
them. The first point has a rectangle width w1 and
height h1 drawn around it; the second has a
rectangle with w2 and height h2 drawn
around it. Note that the vertices of the first rectangle
are (x1-w1/2, x1+h1/2), (x1+w1/2, x1+h1/2),
(x1+w1/2, x1-h1/2) (x1-w1/2, x1-h1/2).
This function returns the coordinates of the points on which the line drawn between the two points intersects with each bounding box.
A numeric vector of length 4. The first two are the x-
and y-coordinates on the bounding box of (x1, y1).
The third and fourth are the x- and y-coordinates on the
bounding box of (x2, y2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.