Skip to content

Comment on Ask HN: Anyone Have Expertise in Trigonometry?parent

Comments

I was going to write that it's almost impossible that there is a closed O(1) formula for this, but after reading that the egg of Fritz Hügelschäffer is a cubic, I think there is hope. If your yellow curve is also a cubic, then it's solvable, but the formula for the exact solution is horrible. https://en.wikipedia.org/wiki/Cubic_equation#Cardano's_formu...

I prefer the lazy approach :) . The only hard step is 5B. How are you computing the intersection? Are you using a linear search in the angle? Can you use binary search? Probably the secant method is faster https://en.wikipedia.org/wiki/Secant_method but binary search is more foolproof.

its at least cubic, but the loop here is generalized farther where the sub circle can be phase. so i don't know???

linear search in angle i believe, though depending on the use case i hold onto the index of the last matched point making the next search O(1)

thanks for introducing me to the secant method. at the very least it will help me think about it differently

Fixup: 5B -> 5A

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.