Sign in to follow this  

2D Shape approximations

This topic is 3459 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

You could create a hull from the vertex soup (Drop all vertices that are inside the shape), and then just count the number of vertices remaining. You'd need to add a certain threshold for circles though.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
You could create a hull from the vertex soup (Drop all vertices that are inside the shape), and then just count the number of vertices remaining. You'd need to add a certain threshold for circles though.


Could you elaborate on that, I don't fully understand what your suggesting, what do the remaining vertices tell me?

Cheers

Share this post


Link to post
Share on other sites
Quote:
Original post by DarkMatter2008
Quote:
Original post by Evil Steve
You could create a hull from the vertex soup (Drop all vertices that are inside the shape), and then just count the number of vertices remaining. You'd need to add a certain threshold for circles though.


Could you elaborate on that, I don't fully understand what your suggesting, what do the remaining vertices tell me?

Cheers


It's just clicked now, feeling really slow this morning. The vertices being passed would be of varying scales depending on how big the user decides to draw a shape, could I still apply this method? If the shape drawn is at a certain angle this may not work?

Share this post


Link to post
Share on other sites
Quote:
Original post by DarkMatter2008
It's just clicked now, feeling really slow this morning. The vertices being passed would be of varying scales depending on how big the user decides to draw a shape, could I still apply this method? If the shape drawn is at a certain angle this may not work?
What exactly are you trying to do? A shape with 3 vertices will always be a triangle, a shape with 4 will always be a quad, etc. Or do you want the shapes to be more like a "normal" triangle, quad, etc?

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by DarkMatter2008
It's just clicked now, feeling really slow this morning. The vertices being passed would be of varying scales depending on how big the user decides to draw a shape, could I still apply this method? If the shape drawn is at a certain angle this may not work?
What exactly are you trying to do? A shape with 3 vertices will always be a triangle, a shape with 4 will always be a quad, etc. Or do you want the shapes to be more like a "normal" triangle, quad, etc?


Well, what the user has is a free hand draw tool, which the user draws a shape. The vertices collected by that are simplified using the Douglas-Peucker line simplification algorithm, at the end of it you may have something that looks like a trianlge but may have four vertices, so counting the vertices won't really work.

Share this post


Link to post
Share on other sites
Quote:
Original post by DarkMatter2008
Well, what the user has is a free hand draw tool, which the user draws a shape. The vertices collected by that are simplified using the Douglas-Peucker line simplification algorithm, at the end of it you may have something that looks like a trianlge but may have four vertices, so counting the vertices won't really work.
You could remove vertices that have a shallow angle between the two neighboring vertices in that case. So if the angle formed by 3 vertices is less than 5 or 10 degrees, just drop it. That'll smooth out any gentle bends.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Quote:
Original post by DarkMatter2008
Well, what the user has is a free hand draw tool, which the user draws a shape. The vertices collected by that are simplified using the Douglas-Peucker line simplification algorithm, at the end of it you may have something that looks like a trianlge but may have four vertices, so counting the vertices won't really work.
You could remove vertices that have a shallow angle between the two neighboring vertices in that case. So if the angle formed by 3 vertices is less than 5 or 10 degrees, just drop it. That'll smooth out any gentle bends.


That sounds reasonable, I'll give that a try.

Thanks for your help, I'll let you know how it turns out.

Share this post


Link to post
Share on other sites

This topic is 3459 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this