0

is there an algorithm for dividing the triangle into smaller triangles? I have the coordinates of each point and indices list and I need to divide each triangle into for example 3 smaller triangles. But I do not know how to work with indices.

struct p{
float color[3];
float position[3];};

const p Vertices[] = {
    { { 0.0, 0.0, 1.0 }, { -10.0, -10.0, -10.0 } },
    { { 0.0, 0.0, 1.0 }, { -10.0, -10.0,  10.0 } },
    { { 0.0, 0.0, 1.0 }, {  10.0, -10.0,  10.0 } },
    { { 0.0, 0.0, 1.0 }, {  10.0, -10.0, -10.0 } }
};

const unsigned char indices[] = {
     0,  1,  2,
     0,  2,  3
};
Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • 7
    Think about how many ways that a triangle could be split into smaller ones (hint: it's an infinate number). I think you need to tighten your question a little more and maybe have a go at it – UKMonkey Nov 30 '17 at 15:49
  • The simpliest would be to use the barycentre of the triangle. No need for fancy algorithm ;) – YSC Nov 30 '17 at 16:18
  • 2
    The accepted answer to this might help: [SO: Drawing Sphere in OpenGL without using gluSphere()?](https://stackoverflow.com/a/7687312/7478597) (I found this remembering that I once wrote an OpenGL sphere rendering by recursively splitting triangles of an [Icosahedron](https://en.wikipedia.org/wiki/Regular_icosahedron) - had learnt this from _the_ Red Book. The answer uses an Octahedron instead but the principle is the same.) – Scheff's Cat Nov 30 '17 at 18:29

0 Answers0