Ask HN: Anyone Have Expertise in Trigonometry?
howdy hn
im looking to collaborate with someone who is passionate about trigonometry, computational geometry, or just math in general! im trying to figure out if the white dot in the animation linked below can be computed in constant time, and if not what is the best that can be done? all the code i write these days is open-source, and i believe cracking this nut will go a long way for many!! any takers??
loop anatomy animation:
https://youtube.com/shorts/M83QFzrcnlc?feature=share
20 comments
[ 5.6 ms ] story [ 60.1 ms ] threadsome additional context.
im constructing the loop (yellow) with the black dots, which im computing in constant time. the dynamic circle (blue) is being constructed from the two static circles (pink, orange). the white dot is currently being computed by sweeping the already computed loop points from the center of the small circle (pink).
are there any laws or key points that may help me along? are there any similar problems that are well documented that you are aware of?
thanks
1. define the base circle (orange)
2. define the sub circle (pink)
3. compute the range of the intersection circle's radius (blue)
4. compute the loop points (yellow)
5. compute the trace point at trace angle (white) its a generalization of the drawing by Fritz Hügelschäffer linked belowhttp://www.mathematische-basteleien.de/eggcurves.htm#:~:text....
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.
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
I would be inclined to use a non-linear solver, which will will almost certainly converage within 2 or 3 iterations especially if you're starting with a good initial estimate from time=t-1. 40khz should not be a problem.
You can start with scipy.optimize, and look into ceres if you need something faster.
i don't have much formal math training, but have used scipy a handful to times successfully for other problems. optimize is new to me, but ill throw some things into and see what comes out
Do you have a formula for each of these things?
What do you mean by "constant time"? From your description it seams all the points have a closed formula, there are no iterative steps that may be long? Do you want a simpler direct formula?
the animation is something i constructed in order to help facilitate discussion and get help :)
i've outlined the computations more detail in a reply below
by constant time i mean O(1)
computing the white dot currently requires me to sweep the already computed loop points which isn't a big deal in a lot of use cases, but with audio its a show stopper
the white dot is also the key to a much more complex computation that im using
O(1) in what?
the computation i've outlined in the animation is also just a small but very important piece of a much more complex computation
this white dot is my bottle neck
my only worry about curve fitting is that the recommended function won't generalize to other loop configurations
gracias