Wow.
I sure do like to complicate things.
New method:
- (defun AreaCalc ( r / x1 x2 ) (setq x1 (- 1 (* 2 r)) x2 (sqrt (+ (* (- r 4) r) 2)) ) (- x1 (* 0.5 x1 x1 (/ (- x2 r) (+ x2 r)))))
The method derives from the curious fact that the area of the oversized triangle (derived from the diagonals of the unit square and radius as suggested by Sean above) is equal to 1-2r which just so happens to be the length of a side of the smaller triangle (derived from Pythagoras on the oversized right-angled triangle):
This elegance is somewhat spoiled however by the method to calculate the area of the smaller triangle, since the sides of the oversized triangle are used in the calculation, which introduces ugly square roots. I strived for quite a while to find a method which didn't involve trig on the interior angle of the smaller triangle and hence retain the elegance of the solution. |