Luke
Luke

Reputation: 8407

Distance to Circle Center JS

Ok I my math is quite bad... Though, can anybody tell me some formula with which I get following? Any resources would be great too

I have a circle where I know the radius. And I have a chord where I only know the length of it. I now need to know the distance between the center of the circle and the center of the chord.

Any help is great for me!

Upvotes: 2

Views: 848

Answers (1)

andrew cooke
andrew cooke

Reputation: 46892

it would be Math.sqrt(r*r - d*d/4) where r is the radius and d is the length of the chord.

you can see this if you draw the line from the circle centre to the chord midpoint. from symmetry the line must join at a right angle, so you have a right angle triangle (hypotenuse length r, one side length d/2), and the above comes from pythagoras.

Upvotes: 5

Related Questions