Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Detection of edge of a polygon

  1. #11
    Junior Member Regular Contributor
    Join Date
    Apr 2012
    Posts
    167
    Quote Originally Posted by jenny_wui View Post
    Also I would like to know whether the edges form a ring, is any algorithm available for it?
    Would like to help, but the info you're providing is too vague to answer such detailed questions. How are your polygons defined? Could you post a small example of the data? If you post a list of ~10 polygon definitions and corresponding vertex definitions, I think you'll get some responses.

  2. #12
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    162
    The polygon is defined as an .obj file. I have extracted the vertices and triangles.

  3. #13
    Junior Member Regular Contributor
    Join Date
    Apr 2012
    Posts
    167
    Quote Originally Posted by jenny_wui View Post
    The polygon is defined as an .obj file. I have extracted the vertices and triangles.
    That's a start. We are all familiar with .obj format. Could you post a small example of one of your .obj files and repeat your question(s) relative to the geometry in that file? You could probably get by with an .obj file containing 20 polys and their associated vertices.

    Or - here's another approach. Can you compute and display the flat normals for the polys in one of your files? If you can do that, you can probably solve your problem.

  4. #14
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    162
    Yes, I have vertices and triangle in obj file. I already calculated flat normals and vertex normals of each triangle.

  5. #15
    Junior Member Regular Contributor
    Join Date
    Apr 2012
    Posts
    167
    Quote Originally Posted by jenny_wui View Post
    Yes, I have vertices and triangle in obj file. I already calculated flat normals and vertex normals of each triangle.
    Now check the angle between the flat normals of the triangles sharing an edge. If that angle is greater than some threshold angle (which you set), you have a sharp edge. This should be easy assuming that shared edges use the same vertices. For example, say Poly A is defined by vertices V1, V2, and V3, and Poly B is defined by vertices V1, V2, and V8. Polys A and B share edge V1-V2. Check the angle between the flat normals of Polys A and B. If it's greater than your threshold angle, you've identified a sharp edge. If edge V1-V2 is only used by one poly, it's an open edge and should be flagged differently.

  6. #16
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    162
    Thanks. Is there any way to find whether the edges form a ring?

  7. #17
    Junior Member Regular Contributor
    Join Date
    Apr 2012
    Posts
    167
    Quote Originally Posted by jenny_wui View Post
    Thanks. Is there any way to find whether the edges form a ring?
    Don't know what you mean by a 'ring'. Do you know what you mean by 'ring'?
    If you can clearly define to yourself what you mean by a 'ring', you'll probably
    be able to come up with an algorithm to find 'rings'.

    Would help us to see an example of your geometry with one of the so-called 'rings' highlighted.

    Good luck.

  8. #18
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    162
    Sorry., I could not explain properly. Ring is formed when vertex v1 has edge with v2, v2 with v3......vn-1 with vn and vn with v1 again.

  9. #19
    Junior Member Regular Contributor
    Join Date
    Apr 2012
    Posts
    167
    Quote Originally Posted by jenny_wui View Post
    Sorry., I could not explain properly. Ring is formed when vertex v1 has edge with v2, v2 with v3......vn-1 with vn and vn with v1 again.
    Again, that's only a start. There has to be a LOT more to it than that - otherwise you could find infinite rings in an object. In fact, every polygon is a ring by your definition. This is what I meant when I said you have to think carefully about what you mean by a 'ring'. If you can define it, you'll be able to compute it.

  10. #20
    Advanced Member Frequent Contributor
    Join Date
    Aug 2004
    Location
    munich, germany
    Posts
    659
    so, basically you have pairs of vertices, aka edges, e.g.

    {v1, v2}, {v4, v3}, {v1, v4}, {v3, v2}

    and want to find out if they make a closed loop?

    that is rather complicated. i'll go and ask my colleagues...brb

    edit: so, i after asking my colleagues, i can say you need something they call a "for-loop" and some "if-statement"s.
    i got lost in the discussion when someone said something about "compiling" and "linking".
    Last edited by RigidBody; 01-11-2013 at 07:30 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •