kgoossens Posted January 6, 2012 Share Posted January 6, 2012 Hi everbody, I'm trying to remove the inverted parts of a self intersecting polygon procedurally. I've gotten a bit further using the triangulate2d provided in the example. It works in many cases, but not all. And I need it to be rock solid. Thanks in advance! SolvingComplexPolygons_01.hipnc Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted January 6, 2012 Share Posted January 6, 2012 Why are they being created? Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 6, 2012 Author Share Posted January 6, 2012 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 Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted January 6, 2012 Share Posted January 6, 2012 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. Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 6, 2012 Author Share Posted January 6, 2012 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. Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted January 6, 2012 Share Posted January 6, 2012 (edited) 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 January 6, 2012 by Erik_JE Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 6, 2012 Author Share Posted January 6, 2012 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 Quote Link to comment Share on other sites More sharing options...
zarti Posted January 6, 2012 Share Posted January 6, 2012 here is my suggestion hoping that it works for other self intersecting paths . SolvingComplexPolygonz_01.hipnc Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 6, 2012 Author Share Posted January 6, 2012 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... Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted January 7, 2012 Share Posted January 7, 2012 (edited) EDIT: Nevermind. Offtopic: Is it possible to delete a post? Edited January 7, 2012 by Erik_JE 1 Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 12, 2012 Author Share Posted January 12, 2012 (edited) Anyone with other ideas? Edited January 12, 2012 by kgoossens Quote Link to comment Share on other sites More sharing options...
Erik_JE Posted January 12, 2012 Share Posted January 12, 2012 Unfortunatly no but I am really interested in seeing a working solution. Quote Link to comment Share on other sites More sharing options...
Macha Posted January 12, 2012 Share Posted January 12, 2012 (edited) 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 January 13, 2012 by Macha 1 Quote Link to comment Share on other sites More sharing options...
zarti Posted January 12, 2012 Share Posted January 12, 2012 i am unable to 'totally convince' the Triangulate2d SOP but if you can make it then , this should work imho ; SolvingComplexPolygonz_02.hipnc Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 13, 2012 Author Share Posted January 13, 2012 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 Quote Link to comment Share on other sites More sharing options...
Macha Posted January 13, 2012 Share Posted January 13, 2012 (edited) 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 January 13, 2012 by Macha Quote Link to comment Share on other sites More sharing options...
zarti Posted January 13, 2012 Share Posted January 13, 2012 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 =) Quote Link to comment Share on other sites More sharing options...
petz Posted January 13, 2012 Share Posted January 13, 2012 can´t you just use the sort-sop and sort the points by vertex-order for this? petz Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 13, 2012 Author Share Posted January 13, 2012 I've added a explaining what I'd like to achieve and showing the problems that I encounter. Hopefully this communicates better. Cheers already for the help I've received!! Quote Link to comment Share on other sites More sharing options...
petz Posted January 13, 2012 Share Posted January 13, 2012 have a look at the file at the bottom of this thread. would that do what you need? petz Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.