Yesterday I wrote about a problem I had with bezier curves. I needed to divide a bezier curve into segments of equal length. This is a tricky mathematical problem and there are a lot of different solutions. Some solutions are slower but more accurate, others are less accurate but faster. I implemented a solution from the interactive bezier curves guide and it works well but it's rather slow. It's not the most accurate solution too.
I studied the code and understood the problem quite well now so what I might do is find my own solution that would work for my special case. Today I thought about this problem a lot and I think I found something that would work quite well. I need to solve a couple of geometric equations. The current solution is quite accurate — at least it always puts objects exactly on the curve. My solution won't be that accurate but I feel that it should be quick and accurate enough to beat the current algorithm for my problem. It probably won't be as janky as the current one too which is a pretty good thing!
The current solution finds a lot of points on the curve and then finds the ones that fit that distance good enough. I'm probably going to write about my solution here too when I will implement it.