ivanfratric / polypartition

Tiny Polygon Partitioning and Triangulation Library
MIT License
664 stars 118 forks source link

Reuse partitionVertices buffer #29

Closed poke1024 closed 6 years ago

poke1024 commented 6 years ago

Saves an allocation inside Triangulate_EC by reusing the partition vertex buffer (and keeping it inside the TPPLPartition, i.e. the buffer gets reused until TPPLPartition gets destroyed).

ivanfratric commented 6 years ago

I'm not convinced that this buffer should be a member of TPPLPartition. If you want to reuse the buffer between calls, an alternate approach could be to provide it as an (optional) argument to Triangulate_EC.

poke1024 commented 6 years ago

Hm, it's this is only one allocation per Triangulate_EC, and there's still one alloc per output triangle via TPPLPoly, so I think it's not worth the API change. I feel this is kind of a hack myself. Closing this.