placing points at circumcenter of triangles - script?

Next
 From:  futagoza (STEFAN)
4833.1 
Hello Michael and all,

i like to create Voronoi structures on solids or surfaces, made out of triangles, and would like to know if it's possible to place points on each triangles circumcenter via a script. I can do this manually, since MoI provide all the tools, but it's pretty time consuming to do this by hand, if you have lots of triangles.

Any help would be greatly appreciated!

Sincerely,
Stefan

P.S. and please can somebody point me to the thread were Michael posted a script, which connects points with a line. I searched and searched and can't find it again. Thank you!

EDITED: 5 Jan 2012 by STEFAN

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4833.2 In reply to 4833.1 
Hi Stefan - I cooked up one attempt which is attached. To install it unzip it and copy the 2 files into the \commands sub-folder underneath MoI's main installation folder. That will then make a new Circumcenter command available to MoI to run - set up a keyboard shortcut with that as the command name to trigger it.

It expects to have input in the form of a bunch of separate individual line segments that touch at their endpoints to form a triangle structure like this:



So those are not joined to each other, they are a bunch of separate lines.

Select those before you run the command and it will generate a point at the center of the circle that goes through each triangle's vertices:



Let me know if it doesn't seem to work properly, it is not tested too much.

It just works by getting the endpoints of whatever curves were selected, it doesn't actually check if they are lines or not.

It's kind of brute force and a bit sluggish but it should still beat creating them by hand by a long shot. :)

EDIT: Updated it with a new attachment - the new version can take either lines or solids made up of triangular faces for the selection - the solids method is much faster and should work better for processing a larger amount of stuff all in one go. To use the solids method select the whole solid itself, not its edges.

- Michael

EDITED: 5 Jan 2012 by MICHAEL GIBSON


  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4833.3 In reply to 4833.1 
Hi Stefan,

> P.S. and please can somebody point me to the thread
> were Michael posted a script, which connects points with a
> line. I searched and searched and can't find it
> again. Thank you!

A good place to look is Petr's page here:
http://kyticka.webzdarma.cz/3d/moi/

I think the one you want is the "ConnectPoints" one that has a link from there, the original message is here:
http://moi3d.com/forum/display.php?webtag=MOI&msg=2749.56

Hope those help!

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  futagoza (STEFAN)
4833.4 
Hi Michael,

thank you so much for providing a solution so quickly. I just did a quick test like your example and it works fine. However when trying to bring in a low poly triangulated mesh via your obj2line converter the script can't handle the amount of lines not, if i select all of the lines, forming the object.

Whenever you have a bit time, you may look at the provided sample which i tried. It's the Stanford Bunny low poly mesh.

Thanks again for your script
and best regards

Stefan
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  futagoza (STEFAN)
4833.5 
Hi Michael,

just a quick update on my attempts. I bring in now low poly meshes via Houdini Apprentice as iges file, which allow me to see better what i'm doing. In combination with your superb script it's now a very pleasant and easy workflow! :-)

Thank you very much again for making this script!

Best regards
Stefan


Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
4833.6 In reply to 4833.5 
What do make after with these points ?
---
Pilou
Is beautiful that please without concept!
My Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  futagoza (STEFAN)
4833.7 In reply to 4833.6 
Hi Pilou,

the purpose of this is to connect later the points with lines and then make from the lines surfaces, so that i have an(y) object i like to make, made out of a Voronoi structure. You know, the nice works Jotero often does.

Regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
4833.8 In reply to 4833.7 
So another script or this one is already existing ?
---
Pilou
Is beautiful that please without concept!
My Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4833.9 In reply to 4833.4 
Hi Stefan,

> However when trying to bring in a low poly triangulated
> mesh via your obj2line converter the script can't handle the
> amount of lines not, if i select all of the lines, forming the
> object.

Yeah unfortunately the script uses a brute force method of scanning to find which lines share endpoints, and this simple method is not suited for dealing with very many lines at a single time, you'll probably need to select them in batches of 30 or so at a time.

It could be possible to speed it up by a large amount, by using spatial data structures to help avoid the large number of point comparisons but unfortunately that would require a significant amount of development work in order to accomplish that.

I've attached one slight improved version that at least stops scanning when it finds a triangle, the original version actually kept scanning until it had done the full triple nested loop. EDIT: actually the new version was buggy and would miss some so I removed it.

- Michael

EDITED: 5 Jan 2012 by MICHAEL GIBSON

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4833.10 In reply to 4833.5 
Hi Stefan,

> just a quick update on my attempts. I bring in now low poly
> meshes via Houdini Apprentice as iges file, which allow me to
> see better what i'm doing.

If you have triangular faces instead of just lines, I can probably make a much faster version that uses the face boundaries, I'll give that a try.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  futagoza (STEFAN)
4833.11 In reply to 4833.10 
Hi Michael,

Yes, i have triangular faces made and formed a solid out of them. When i imported the .iges file the object's faces came in as "Closed crv", so that i only had to use the Planar command on all of them once, and then i joined all the faces to get a solid. I only had to duplicate the Closed crv to Separate them and use them with your script. For easy identifying i used a Style on them.

Best regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4833.12 In reply to 4833.5 
Hi Stefan, I updated the attachment above (on message http://moi3d.com/forum/index.php?webtag=MOI&msg=4833.2) with a new version of the script which can now also process solids made up of triangular faces instead of just separate lines.

The solids processing should be much quicker than the "soup of lines" type processing was, so it should probably work to generate all the points for a triangularized solid all in one shot.

That version still has the same line processing in it as well, so if you want the solid processing select the entire solid and not its edges - if you select edges it will process them as a bunch of line curves same as before.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4833.13 In reply to 4833.11 
Hi Stefan,

> When i imported the .iges file the object's faces came in as
> "Closed crv", so that i only had to use the Planar command
> on all of them once, and then i joined all the faces to get a solid.

That sounds like a good process - so now with the updated Circumcenter above just select the solid that you got from the above steps and run Circumcenter and it should be able to generate all the points at a much better rate than the separate line processing version did.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  futagoza (STEFAN)
4833.14 In reply to 4833.13 
Hi Michael,

thanks again so much for your help! Much appreciated! The new script works superb and is quite fast on my machine and compared to the previous script it saves now also a lot of steps! :-)

Best regards
Stefan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
4833.15 
Tried out the circumcenter.
For obtuse triangles, the circumcenter lies outside the triangle.
For some triangles, the circumcenter lies on the triangle.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
4833.16 In reply to 4833.15 
Hi Brian, yup it's not necessarily on the interior of the triangle unlike the centroid.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Message 4833.17 deleted 7 Sep 2015 by PILOU
 

Reply to All Reply to All