Jump to content

Find Points Direction?


symek

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 years later...

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