Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- How does JSL calculate whether the fourth point is on the same circle as the fir...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Feb 21, 2020 12:43 AM
| Last Modified: Feb 21, 2020 12:44 PM
(2323 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

@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")
);
```

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Feb 21, 2020 9:41 AM
| Last Modified: Feb 21, 2020 12:45 PM
(2277 views)
| Posted in reply to message from lwx228 02-21-2020

6 REPLIES 6

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

@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")
);
```

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Feb 21, 2020 9:41 AM
| Last Modified: Feb 21, 2020 12:45 PM
(2278 views)
| Posted in reply to message from lwx228 02-21-2020

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Created:
Mar 4, 2020 5:37 AM
| Last Modified: Mar 4, 2020 5:51 AM
(2065 views)
| Posted in reply to message from ian_jmp 02-21-2020

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
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

Created:
Mar 4, 2020 7:10 AM
| Last Modified: Mar 4, 2020 7:12 AM
(2055 views)
| Posted in reply to message from lala 03-04-2020

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
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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.