1
\$\begingroup\$

if a Vertex looks like this:

struct vertex {
    vec3 point;
    vertex [] connected;
};

Can I tell if this makes a solid shape with no holes? (e.g a sphere or a cube, NOT a sphere with a side missing for example)

(if i can see the back of a face from outside of the shape then it is not solid)

\$\endgroup\$

1 Answer 1

7
\$\begingroup\$

This is quite a tricky question.

My idea to test if an object has no hole is to check all edges and make sure they all belong to 2 different triangles. If an edge only belong to one triangle, it means it's a border of the whole surface, meaning there's a hole.

This could be harder if you have different vertex at the same position (for example to have different texture coordinates per face).

\$\endgroup\$
1
  • \$\begingroup\$ I managed to get it working but i have to give it the triangles. I could not work out how to generate them myself. But its good enough \$\endgroup\$
    – t123
    Aug 24, 2011 at 19:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .