circleBoxInt {windAC}R Documentation

Integration of the intersection of a rectangle and a circle

Description

Calculates the area of the intersection between a rectangle and and circle.

Usage

circleBoxInt(R, S, L, ...)

Arguments

R

Numeric, circle radius.

S

Numeric, short side of the rectangle

L

Numeric, long side of the rectangle

...

Currently ignored.

Details

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 R \leq S then (\pi R^2)/4 is returned.

If R \geq \sqrt{S^2 + L^2} then L*S is returned.

If R \leq L then R^2*sin^{-1}(S/R)/2 + S*\sqrt(R^2-S^2)/2 This is the area of a circle in the first quadrant between the horizontial line y=S

if R > L and R < \sqrt{S^2 + L^2} then

(R^2*sin^{-1}(S/R)/2 + S*\sqrt(R^2-S^2)/2) - (R^2*sin^{-1}(B/R)/2 + S*\sqrt(R^2-B^2)/2) + B*L

where B = \sqrt{R^2 - L^2}. In this case the there is part of the circle to the right of the rectangle. First set of parenthesis is the area of the circle below 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.

Value

Numeric value

Examples


radius <- 115
short <- 80
long <- 100
circleBoxInt(R=radius,S=short,L=long)

## not run
## the integral is the area inside the polygon

 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)


[Package windAC version 1.2.10 Index]