farbrausch / fr_public

Farbrausch demo tools 2001-2011
3.36k stars 344 forks source link

wz4 : FromVertex optimization (keep unique vertices) #76

Closed wzman closed 11 years ago

wzman commented 11 years ago

FromVertex had more particle than expected (combined vertices). Here it keep only unique vertices of mesh (evaluated from their position)

rygorous commented 11 years ago

I'm not too happy with the implementation - O(N^2), and FromVertex is often used with lots of vertices (i.e. thousands or tens of thousands).

A better approach is to make an array of positions first and sort it; then it's fast to identify duplicate vertices: it's exactly those which are the same as their predecessor in the sorted list!

wzman commented 11 years ago

ah yes, good idea, it's tricky ;)