See a method of Craige_Hales: Smallest Covering Circle But I still haven't learned.My need is to determine a circle by the first three points.And then determine if the fourth point is on the circle.
So how to write JSL?
Thanks Experts!
@Craige_Hales solution at your link above does all the hard work, and it calculates 'center' and 'radius' for the circle. So, if you want to test a specific point, you could add something like this to his code:
// Test if a specific point is on the circle (in this case, the origin) myPoint = Transpose([0, 0]); myPointShifted = myPoint - center; myDistance = Sqrt(myPointShifted[1]^2 + myPointShifted[2]^2); tol = 1E-6; if(abs(myDistance - radius) <= tol, Print("Point is on the circle"), Print("Point is not on the circle") );
See if Circle through three points is the answer.
Yes, thanks to Craige_Hales for doing so much work.Thanks for ian help!
I tried to modify the code to change the number of points generated in line 1 to three.I found that this code only drew the circle with the largest diameter.
I really don't know how to modify it so that the circle is determined by A, B and C at the same time.So I still need help.
That's a good question.I tried the new method provided by @Craige_Hales ( Circle through three points ) , combined with the ian_jmp'code. But it doesn't get the job done.
Can @ian_jmp modify the following code according to the new code of Craige_Hales?Thank you very much!
As mentioned in my post, the first post from @Craige_Hales calculates the variables 'center' and 'radius' and my code snippet above uses these.
His new code contains these lines (near the very end):
// choose distance to A, could use B or C too... Circle( {xc, yc}, Sqrt( (xc - ax) ^ 2 + (yc - ay) ^ 2 ) );
Looking in 'Help > Scripting Guide' for 'Circle', you will see that '{xc, yc}' are the coordinates of the center and the result of the 'Sqrt()' operation is the radius (of the circle that's currently drawn).
OK、Thanks!
Circle( {20, 20}, 4, 7, 10/* no fill for concentric circles */ );