[Xy-pic] arc overshooting endpoint

Ross Moore ross.moore at mq.edu.au
Sun Mar 6 22:15:31 CET 2011


Hello Leslie,

On 05/03/2011, at 3:08 PM, Leslie Saper wrote:

> Hello,
> 
> The following code produces two diagrams.  The first connects the origin
> to point at <10pc,4pc> by a circular arc beginning with an angle of 45
> degrees.  The output is as expected.  The code for the second diagram is
> identical except the point is 1 pica higher.  But in the output the arc
> overshoots the point by around 3/4 inches.
> 
> \documentclass{article}
> \usepackage[arc,pdf]{xy}
> \begin{document}
> 
> \xy
> *\dir{*}
> ;+<10pc,4pc>*\dir{*}
> ,{\ellipse ru,_{}}
> \endxy
> 
> \xy
> *\dir{*}
> ;+<10pc,5pc>*\dir{*}
> ,{\ellipse ru,_{}}
> \endxy
> 
> \end{document}
> 
> What did I do wrong?  

Nothing conceptually.
But practice is not always as precise as theory.

Try the effect of:

>>>> \xy
>>>> *\dir{*}
>>>> ;+<10pc,5pc>*!L+<0pt,5pt>\dir{*}
>>>> ,{\ellipse ru,_{}}
>>>> \endxy

The problem is that TeX must compute a sampling of points on 
the ellipse, and must test these against a "stopping criterion",
which is based upon the point lying within a certain rectangle.


> Or is this to be expected and why?

When your endpoint is zero-sized, as with  *\dir{*} ,
and the control-point for the Bézier cubic (very good
approximation to a circle segment) differs by a small
amount in one or other coordinate from the target point,
that rectangle can be extremely narrow, and not easily
found by the binary-tree search algorithm, when you also
take into account rounding errors.

Hence adding height and depth, but no width, using +<0pt,5pt> 
(the !L is probably redundant in this case) fattens that 
rectangle and so gives the desired result.

Yes, the Xy-pic coding could be improved to incorporate this
kind of hack automatically. The problem is that there are many
separate cases to consider, about whether to fatten vertically
or horizontally, or *not at all*. 

We really need more examples of what users would like to do,
to decide whether there is any overall cost/benefit to spending
time of this, when there is in fact an easy way for users to 
identify the problem and work-around it themselves, as above.


> I am using Xy-pic version 3.8.4 processed with pdflatex.  The output pdf
> file may be found at
> 
> https://www.math.duke.edu/faculty/saper/arc_test.pdf
> 
> Thanks,
> 
> Leslie Saper


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross.moore at mq.edu.au 
Mathematics Department                           office: E7A-419      
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------






More information about the xy-pic mailing list