Circles of given radius through two points: Difference between revisions
Circles of given radius through two points (view source)
Revision as of 10:43, 7 April 2024
, 2 months ago→{{header|11l}}: make Error a non-fatal exception
Alextretyak (talk | contribs) m (→{{header|11l}}: X.throw) |
Alextretyak (talk | contribs) (→{{header|11l}}: make Error a non-fatal exception) |
||
Line 50:
.msg = msg
F circles_from_p1p2r(p1, p2, r) X(Error)
‘Following explanation at http://mathforum.org/library/drmath/view/53027.html’
I r == 0.0
X
V (x1, y1) = p1
V (x2, y2) = p2
I p1 == p2
X
V (dx, dy) = (x2 - x1, y2 - y1)
V q = sqrt(dx ^ 2 + dy ^ 2)
I q > 2.0 * r
X
V (x3, y3) = ((x1 + x2) / 2, (y1 + y2) / 2)
V d = sqrt(r ^ 2 - (q / 2) ^ 2)
Line 81:
V (c1, c2) = circles_from_p1p2r(p1, p2, r)
print(" #.\n #.\n".format(c1, c2))
X.
print(" ERROR: #.\n".format(v.msg))</syntaxhighlight>
|