Jump to content

Solving complex polygon reverse winding


kgoossens

Recommended Posts

Why are they being created?

The polygons are being created from a sequence of lines that have a specific order. Using the curvesect in a forloop these ordered curves are brought to their appropriate lenghts so I can create a closed polygon. The process I'm using sometimes will result in self intersecting polygons.

The scene I've added shows such a situation of lines.

LinesResultingInCompPolygons_01.hipnc

Link to comment
Share on other sites

Is there some attribute that describes what polygons that are "correct"? I have a hard time figuring out how to decide what the correct result should actually be.

I think tho that the correct way of getting the polygons you wan't is to find out what makes them correct and not by throwing random nodes at it.

Link to comment
Share on other sites

Is there some attribute that describes what polygons that are "correct"? I have a hard time figuring out how to decide what the correct result should actually be.

I think tho that the correct way of getting the polygons you wan't is to find out what makes them correct and not by throwing random nodes at it.

The correct polygons are the ones that would have a clock wise point order. Or the ones with upfacing normals. The counter clockwise or downfacing normal polygons should be removed.

The triangulate 2d is cutting the polygons in a correct way but seems to change the winding order. The "random nodes" are an attempt to retreive the winding order.

Link to comment
Share on other sites

The correct polygons are the ones that would have a clock wise point order. Or the ones with upfacing normals. The counter clockwise or downfacing normal polygons should be removed.

The triangulate 2d is cutting the polygons in a correct way but seems to change the winding order. The "random nodes" are an attempt to retreive the winding order.

Sorry, didn't mean it to sound like that. Just trying to grasp what the desired output is.

Could you quickly describe what the foreach after the triangulate2d and divide node in the SolvingComplexPolygons_01.hipnc does?

EDIT: Is the the point number order important after the correct polygons are created?

Edited by Erik_JE
Link to comment
Share on other sites

Sorry, didn't mean it to sound like that. Just trying to grasp what the desired output is.

Could you quickly describe what the foreach after the triangulate2d and divide node in the SolvingComplexPolygons_01.hipnc does?

EDIT: Is the the point number order important after the correct polygons are created?

Added a new scene with a more complex polygon and better explanation inside the forloop.

SolvingComplexPolygons_02.hipnc

Link to comment
Share on other sites

here is my suggestion hoping that it works for other self intersecting paths .

Thanks zarti! It is an interesting approach but it doesn't seem to be very stable. But it is also a good example of what I'd like to achieve. I'm really breaking my head over this already for a few days... :angry:

Link to comment
Share on other sites

Sorry if I'm jumping in here. I don't fully understand what you are trying to do, but does it boil down to finding if a polygon goes around clock or anticlockwise?

If so, then you are basically trying to find the handedness of a cyclic directed graph. If I am not mistaken you can do that by getting the 3 point positions in a vopsop (or even more, they dont have to be triangles, but then you'd need python) and setting them as the rows of a matrix3. Take the determinant of that, the sign of which will tell you if the loop goes around one way or the other.

I think its best if the points don't lie on one of the coordinate system's planes as you'd get accuracy problems.

Edited by Macha
  • Like 1
Link to comment
Share on other sites

Sorry if I'm jumping in here. I don't fully understand what you are trying to do, but does it boil down to finding if a polygon goes around clock or anticlockwise?

If so, then you are basically trying to find the handedness of a cyclic directed graph. If I am not mistaken you can do that by getting the 3 point positions in a vopsop (or even more, they dont have to be triangles, but then you'd need python) and setting them as the rows of a matrix3. Take the determinant of that, the sign of which will tell you if the loop goes around one way or the other.

I think its best if the points don't lie on one of the coordinate system's planes as you'd get accuracy problems.

Hi Macha,

That is indeed what it comes down to basically. What I'm doing is something similar, I think, where I take the normal of a point aiming to the next point. And making a cross product of the points normal with the next point normal. the positive or negative sign of the cross product determines the winding then. But the problem was however that the triangulate is messing up the point order. But I've gotten a lot further right now because the triangulate2d does keep the point order of the original points. So I'm making now comparisons of the winding order between the pre and post triangulated version.

Hi Zarti thanks!

But I think that curvesect is to be avoided since it isn't working at all times. But I'm still struggeling with the example you've given. Getting closer to the solution! :)

SolvingComplexPolygons_08.hipnc

Link to comment
Share on other sites

Just wondering: the point order is messed up, but is the vertex order still the same?

How about storing point id, then attribute transferring then and use a sort. Something like that. Just thinking aloud, I'm only following this thread half-eyed!

Edited by Macha
Link to comment
Share on other sites

hi kgoossens ,

curvesect isnt failing in my extreme testings . can you post a non-working curve example ?

anyway , as i said , but was a bit not clear with the :

i am unable to 'totally convince' the Triangulate2d SOP

is the fact the triangulate2d jumps / changes its solution if lets say a point goes near an edge .

if you drag a point of curve near any other point it respects more the original shape . ( maybe a hint ?? )

i do not know if there is a solution to make the triangulate solution , more consistent .. or more High Fidelity =)

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