[cairo] Shouldn't Cairo use/offer degrees rather than radians?

Bill Spitzak spitzak at gmail.com
Tue Jun 27 17:22:28 UTC 2017


I'm pretty certain cairo will want to keep intermediate
transformations as matrices rather than some accumulation of rotations
and translates and rotates. This means that even if rotations are in
degrees, rotating twice by 45° will produce the exact same inaccuracy
since it will store the first rotation as a matrix containing
sqrt(2)/2 which cannot be represented exactly.

Adding a direct "rotate by this mulitple of PI/2" call might be a good
idea however. Also seems like cairo_rotate could look for numbers that
are "close" to multiples of PI/2.

I agree that in most cases the tiny errors do not produce visible
results in Cairo output. However they may cause a shortcut path to not
be triggered and thus slow things down. This really means that the
shortcut path detector should be more lenient in accepting angles near
zero.


On Tue, Jun 27, 2017 at 8:46 AM, David Kastrup <dak at gnu.org> wrote:
> Simon Budig <simon at budig.de> writes:
>
>> Hi David.
>>
>> I understand that this is kind of a clash of philosophies here, and
>> the mathematician in me very much sympathize with you in the sense,
>> that exact representations are helpful and important.
>>
>> But the computer scientist in me thinks, that sometimes "good enough"
>> is good enough...
>
> It wasn't good enough for PostScript, and it wasn't good enough for
> METAFONT, and its author Donald Knuth basically _founded_ computer
> science as a discipline.  It wasn't good enough for SVG.  CSS is
> neutral: you have to specify one of "deg, grad, rad, turn" as unit but
> most tutorials will tell you only about "deg".
>
> The "good enough" faction are engineers.  And even they tend to prefer
> degrees for angles...
>
> Cairo really is the odd man out in graphics software.  I wasn't really
> talking about removing the existing calls, just adding ones working with
> degrees and working _exactly_ where multiples of 90 degrees are
> concerned.
>
> And "good enough" doesn't really cut it in graphics software either when
> we are talking about line thicknesses.  An epsilon of difference may
> easily fatten or thin a line by a whole pixel.  You don't want any
> jaggies anywhere when turning by 90 degrees.
>
> --
> David Kastrup
>
> --
> cairo mailing list
> cairo at cairographics.org
> https://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list