[Haskell-cafe] Geometry

Steve Schafer steve at fenestra.com
Sun Aug 26 21:30:30 EDT 2007

On Mon, 27 Aug 2007 11:04:58 +1000, you wrote:

>Hash: SHA1
>I went camping on the weekend and a friend of mine who is a builder
>asked me many questions on geometry as they apply to his every day work
>- - most of which I could answer.
>However, there was one that I couldn't and I am having trouble googling
>a solution (for lack of keywords?). I'm hoping a fellow Haskeller could
>help me out (in Haskell of course).
>The problem is finding the unknown x from the two knowns a and b in the
>given image below (excuse my Microsoft Paintbrush skills). I may have
>misunderstood his problem (we were drawing in dirt) and actually, it is
>the straight line between the two points on the circumference that are
>known and not the specified 'b', but I figure I could derive one
>solution from another if I have misunderstood him.
>Here is my image:
>Thanks for any tips or keywords with which to google!

So a is the radius of the circle, and b is half the length of the chord.

From basic trigonometry:

 b = a * sin @

where @ is half of the angle between the two radii as drawn in the


 x = a * (1 - cos @)

Using the trigonometric identity sin^2 @ + cos^2 @ = 1 and rearranging,
we get:

 x = a - sqrt(a^2 - b^2)

I don't know offhand if there's a straightforward way to arrive at this
result without using trigonometry.

By the way, I found http://www.1728.com/circsect.htm by Googling height

Steve Schafer
Fenestra Technologies Corp.

More information about the Haskell-Cafe mailing list