alecjacobson / computer-graphics-meshes

Computer Graphics Assignment about Meshes
26 stars 30 forks source link

How many times will Catmull-Clark subdivision be applied for grading? #19

Closed s99090 closed 5 years ago

s99090 commented 5 years ago

How many times will Catmull-Clark subdivision be applied for grading? Currently, I can apply Catmull-Clark subdivision 5 times on bob.obj before segmentation fault. I guess it is because of stack overflow. I wonder if it is good grading? or I need to optimize my code so that it can apply more subdivisions?

abhimadan commented 5 years ago

The mesh exponentially increases in size after each subdivision iteration, but even then I don't think it should segfault after 6 iterations. That being said, it's only worth 10% of this assignment, so it's your decision on whether or not the time you spend optimizing your code is worthwhile.

s99090 commented 5 years ago

Oh I found the problem! The problem is that I used array instead of vector, because the array is faster than vector. I dont know why, but it did not segfault after I changed array to vector.

s99090 commented 5 years ago

NVM, vector is actually using heap instead of stack.

abhimadan commented 5 years ago

Right - glad you figured out your issue!