This PR fixes a huge number of extra vertices (by roughly a factor of 20) that were generated during subdivision. I added a new example that can be used to show the difference in the output data from the subdivision. This is the output from the new example:
Original
subdivided to 24 faces, 462 vertices, ~3435854~ vertices/second, time 0.13 ms
subdivided to 96 faces, 2136 vertices, ~2671335~ vertices/second, time 0.63 ms
subdivided to 384 faces, 8832 vertices, ~2761288~ vertices/second, time 2.42 ms
subdivided to 1536 faces, 35616 vertices, ~2701504~ vertices/second, time 9.91 ms
subdivided to 6144 faces, 142752 vertices, ~2511635~ vertices/second, time 42.66 ms
subdivided to 24576 faces, 571296 vertices, ~2494327~ vertices/second, time 171.81 ms
subdivided to 98304 faces, 2285472 vertices, ~2460938~ vertices/second, time 696.55 ms
subdivided to 393216 faces, 9142176 vertices, ~2458577~ vertices/second, time 2788.89 ms
subdivided to 1572864 faces, 36568992 vertices, ~2429601~ vertices/second, time 11288.61 ms
Vertices per second, min: ~2429601~, max: ~3435854~, avg: ~2658340~
With bugfixes
subdivided to 24 faces, 26 vertices, 187803 vertices/second, time 0.10 ms
subdivided to 96 faces, 98 vertices, 158059 vertices/second, time 0.46 ms
subdivided to 384 faces, 386 vertices, 168812 vertices/second, time 1.71 ms
subdivided to 1536 faces, 1538 vertices, 173485 vertices/second, time 6.64 ms
subdivided to 6144 faces, 6146 vertices, 165626 vertices/second, time 27.82 ms
subdivided to 24576 faces, 24578 vertices, 161707 vertices/second, time 113.98 ms
subdivided to 98304 faces, 98306 vertices, 161655 vertices/second, time 456.08 ms
subdivided to 393216 faces, 393218 vertices, 157197 vertices/second, time 1876.07 ms
subdivided to 1572864 faces, 1572866 vertices, 154033 vertices/second, time 7658.43 ms
Vertices per second, min: 154033, max: 187803, avg: 165375
11288 / 7658 = 1.474
In addition to avoiding the extra vertices, the subdivision is almost 50% faster :smiley:
This PR fixes a huge number of extra vertices (by roughly a factor of 20) that were generated during subdivision. I added a new example that can be used to show the difference in the output data from the subdivision. This is the output from the new example:
Original
subdivided to 24 faces, 462 vertices, ~3435854~ vertices/second, time 0.13 ms
subdivided to 96 faces, 2136 vertices, ~2671335~ vertices/second, time 0.63 ms
subdivided to 384 faces, 8832 vertices, ~2761288~ vertices/second, time 2.42 ms
subdivided to 1536 faces, 35616 vertices, ~2701504~ vertices/second, time 9.91 ms
subdivided to 6144 faces, 142752 vertices, ~2511635~ vertices/second, time 42.66 ms
subdivided to 24576 faces, 571296 vertices, ~2494327~ vertices/second, time 171.81 ms
subdivided to 98304 faces, 2285472 vertices, ~2460938~ vertices/second, time 696.55 ms
subdivided to 393216 faces, 9142176 vertices, ~2458577~ vertices/second, time 2788.89 ms
subdivided to 1572864 faces, 36568992 vertices, ~2429601~ vertices/second, time 11288.61 ms Vertices per second, min: ~2429601~, max: ~3435854~, avg: ~2658340~
With bugfixes
subdivided to 24 faces, 26 vertices, 187803 vertices/second, time 0.10 ms
subdivided to 96 faces, 98 vertices, 158059 vertices/second, time 0.46 ms
subdivided to 384 faces, 386 vertices, 168812 vertices/second, time 1.71 ms
subdivided to 1536 faces, 1538 vertices, 173485 vertices/second, time 6.64 ms
subdivided to 6144 faces, 6146 vertices, 165626 vertices/second, time 27.82 ms
subdivided to 24576 faces, 24578 vertices, 161707 vertices/second, time 113.98 ms
subdivided to 98304 faces, 98306 vertices, 161655 vertices/second, time 456.08 ms
subdivided to 393216 faces, 393218 vertices, 157197 vertices/second, time 1876.07 ms
subdivided to 1572864 faces, 1572866 vertices, 154033 vertices/second, time 7658.43 ms Vertices per second, min: 154033, max: 187803, avg: 165375
11288 / 7658 = 1.474
In addition to avoiding the extra vertices, the subdivision is almost 50% faster :smiley: