Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RajanSky

Picking edges

This topic is 5727 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I was wondering, does anyone know how to pick an edge in OpenGL? Like, I know that you can assign a name to each polygon and then when you click on the screen, you can work backwards to figure out which polygon you clicked on, but how about clicking on an edge? This is what I''m thinking for now... Say I have a polygon, and I click on one of its edges. Then, I''ll figure out which *polygon* was clicked on, and then use that to get access to its edges, and then compute the distance to all of the polygons edges to find which one the point is closest to. I think this should work although there might be a better way to do it... Thanks! Raj

Share this post


Link to post
Share on other sites
Advertisement
Consider just clicking an edge based on the distance from its midpoint - that might ultimately make it more intuitive for the user.

Share this post


Link to post
Share on other sites
quote:

This is what I''m thinking for now... Say I have a polygon, and I click on one of its edges. Then, I''ll figure out which *polygon* was clicked on, and then use that to get access to its edges, and then compute the distance to all of the polygons edges to find which one the point is closest to. I think this should work although there might be a better way to do it...



That''s great if the user only clicks inside the polygon to select it''s edges, clicking the edge from outside is just as likely.

As mentioned above, the best way to do this will be in 3D space. First find the closest points of intersection between the eye/mouse ray and the edge, constraining it to the [0:1] interval for the edge. If the distance between these points is less than some threshold then select the edge.

Share this post


Link to post
Share on other sites
Cool, thanks for the ideas! Hmm, the ray intersection idea is awesome, though I think I''ll go for something more simple since this is just a small project that I have to finish by tomorrow hehe =)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!