Re: Shouldn't Cairo use/offer degrees rather than radians?
David Kastrup <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Organization | Organization?!? |
| Message-ID | <[email protected]> |
Lawrence D'Oliveiro <[email protected]> writes: > On Tue, 27 Jun 2017 10:24:18 +0200, Guillermo Rodriguez wrote: > >> 2017-06-27 9:57 GMT+02:00 Lawrence D'Oliveiro: >> >>> On Tue, 27 Jun 2017 08:03:36 +0200, David Kastrup wrote: >>> >>>> PostScript uses degrees. PDF uses degrees. >>> >>> No! >> >> Actually, yes.. > > Trig calculations are usually easier in radians. Nobody uses Taylor series for actual trig calculations. The Cordic algorithms work from full revolutions. If I write #include "math.h" #include "stdio.h" int main () { printf ("%lg\n", cos (M_PI/2)); return 0; } and run it, the output is 6.12323e-17 . So apparently radians do not make things easy enough for computer/user to work well in graphics applications. If you want to turn something by exactly 90 degrees or 180 degrees (not exactly a rare event in graphics), you cannot do so by using a Cairo function accepting angle arguments but have to specify the transform matrix manually. That is one important reason that graphics formats like SVG, PostScript and PDF specify angles in degrees: that way right angles are actually representable. -- David Kastrup -- cairo mailing list [email protected] https://lists.cairographics.org/mailman/listinfo/cairo