| www.delorie.com/archives/browse.cgi | search |
| From: | Martin Ambuhl <mambuhl AT earthlink DOT net> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: sin(acos((float)i/1024))*0x10000L |
| Date: | Mon, 15 Mar 1999 14:19:13 -0500 |
| References: | <36EBFD7D DOT 7D0FCB2C AT geocities DOT com> <36ecc7f2 DOT 50985511 AT news DOT snafu DOT de> |
| X-Posted-Path-Was: | not-for-mail |
| X-Accept-Language: | en |
| X-ELN-Date: | 15 Mar 1999 19:18:44 GMT |
| X-ELN-Insert-Date: | Mon Mar 15 11:25:05 1999 |
| Organization: | Nocturnal Aviation |
| Lines: | 32 |
| Mime-Version: | 1.0 |
| NNTP-Posting-Host: | 1cust80.tnt12.nyc3.da.uu.net |
| Message-ID: | <36ED5D31.E490D1BD@earthlink.net> |
| X-Mailer: | Mozilla 4.5 [en] (Win95; I) |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Horst Kraemer wrote:
> Better get another tutorial. The formula sin(acos(x)) is ridiculous.
>
> For x between 0 and 1
>
> sin(acos(x)) = sqrt(1-x*x)
Horst is obviously right, but it is worth remarking that if you want to
do graphics, you must learn some elementary trigonometry. Among the the
things you should learn (or work our for your self) is that the
Pythagorean formula
double sqr(double x) { return x*x; } /* helper function */
sqr(a) + sqr(b) == sqr(c);
on a unit circle is
sqr(y) + sqr(x) == 1;
or
sqr(cos(t)) + sqr(sin(t)) == 1;
When you know cos(t) == v, this leads to Horst's form
sin(t) == sqrt(1-v*v);
This is the sort of thing you should learn now, before further graphics
programming. It is not the sort of thing you ask in a newsgroup for a
programming language.
--
Martin Ambuhl (mambuhl AT earthlink DOT net)
Note: mambuhl AT tiac DOT net will soon be inactive
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |