Jump to content

Smallest-circle problem to bound points?


probiner

Recommended Posts

I was expecting the input on the Sphere SOP to allow me to get the smallest bounding sphere of a mesh (in this case a polygon). But that's not what I'me getting the the picture below, even with Accurate Bounds turned on.

2xZEDHu.png


So is there any known solution for this sort of problem?
Here, since 2D, smallest circle problem:

 

300px-Smallest_circle_problem.svg.png
Scene: 
PRB_Bound_Sphere.hipnc

Cheers
 

Edited by probiner
Link to comment
Share on other sites

hmm...if you chuck in a box/bound as a 'middleman', the circle/sphere tightens a bit to a better fit...but still not perfect...I'm surprised for such a powerful s/w....it can't even do a proper smallest circle containing points ? what's going on...there's no sim, just calculations, why doesn't it just works 'out of the box' ?

Link to comment
Share on other sites

I also got something close, but I highly doubt that this approach is recommendable.. :unsure: It involves scattering more points to the polygon.

image.png.e568f013a083e8540c7569289c7a3c1c.png

PRB_Bound_Sphere_v2.zip

 

I'm also curious about this as well.
I would like to try and play around this a bit more later when I have time.

Edited by galagast
Link to comment
Share on other sites

@Noobini
While I'm dealing with n-gons here, in the example of a triangle it's easy to see that the centroid and the circumcenter are different.
The Bound SOP does the same thing as the Sphere Input :/
euler.line.gif


@galagast
I tried to scatter points but the result was the same, did you turn off Accurate Bounds? Because when I did it looks likes your, but one of the tips comes out.
I think with Accurate Bounds off the center found is the Centroid.
XYdA4bs.png

 

I'm trying to use this for n-gons to find the center of the smallest circle that bounds all the points and rotate the n-gon about it.

But I guess it's a harder problem then I thought.
 

Edited by probiner
Link to comment
Share on other sites

@pusat
That is cool! Learned quite a few new tricks from that HDA. Thank you!

@probiner
Interestingly, this problem can really be tricky, the wiki entry proposed some solutions of varying accurateness. Most of which goes way over my head.
Anyways, thank you for the link. I used the python code from that website and added additional code to process and create the circle. Everything is now inside a single Python SOP. Here's the latest result:

image.png.86a0cb89e002264678056d84ea7071a3.png

PRB_Bound_Sphere_v3.zip

Although, it currently expects a flattened n-gon, I didn't include an automatic way to transform it flat on the XZ plane (Animatrix's MinimumCircle SOP seems to have one).

  • Like 1
Link to comment
Share on other sites

@galagast
Thanks, glad the link was of use. It seems indeed surprisingly tricky.

I know one day I'll wonder about bound sphere, but for now I'll just take the wins of the table and ride to the sunset, since it's what I need for my current problem :lol:

Thanks guys

PRB_Bound_Sphere_v4.hipnc

Edited by probiner
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...