<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
I tried a few things, and expected the correct result to be this:<br>
cr.arc(200, 200, 200, 0*(math.pi/180), -60*(math.pi/180))<br>
cr.line_to(200,200)<br>
cr.close_path()<br>
cr.fill()<br>
<br>
but actually PostScript (ghostscript's interpretation of it) will
not draw a horizontal line at the beginning, either:<br>
$ gs<br>
GS> 200 setlinewidth<br>
GS> 200 500 100 0 60 arcn stroke<br>
<br>
(Note: I've used arcn instead of arc and 60 instead of -60 because
the postscript coordinate system has its Y-axis going upwards,
unlike pygtk.)<br>
<br>
Also, when using LINE_CAP_SQUARE (and a smaller line-width), I can
see that cairo and ghostscript disagrees on the tangent-direction at
the endpoints of the arc...<br>
<br>
What cairo seems to do, is use different tangent directions for the
inner and the outer part of the stroked arc, but (AFAICS) *only at
the beginning* of the arc -- the end of it is always unaffected!<br>
That seems strange to me. <br>
But I'm not sure, which tangent is actually the 'correct' one.<br>
<br>
If you want a perfect horizontal line, you should not stroke the
arc, but fill it (see my first code snippet).<br>
<br>
Maybe someone with better knowledge of how cairo actually draws
(tesselates?) these arcs wants to explain the current behavior?<br>
<br>
Tobias<br>
<br>
<br>
<br>
On 20/09/14 02:04, Maurizio Berti wrote:
<blockquote
cite="mid:CAPn+-XQfOC2q4ThQgA_pnX4ngGEZGZRv9qHHdE-vhoQR8QaK0g@mail.gmail.com"
type="cite">
<div dir="ltr">Hello,
<div>I'm writing a cairo python script, which loads graphics and
animations from a custom file to create "fancy" (and unuseful)
graphics like those seen in videogames and scifi movies.</div>
<div>I have a problem with arcs, though: I need to be able to
draw them interactively, with user given coords, start/end and
line width. When I try to draw arcs with a certain line width
I have a strange behaviour: the beginning of the line is not
straight as it should be, you can see an example of it here:</div>
<div><a moz-do-not-send="true"
href="http://jidesk.net/sypy/strangearc2.jpg">http://jidesk.net/sypy/strangearc2.jpg</a><br
clear="all">
<div><br>
</div>
<div>Here is the code I used for this test:</div>
<div><a moz-do-not-send="true"
href="https://bpaste.net/show/e1f3b8d1f842">https://bpaste.net/show/e1f3b8d1f842</a><br>
</div>
<div><br>
</div>
<div>I'm using cairo 1.12.16 from the official Gentoo portage
(the problem still remains with the latest -r3 version in
the portage), with pycairo 1.10.0-r4, also latest stable
from the portage.</div>
<div><br>
</div>
<div>CC'ing to <a moz-do-not-send="true"
href="mailto:bryce@osg.samsung.com">bryce@osg.samsung.com</a>
who confirmed the issue on #cairo using cairo
1.13.0~20140204-0ubuntu1, but was not present using
cairo 1.12.16-0ubuntu1.1~bryce~precise6, with little
different results: <a moz-do-not-send="true"
href="http://jidesk.net/sypy/strangearc-bryce.png">http://jidesk.net/sypy/strangearc-bryce.png</a></div>
<div><br>
</div>
<div>To draw single and simple "filled" arcs I could use lines
and curves, but that would affect the performances of my
script (and would require a lot of complex calculations), so
I'm here to ask if someone can confirm that this is a bug
indeed.</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Maurizio</div>
<div><br>
</div>
-- <br>
È difficile avere una convinzione precisa quando si parla
delle ragioni del cuore. - "Sostiene Pereira", Antonio
Tabucchi<br>
<a moz-do-not-send="true" href="http://www.jidesk.net">http://www.jidesk.net</a>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</body>
</html>