A Roblox game that allows for the generation and manipulation of 3D Bézier curves with many steps and control points.
Highly optimized; bottlenecked only by Roblox's ability to relocate and color parts.
- Usage of Parallel Luau; adjustable thread count
- Computation reduction: only compute derivatives where needed by visualization configuration
- Intuitive 3D manipulation mechanics
- Multiple methods of step generation:
- Polynomial Evaluation
- Polynomial Evaluation via Horner's Method
- De Casteljau;
- Compute length of a curve via an adaptive Guass-Legendre quadrature;
⚠️ implementation may be incorrect - Trace curve across time to see use in animation
- Configurable visual appearance
- Transparency
- Variation: visualize using steps of cubes, spheres, cylinders, or wedges
- Size: option to use heuristic to resize parts to stretch across their span at low step counts; increases visual quality at slight performance cost
- Color points based on:
- Curvature
- Direction ([X, Y, Z] => [R, G, B])
- Velocity (unit magnitude => green-red gradient)
- Acceleration (unit magnitude => green-red gradient)
- Randomly (can help visualize how much computation is being performed every step)
- Without Color (results in performance boost by removing a step on Roblox's end)
The polynomial bernstein coefficients are computed by getting the nth Pascal's tetrahedron layer, where n is the degree of the polynomial (how many control points there are).
I actually don't have the required mathematical knowledge to explain how this works, but I noticed this pattern on my own when Freya Holmér had the coefficients of various derivations laid out nearby.
To me, the velocity instantly jumped out as reminding me of Pascal's triangle, and through some brute force, I managed to find out it had to do with the layer of the tetrahedron.
After then also figuring out the power rule, it's easy to compute the coefficients needed for any level of derivatives.
I suspect there's a better approach to achieving this, but it was quite fun to do and in practice doesn't have any performance impact because Roblox's ability to update parts is what is bottlenecking the code. One exception is that since the coefficient tables are cached in each thread for every degree, memory usage can be moderately impacted.
- Review implementation of integration for length computation
- Improve UI
- Visual composition
- Synchronize changes when default values based off of another one are changed