
Last chance! 50% off unlimited learning
Sale ends in
Calculates the area of the intersection between a rectangle and and circle.
circleBoxInt(R, S, L, ...)
Numeric value
Numeric, circle radius.
Numeric, short side of the rectangle
Numeric, long side of the rectangle
Currently ignored.
The rectangle is defined with lower left corner being the origin and upper right corner at (L, S). The area returned is the intersection between the circle, centered at the origin, and the rectangle.
If
If
If
if S
, the second set is the area below B
. Substracting the two gives the area between B
and S
. The rectangle defined by B
and L
needs to be added back in.
radius <- 115
short <- 80
long <- 100
circleBoxInt(R=radius,S=short,L=long)
## not run
## the integral is the area inside the polygon
# \donttest{
x <- seq(0,max(radius,long),length=100)
outlineY <- function(x,R,S,L){
suppressWarnings(y <- sqrt(R^2-x^2))
y[x>R] <- 0
y[x>L] <- 0
y[y>=S] <- S
return(y)
}
y <- outlineY(x=x,R=radius,S=short,L=long)
plot(x,y,type='l',ylim=c(-10,short))
text(long,0,label='L',pos=1)
text(0,short,label='S',pos=1)
text(long,sqrt(radius^2-long^2),label='B',pos=4)
# }
Run the code above in your browser using DataLab