Replying to myself... On Mon, Jun 15, 2020 at 8:11 AM Alexei Podtelezhnikov <apodt...@gmail.com> wrote: > > Hi Anuj, > > > A) Line Segment: ~0.32 microseconds > > B) Conic Bezier: ~1.08 microseconds > > C) Cubic Bezier: ~1.25 microseconds > > > > I am very surprised indeed. In the linear case, it is a trivial > cross-product divided by the length of a segment, or the smaller of > two distances to the ends. There are no equations to solve. What is > your explanation for such close numbers?
Your profiling results indicate that a lot of time is spent calculating distances. Perhaps, you can work with much faster square-distances (they can be signed or signs stored separately) and apply square root as a final processing step. Or, would signed square-distance field work as well (SSDF so to speak)? Please spend some time thinking about optimizations and bottlenecks. Alexei