[Closed] arc between two points?
Say I have three points [0,0] [30,20] [25,-5]
How can I find the center and radius of the circle?
I’m having a tough time wrapping my head around the math for it.
http://www.had2know.com/academics/circle-through-three-points.html
In the end I’m just trying to write a function that I can pass three points and it return me the radius and center of the circle. Kinda like
fn calcCircle A:[0,0] B:[0,0] C:[0,0] =
(
return #(radius,center)
)
In the end I’m just trying to write a function that I can pass three points and it return me the radius and center of the circle. Kinda like
fn calcCircle A:[0,0] B:[0,0] C:[0,0] =
(
return #(radius,center)
)
I find correct radius of in circle but incenter position is not good.
Example:
delete objects
spl = splineshape()
addNewSpline spl
addKnot spl 1 #corner #line [-50,-30,0]
addKnot spl 1 #corner #line [0,100,0]
addKnot spl 1 #corner #line [60,40,0]
close spl 1
spl.pivot = spl.center
updateshape spl
p1 = getknotpoint spl 1 1
p2 = getknotpoint spl 1 2
p3 = getknotpoint spl 1 3
A = distance p1 p2
B = distance p2 p3
C = distance p1 p3
S = (A+B+C)/2
P = sqrt(S*(S-A)*(S-B)*(S-C))
circle_radius = P/S
circle_center = ((p1+p2+p3)/(A+B+C))*spl.transform
circle pos:circle_center radius:circle_radius
Have a look at createCircumcircle function in CAD Circle (needs barycentricToWorld to work, you can ignore the rest).
It’s my substitution to the wiki/mathworld formulas here ((lenght vec)^2 to be more specific) but originally I got it from some presentation of usefulness of dot product in 3d graphics.
that’s why i liked it… because the length is sqrt(xx + yy + z*z) or sqrt(dot vec vec)… cool