Changes between Initial Version and Version 1 of Ticket #3099, comment 3
- Timestamp:
- 11/17/15 06:39:08 (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #3099, comment 3
initial v1 17 17 p3y=6677883.0245000003[[BR]] 18 18 19 temp = p2x *p2x + p2y*p2y[[BR]]20 bc = (p1x *p1x + p1y*p1y - temp) / 2.0[[BR]]21 cd = (temp - p3x *p3x - p3y*p3y) / 2.0[[BR]]22 det = (p1x - p2x) *(p2y - p3y)-(p2x - p3x)*(p1y - p2y)[[BR]]19 temp = p2x^^*p2x + p2y^^*p2y[[BR]] 20 bc = (p1x^^*p1x + p1y^^*p1y - temp) / 2.0[[BR]] 21 cd = (temp - p3x^^*p3x - p3y^^*p3y) / 2.0[[BR]] 22 det = (p1x - p2x)^^*(p2y - p3y)-(p2x - p3x)^^*(p1y - p2y)[[BR]] 23 23 det = 1.0 / det[[BR]] 24 cx = (bc *(p2y - p3y)-cd*(p1y - p2y))*det[[BR]]25 cy = ((p1x - p2x) *cd-(p2x - p3x)*bc)*det[[BR]]26 cr = math.sqrt((cx-p1x) *(cx-p1x)+(cy-p1y)*(cy-p1y))[[BR]]24 cx = (bc^^*(p2y - p3y)-cd^^*(p1y - p2y))^^*det[[BR]] 25 cy = ((p1x - p2x)^^*cd-(p2x - p3x)^^*bc)^^*det[[BR]] 26 cr = math.sqrt((cx-p1x)^^*(cx-p1x)+(cy-p1y)^^*(cy-p1y))[[BR]] 27 27 28 28 print("Center({0:f},{1:f}), radius({2:f})".format(cx,cy,cr)) … … 36 36 made by Roger Stafford[[BR]] 37 37 38 import math 39 import sys 38 import math[[BR]] 39 import sys[[BR]] 40 40 41 41 x1=25493284.831099998[[BR]] … … 50 50 x31 = x3-x1[[BR]] 51 51 y31 = y3-y1[[BR]] 52 h21 = x21 **2+y21**2[[BR]]53 h31 = x31 **2+y31**2[[BR]]54 d = 2 *(x21*y31-x31*y21)[[BR]]55 a = x1+(h21 *y31-h31*y21)/d[[BR]]56 b = y1-(h21 *x31-h31*x21)/d[[BR]]57 r = math.sqrt(h21 *h31*((x3-x2)**2+(y3-y2)**2))/abs(d)[[BR]]52 h21 = x21^^*^^*2+y21^^*^^*2[[BR]] 53 h31 = x31^^*^^*2+y31^^*^^*2[[BR]] 54 d = 2^^*(x21^^*y31-x31^^*y21)[[BR]] 55 a = x1+(h21^^*y31-h31^^*y21)/d[[BR]] 56 b = y1-(h21^^*x31-h31^^*x21)/d[[BR]] 57 r = math.sqrt(h21^^*h31^^*((x3-x2)^^*^^*2+(y3-y2)^^*^^*2))/abs(d)[[BR]] 58 58 59 59 print("Center({0:f},{1:f}), radius({2:f})".format(a,b,r))