Quiz 4
Quiz 4
Q1
Question 3
Can the memory footprint of a half-edge mesh be known simply by being told how many Faces, Half-Edges, and Vertices are in the mesh, and none of the connectivity information? Why or why not?
Yes, because half-edge mesh has fixed size of data structure elements; each face, half-edge, and vertex uses a fixed amount of memory, their counts alone determine the total footprint without needing connectivity details. The actual connectivity (which elements point to which) does not affect the amount of memory required to store these pointers; it only affects their values. Since the sizes of the data fields are constant, the total memory footprint depends only on the number of elements.
Question 4
Why do we use vectors of unique pointers to own our mesh components' memory, rather than having every mesh component store shared pointers to its connected elements? Your answer should consider both the runtime tradeoff of unique vs shared pointers as well as code organization.
We use unique pointers to manage memory for mesh components because they avoid the overhead of reference counting required by shared pointers, improving runtime performance. Unique pointers also provide clear, single ownership of each component's memory, preventing cyclic dependencies and simplifying memory management, making the code more maintainable.