Circles of given radius through two points: Difference between revisions
Content added Content deleted
(Add Seed7 example) |
Alpha bravo (talk | contribs) No edit summary |
||
Line 20: | Line 20: | ||
;Ref: |
;Ref: |
||
* [http://mathforum.org/library/drmath/view/53027.html Finding the Center of a Circle from 2 Points and Radius] from Math forum @ Drexel |
* [http://mathforum.org/library/drmath/view/53027.html Finding the Center of a Circle from 2 Points and Radius] from Math forum @ Drexel |
||
=={{header|AutoHotkey}}== |
|||
<lang AutoHotkey>CircleCenter(x1, y1, x2, y2, r){ |
|||
d := sqrt((x2-x1)**2 + (y2-y1)**2) |
|||
x3 := (x1+x2)/2 , y3 := (y1+y2)/2 |
|||
c1 := x3 + sqrt(r**2-(d/2)**2)*(y1-y2)/d "," y3 + sqrt(r**2-(d/2)**2)*(x2-x1)/d |
|||
c2 := x3 - sqrt(r**2-(d/2)**2)*(y1-y2)/d "," y3 - sqrt(r**2-(d/2)**2)*(x2-x1)/d |
|||
return c1 "`n" c2 |
|||
}</lang> |
|||
Examples:<lang AutoHotkey>MsgBox % CircleCenter(0.1234, 0.9876, 0.8765, 0.2345, 2)</lang> |
|||
Outputs:<pre>1.863112,1.974212 |
|||
-0.863212,-0.752112</pre> |
|||
=={{header|C}}== |
=={{header|C}}== |