Triangulating N-Gons?

I’m being lazy but do any of the connectors or libraries already have efficient routines for triangulating n-gons that we might find in Speckle Meshes?

It’s not important, but I’ll be implementing it in c++.

1 Like

heya!

I don’t think we’re necessarily wedded to these, but we do have triangulation implemented in both sharp and web:

here it is in sharp:

and here it is in web:

note that I don’t think we’d call these “done” or perfect (found a bug somewhat recently that was promptly fixed :sweat_smile:), but they are totally functional and useful :blush:

1 Like

Perfect! Wow, I was, even so lazy not to have found these. :face_with_peeking_eye:

Now all I have to do is remember all the c++ I haven’t touched since highschool :blush: :man_student:

1 Like

Those triangulation functions are based on a textbook.

Christer Ericson (2005) - Real-Time Collision Detection
see page section 12.5.1 (pp. 498 - 500).

There are faster triangulation functions out there, but this one seems to serve our needs quite well for the applications that don’t support n-gons natively (unity, autocad, three.js)

If you decide to re-write this in C++, let me know if you need a hand!

1 Like