Closed s99090 closed 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.
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.
NVM, vector is actually using heap instead of stack.
Right - glad you figured out your issue!
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?