5 ms·
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
- waynesonfire 4y agoyou forgot to mention the pay rate?
- clumsycomputer 4y agohaha fair question... i'm hoping to find someone who will donate their time as i am doing myself. its important that improvements to the current solution i have remain in the open and free to use. otherwise said help may be counterproductive and even destructive
- reallymental 4y agoConsidering that only one of those circles' radius is variable, and the other two circles intersect with the yellow loop, you can determine the equation of the yellow loop, which will give you the position of the white point, at any time, in constant time.
- clumsycomputer 4y agoyour reply certainly gives me hope that its possible, though i fear i've stared at this diagram for too long and am having difficulty viewing it with a fresh perspective. some 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
- lupire 4y agoCan you explain the formula or model for the white dot?
- clumsycomputer 4y agoi'll do my best 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) 4A. compute intersection circle along range defined in 3 4B. compute the intersection angle between base and intersection circles relative to the center of the intersection/sub circle (law of cosines) 4C. compute the intersection point with intersection angle (green on blue & orange) 4D. compute sub point with intersection angle (green on pink) 4E. compute the loop point with the x component from intersection point (4C) and the y component from sub point (4D) 5. compute the trace point at trace angle (white) 5A. trace the already computed loop points searching for the the two points where the trace angle fits between 5B. compute the intersection between the line composed of the two matching loop points and the trace line originating at the sub circle's center with an angle of the trace angle its a generalization of the drawing by Fritz Hügelschäffer linked below http://www.mathematische-basteleien.de/eggcurves.htm#:~:text=An%20oval%20is%20a%20closed,and%20has%20a%20positive%20curvature http://www.mathematische-basteleien.de/eggcurves.htm#:~:text....
- gus_massa 4y agoI 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_formula 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 https://en.wikipedia.org/wiki/Secant_method but binary search is more foolproof.
- pubby 4y agoIf you can't figure it out, memoize the results in a table and interpolate.
- clumsycomputer 4y agoi have an implementation that does something along those lines, which suffices for graphics but doesn't work well for audio applications. think 48 000 samples per second. 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
- thomassmith65 4y agoI'd start by running the table through a curve-fitting program to see if it finds a simple formula like the OP is seeking. I've used this paid app https://www.curveexpert.net/products/curveexpert-professional https://www.curveexpert.net/products/curveexpert-professiona... but there are also free curve-fitting web apps out there.
- clumsycomputer 4y agoawesome thanks for the recommendation my only worry about curve fitting is that the recommended function won't generalize to other loop configurations
- thomassmith65 4y agoI'm admittedly hazy on the exact work you're doing, but if you mean the other configurations will change the curve, you could try (1) tweaking your program to output tables of a few examples (2) using curve-fitting app to get a fit for each table (3) looking if it found an equation that matched all of them (making a note, for each example, of which coefficients it plugged into the equation).
- clumsycomputer 4y agothat sounds like something i haven't tried and may yield results gracias