how to get the outline of two partly overlapping polygons

   14035   13   3
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
suppose you have two polygons and part of them are overlapping.

how to get the outline as defined by these two partly overlapping polygons?

Thanks!
User Avatar
Member
53 posts
Joined: Oct. 2010
Offline
Maybe using a boolean cookie crease, and then convert to a poly or nurbs curve.
Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles,
And by opposing end them?
User Avatar
Member
257 posts
Joined: Nov. 2007
Offline
How accurate does this need to be?
I have had to approximate shapes in the past and I used a “circle/sphere shrinking” approach.
You basically put a low resolution polysphere around your objects, snap them to the object with a ray sop, subdivide, snap them again with a ray sop, subdivide, snap them again… In 2D you use a circle.
This will give you an approximate shape, like a rough collision mesh.

If you want high accuracy I think you will have to experiment with the clip sop and with the new geometry clipping nodes in h11 (the ones to do the voronoi type clipping).
Cg Supervisor | Effects Supervisor | Expert Technical Artist at Infinity Ward
https://www.linkedin.com/in/peter-claes-10a4854/ [www.linkedin.com]
User Avatar
Staff
1182 posts
Joined: July 2005
Offline
If they are both on the same plane then you can use the cookie sop and set it to intersect. Make sure they are merged into the same object.

if they are in separate objects then you can use the boolean tool on the Model shelf - it will set up the cookie and merge the nodes for you.

Robert
Robert Magee
Senior Product Marketing Manager
SideFX
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
Thank you, guys!

I've tried the methods suggested by you but still can't figure it out.

Please refer to the hip file attachted.

As shown in the image, what I want to get is the precise shape on the right which is the outline of the three overlapping plannary polygons on the left.

Can you help to advize on how to do this?

Thanks again!

Attachments:
get_outline.png (9.5 KB)
get_outline.hipnc (36.5 KB)

User Avatar
Member
257 posts
Joined: Nov. 2007
Offline
This is using that circle fitting technique. Doesn't work with every shape, but most convex shapes should be fine and even concave shapes that are not to extreme should work too.
In this case it is fairly exact, but a bit more computationally expensive then perhaps other techniques.

Attachments:
get_outline_02.hipnc (63.0 KB)

Cg Supervisor | Effects Supervisor | Expert Technical Artist at Infinity Ward
https://www.linkedin.com/in/peter-claes-10a4854/ [www.linkedin.com]
User Avatar
Staff
2595 posts
Joined: July 2005
Offline
oat
Thank you, guys!

I've tried the methods suggested by you but still can't figure it out.

Please refer to the hip file attachted.

As shown in the image, what I want to get is the precise shape on the right which is the outline of the three overlapping plannary polygons on the left.

Can you help to advize on how to do this?

Thanks again!

Try the “Remove shared edges” option in the divide SOP.

Attachments:
internal-edges.hip (42.9 KB)

User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
Dear Mark and pclaes, Thanks for your kind help!

I've tried both of your methods but neither seems to work when more overlapping polygons are added.

Please refer to the hip file attached.

Hope you can help to suggest a general solution to solve this problem.

really appreciate!

Attachments:
get_outline_04.hipnc (68.8 KB)

User Avatar
Staff
1182 posts
Joined: July 2005
Offline
Attached is a network with several cookies which are then merged and fused then interior edges are removed to give you your outline. This is a working solution to this particular problem (three overlapping shapes) - as you add more and more shapes, this solution would become unwieldy…

Attachments:
get_outline_cookies.hipnc (50.3 KB)

Robert Magee
Senior Product Marketing Manager
SideFX
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
dear experts, It seems that no easy solution is available to get the outline of a series of partly overlapping polygons.

The following image and hip file indicate my intention.

What I want to get is the polygon to the right based on the polygons to the left independent on how these polgyons may overlap.

Can you help to suggest a general and efficient way to achieve this?

Thanks in advance!

Attachments:
get_outline_v05.hipnc (69.7 KB)
outline.png (11.1 KB)

User Avatar
Member
1192 posts
Joined: July 2005
Offline
Curvesect SOP seems closest to what you want, but it will not work in general cases. Maybe inside a Foreach?

D
Dragos Stefan
producer + director @ www.dsg.ro
www.dragosstefan.ro
User Avatar
Member
8605 posts
Joined: July 2007
Offline
here is an example using foreach and cookie node
it should work ok for multiple primitives but not for every case because it's using cookie
but if not working properly you can use Do Jitter parameter on cookie and/or change order of primitives or upscale geometry before processing then downscale after

Attachments:
foreach_cookie_outline.hipnc (92.8 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
deat tamte,

thank you so much for the solution!!!

The approach you suggested works for most of the cases except for the situation as shown in the attached hip file when we bypassed one of the polygons (curve 2).

Can you help to take a look of this case?

Also can you kindly explain a little bit the rationale of the vex sop you developed?

Thank you!!!

Attachments:
foreach_cookie_outline_195.hipnc (118.6 KB)

User Avatar
Member
8605 posts
Joined: July 2007
Offline
for that case turn off Do Jitter on cookie1 inside the for loop
i am sorry but there is no 100% solution if you use Cookie SOP, but with minor tweaks you can make it work
re-read the suggestion i gave in my previous post how you can troubleshoot
so for this case turning off Do Jitter works as well as appending Sort SOP right after merge1 and setting it to Primitive Random and seed to 3
or just change order of inputs in merge1 to working one, but it's easier by changing seed in Sort SOP

the VEX is just checking if the angle between two edges that belong to each point is almost 180° (within tolerance) and therefore if the point lies on straight line and can be removed
then blast node removes all those points and thus optimizes resulting polygon curve
(it works only with closed polygon curves so that every point has exactly 2 edges, but this is your case i presume)
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links