Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Level VII

## How does JSL calculate whether the fourth point is on the same circle as the first three points?

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!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Staff

## Re: How does JSL calculate whether the fourth point is on the same circle as the first three points?

@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;
Print("Point is on the circle"),
Print("Point is not on the circle")
);``````
Highlighted
Staff (Retired)

## Re: How does JSL calculate whether the fourth point is on the same circle as the first three points?

See if Circle through three points is the answer.

Craige
6 REPLIES 6
Highlighted
Staff

## Re: How does JSL calculate whether the fourth point is on the same circle as the first three points?

@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;
Print("Point is on the circle"),
Print("Point is not on the circle")
);``````
Highlighted
Level VII

## Re: How does JSL calculate whether the fourth point is on the same circle as the first three points?

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.

Thanks Experts!

Highlighted
Staff (Retired)

## Re: How does JSL calculate whether the fourth point is on the same circle as the first three points?

See if Circle through three points is the answer.

Craige
Highlighted
Level III

## Re: How does JSL calculate whether the fourth point is on the same circle as the first three points?

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!

Highlighted
Staff

## Re: How does JSL calculate whether the fourth point is on the same circle as the first three points?

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).

Highlighted
Level III

## Re: How does JSL calculate whether the fourth point is on the same circle as the first three points?

OK、Thanks!

``Circle( {20, 20}, 4, 7, 10/* no fill for concentric circles */ );``
Article Labels

There are no labels assigned to this post.