Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can you explain the formula or model for the white dot?


i'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....


It sounds like you want a point with argument theta such that a bunch of constraints are satisfied. I don't think you'll easily be able to find a general polar "r(theta)=...", since your curve is defined by a "sweep" of other non-trivial function outputs (i.e. the intersection of two circles), which is another way of saying "solve for x in f(x)=0 where f(x) is complicated".

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.


thank you for the pointers

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


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: