Description Usage Arguments Value Examples
View source: R/IntersectLineCircle.R
IntersectLineCircle
finds the intesection between a line and a circumference
1 | IntersectLineCircle(Line, C, r)
|
Line |
Line object previously created with |
C |
Vector containing the xy-coordinates of the center of the circumference |
r |
Radius for the circumference |
Returns a vector containing the xy-coordinates of the intersection points. In case of no intersection, the function tells the user
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | P1 <- c(0,0)
P2 <- c(1,1)
Line <- CreateLinePoints(P1, P2)
C <- c(0,0)
r <- 2
intersection <- IntersectLineCircle(Line, C, r)
x_min <- -5
x_max <- 5
y_min <- -5
y_max <- 5
CoordinatePlane(x_min, x_max, y_min, y_max)
Draw(Line, "black")
Draw(CreateArcAngles(C, r, 0, 360), "black")
Draw(intersection[1,], "red")
Draw(intersection[2,], "red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.