Description Usage Arguments Value Examples
Rotate coordinates
1 | rotate_point(x0, y0, x1, y1, angle)
|
x0 |
x coordinate of the origin |
y0 |
y coordinate of the origin |
x1 |
x coordinate of the point |
y1 |
y coordinate of the point |
angle |
Rotation angle in degree (anti-clockwise) |
The new coordinates for the point
1 2 3 4 5 6 7 8 9 10 | ## Not run:
rotate_point(0,0,1,0,90)
# Example with a plot:
x0 = 1 ; y0 = 1 ; x1= 2 ; y1= 2 ;x3= 3 ; y3= 3
plot(c(x0,x1),c(y0,y1), type="l", ylim = c(0,3), xlim = c(0,3))
segments(x1,y1,x3,y3, col= 2)
segments(x1,y1,rotate_point(x1,y1,x3,y3, 45)[1],rotate_point(x1,y1,x3,y3, 45)[2], col= 3)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.