symek Posted November 14, 2006 Share Posted November 14, 2006 hi, I'm struggling here with one problem not really hscript/vex related but maybe some of you can help a bit telling where to start. I'm trying to find out order in set of points in 2d space. Imagine TraceSOP work: after filtering an image and establishing point's position it has to put points to order to connect them into face, right? How such algorithm should looks like? I have, let's say, ten points in 2D space and I'd like to order them in clockwise manner? I've tried to find geometric center and measure angle between X axis and vector from center towards point's position and apply point number based on angle value but this aproach won't work for more detailed shape. Any ideas? thanks! SY. Quote Link to comment Share on other sites More sharing options...
edward Posted November 14, 2006 Share Posted November 14, 2006 I imagine that the Trace SOP has a lot more information to work with though since it can infer connectivity from the connected pixels. It sort sounds like you're solving a 2D version of the shape from surface point cloud problem (eg. laser scanned data). Unless you have good sampling (ie. lots of points), then it's probably going to be a hard problem. If you have sufficient sampling, then off the top of my head, maybe you can just connect the closest point. The best method will vary with your data. Quote Link to comment Share on other sites More sharing options...
grasshopper Posted November 14, 2006 Share Posted November 14, 2006 Try this. It uses polar co-ordinates in texture space to build an untwisted poly from randomly scattered points. Try changing the scatter number to see how it works. The points don't have to be on a plane for this to work but you do have to make sure that the texture projection is perpendicular to the points (i.e. if your points lie on or near an X,Y plane then project the texture co-ordinates along Z). Maybe it won't totally solve your problem but may get you some way there. Cheers, John make_poly_from_points.hip Quote Link to comment Share on other sites More sharing options...
symek Posted November 14, 2006 Author Share Posted November 14, 2006 hey! that's exacly the way I was planning to go! I wasn't sure if it will work. Thank you so much! cheers, sy. Quote Link to comment Share on other sites More sharing options...
grasshopper Posted November 14, 2006 Share Posted November 14, 2006 Hmmm, maybe what I posted is pretty much what you were trying anyway. Have you tried a solution based on angle together with distance? Do you have some sample date you could post? john. Quote Link to comment Share on other sites More sharing options...
symek Posted November 14, 2006 Author Share Posted November 14, 2006 No, no, the issue is that I'm planning to do it outside Houdini, but in python. I'm prototyping right now. Nothing particular to show at the moment, but you've just supprised me, because when I was trying this solution in code, it didn't give good results... maybe I made mistake somewhere. Quote Link to comment Share on other sites More sharing options...
Guest Swann Posted September 6, 2009 Share Posted September 6, 2009 (edited) Try this. It uses polar co-ordinates in texture space to build an untwisted poly from randomly scattered points. Cheers, John Hello John, Thank you very much for this example. It helped me to solve alot of problems. I'm sitting right now and watching Advanced Calculus 2/disk 3 from Math Tutor DVD. It's all about polar coordinates. I didn't knew how those values helped to sort points but now it so clear. Thank you once again. Edited September 6, 2009 by SWANN 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.