I'm struggling to convert the formula from this article and translate it into Python, or any code for that matter, mainly because I find it hard to read math equations. Ideally, given the positions of A , B and C , find out the radii a' , b' and c' for the image on the left. Any help would be really apprciated.
If the vertex coordinates are (xa, ya)
for point A
, (xb, yb)
for point B
, and (xc, yc)
for point C
, you could use
a = math.sqrt((xb - xc)**2 + (yb - yc)**2)
b = math.sqrt((xa - xc)**2 + (ya - yc)**2)
c = math.sqrt((xb - xa)**2 + (yb - ya)**2)
ra = (b + c - a) / 2
rb = (c + a - b) / 2
rc = (a + b - c) / 2
and the desired radii are in ra, rb, rc
. (I don't know how to translate a'
etc. into Python so I used ra
etc.) Values a, b, c
are the lengths of the sides of the triangle. Note that I changed the formulas slightly from your linked article, to make them more symmetrical and pleasing to my eye.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.