[cairo] Shouldn't Cairo use/offer degrees rather than radians?
Lawrence D'Oliveiro
ldo at geek-central.gen.nz
Tue Jun 27 23:37:49 UTC 2017
On Tue, 27 Jun 2017 11:37:07 +0200, David Kastrup wrote:
> 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 .
Which, with any reasonable pixel resolution that Cairo might be
expected to cope with, is indistinguishable from zero.
> 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.
On the contrary: specifying angles of ±90/±180 or ±0.5π/±π works just
fine. You can try it out for yourself with my “Matrix Basics”
interactive notebook <https://github.com/ldo/qahirah_notebooks>.
More information about the cairo
mailing list