"Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > "Tor Olav Kristensen" <tor### [at] TOBEREMOVEDgmailcom> wrote:
> > ... I would also like to figure out if there's a nice
> > degrees-to-fractions-of-pi algorithm out there, and I could implement that.
> > I'll probably just hard-code an array of text objects.
>
> You can divide the angle by 180 and convert the resulting decimal number to a
> fraction. Then you can use David Eppstein's "find rational approximation to
> given real number" code as suggested in the first answer here:
>
>
https://stackoverflow.com/questions/95727/how-to-convert-floats-to-human-readable-fractions
I tried at least 2 different ways to go about this, but I didn't have any
success and fell into some kind of trap in the recursion programming that
short-circuits things. It was a mess that I spent too many hours trying to
fix.
I have more application cases that I'd like to apply this sort of thing to, if
you give me a nudge in the proper direction.
Thanks,
- BW
Post a reply to this message
Attachments:
Download 'rationalapproximation.pov.txt' (7 KB)
|