IntersectLineCircle: Finds the intersection between a line and a circumference

Description Usage Arguments Value Examples

View source: R/IntersectLineCircle.R

Description

IntersectLineCircle finds the intesection between a line and a circumference

Usage

1

Arguments

Line

Line object previously created with CreateLinePoints or CreateLineAngle

C

Vector containing the xy-coordinates of the center of the circumference

r

Radius for the circumference

Value

Returns a vector containing the xy-coordinates of the intersection points. In case of no intersection, the function tells the user

Examples

 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")

Example output


LearnGeom documentation built on July 14, 2020, 5:06 p.m.