Jump to content

Connecting the centroids of polygons adjacent to one another?


Recommended Posts

I have tried using the Connect Adjacent Pieces sop but it does not seem to be working (or I could just not be using it right). The documentation on the sop is also cryptic. Is there a way to achieve this without using this sop? I know when you use addpoint(0, @P) in a primitive wrangle that it will create a point in the center of the polygon but that point has no attribute and no way to inherent any attributes from the primitive that it is created from. There also does not seem to be a vex function that fetches the adjacent pieces of a polygon. Any help would be appreciated.

 

 

Graph_based_maze_animation.gif

Link to comment
Share on other sites

you can also promote all the primitive attributes to point attributes (after using a fuse set to unique),
use:

//run over primitives
int pt = addpoint(0, primpoint(0, @primnum, 0));
setpointattrib(0, "P", pt, v@P);//set the point location to the center primitives

this way the point should inherit at least all point attribs from the source.

you also may want to try the "compute dual" function on a divide SOP to create lines between the prim centroids.

 

Link to comment
Share on other sites

i don't think compute dual method is absolutely 100% correct...consider your diagram above...see the 3 left most points...they are not connected to each other coz the connection would cross more than 1 blue edge...using div, compute dual...you may get these unwanted connections....unless you DO want them ?

Capture.JPG

Edited by Noobini
Link to comment
Share on other sites

I didn't say the solution would be perfect :P..

that said, you could convert every edge to a primitive (using the carve sop with internal breakpoints for example)
after that you would be able to use an intersection analysis node and remove every primitive that has more than 1 intersection, to get rid of the edges marked by noobini.

Link to comment
Share on other sites

@Noobini

     You're correct. I was only using a grid that was remeshed (with varying density) as my sample geometry. I guess the only problem with using the divide sop is that it must triangulate everything. Also, this inner lattice is more for determining which primitives are next to one another rather than actually being used in the final graphics. The idea is to use this lattice along with the neighbors function. In the photo you posted the one with the arrow on the right would be okay but not the arrow on the left, unless there is a tiny shared edge i am not seeing.

 

While doing some researching I came across this thread:

 

And while it seems to be what I am trying to achieve, I cannot seem to understanding of most of it.  

Edited by PlatinumFishy
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...