Graphics, Figures & Tables ⇒ Trashed psellipticarc when arrows too large
Trashed psellipticarc when arrows too large
Hi,
I'm experiencing an issue whose best fix I don't know: I'm drawing angles (in pstricks) with psellipticarc, using an end arrow for showing the direction of the angle. It works beautifully, except when the angle is small, so the arrow doesn't fit within the angle, and then the result is that the whole 2*PI circle is drawn, instead of the wished arc (if I don't draw the arrow, the arc is fine no matter if it's small or not).
One (perhaps dirty) quick solution would be to avoid drawing an arrow when the arc is too small, but... how can I determine the threshold for choosing whether to generate the arrow or not? I guess it depends on the arc angle, the arc radius, and surely a lot of other factors I ignore.
Note that I'd be happy if the problem was just the arrow overriding the arc length: it would be a very slight artifact. However, the fact that the arc gets trashed, drawing the whole 2*PI circle is what really stops the show for me.
Thank you for any advice you could give!
I'm experiencing an issue whose best fix I don't know: I'm drawing angles (in pstricks) with psellipticarc, using an end arrow for showing the direction of the angle. It works beautifully, except when the angle is small, so the arrow doesn't fit within the angle, and then the result is that the whole 2*PI circle is drawn, instead of the wished arc (if I don't draw the arrow, the arc is fine no matter if it's small or not).
One (perhaps dirty) quick solution would be to avoid drawing an arrow when the arc is too small, but... how can I determine the threshold for choosing whether to generate the arrow or not? I guess it depends on the arc angle, the arc radius, and surely a lot of other factors I ignore.
Note that I'd be happy if the problem was just the arrow overriding the arc length: it would be a very slight artifact. However, the fact that the arc gets trashed, drawing the whole 2*PI circle is what really stops the show for me.
Thank you for any advice you could give!
NEW: TikZ book now 40% off at Amazon.com for a short time.
- Stefan Kottwitz
- Site Admin
- Posts: 10321
- Joined: Mon Mar 10, 2008 9:44 pm
Trashed psellipticarc when arrows too large
Hi Sonny,
I did not experience that issue yet. Without code the question is still quite theoretical. Perhaps post a
minimal working example which shows the problem, so we could test it.
Stefan
I did not experience that issue yet. Without code the question is still quite theoretical. Perhaps post a

Stefan
LaTeX.org admin
Trashed psellipticarc when arrows too large
This command generates a whole circle for me. It should be just 15.9 degrees. The problem seems to be the arrow doesn't fit, because the arc is fine if I quit the arrow:
And, yes, as the code seems to suggest, it wasn't typed by hand. It's output by a program written by me. It's a C program that generates figures as LaTeX+pstricks output.
So, while such command could be tuned by hand so that the arrow fits, I need some way of doing it automatically, because the C program generates arcs of arbitrary size.
Another thing is that I could use psarc instead of psellipticarc, but I'm using the later because I sometimes need different scales in the X and Y axes.
Code: Select all
\psellipticarc[linewidth=0.100000000000mm,arrowinset=0]{->}(1.473134185720cm,5.267092621231cm)(0.133333333333cm,0.133333333333cm){0.000000}{15.945396}
So, while such command could be tuned by hand so that the arrow fits, I need some way of doing it automatically, because the C program generates arcs of arbitrary size.
Another thing is that I could use psarc instead of psellipticarc, but I'm using the later because I sometimes need different scales in the X and Y axes.
- Stefan Kottwitz
- Site Admin
- Posts: 10321
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Trashed psellipticarc when arrows too large
I would have tested it, but that's not possible with a single command. I don't type a dozen lines with document class, packages, pspicture environment etc. for each question I read.
Perhaps another one makes this. So, I recommend to give TikZ a try instead of PSTricks.
Stefan
Perhaps another one makes this. So, I recommend to give TikZ a try instead of PSTricks.
Stefan
LaTeX.org admin
Trashed psellipticarc when arrows too large
Yes, I can provide a full working example. Try this one (compile it with latex, dvips, and ps2pdf). In the output you can see four 90 degree angles which are correctly drawn. However, on the top you can see two complete circles which are wrong. They should be arcs of 15.94 degrees, but the arrows don't fit in them, so pstricks draws the full circle, which is what I don't want:Stefan_K wrote:I would have tested it, but that's not possible with a single command. I don't type a dozen lines with document class, packages, pspicture environment etc. for each question I read.
Perhaps another one makes this.
Code: Select all
\documentclass[a4paper,11pt,fleqn]{article}
\usepackage{amssymb,amsmath,mathtools}
\usepackage{pstricks,pst-node}
\usepackage{graphicx}
\begin{document}
\begin{figure}[H]
\centering
\begin{pspicture}(9.777777777778cm,8.111111111111cm)
\psellipticarc[linewidth=0.100000000000mm,arrowinset=0]{->}(2.535555555556cm,1.488888888889cm)(0.133333333333cm,0.133333333333cm){0.000000}{90.000000}
\psellipticarc[linewidth=0.100000000000mm,arrowinset=0]{->}(7.202222222222cm,1.488888888889cm)(0.133333333333cm,0.133333333333cm){0.000000}{90.000000}
\psellipticarc[linewidth=0.100000000000mm,arrowinset=0]{->}(2.535555555556cm,3.822222222222cm)(0.133333333333cm,0.133333333333cm){0.000000}{90.000000}
\psellipticarc[linewidth=0.100000000000mm,arrowinset=0]{->}(7.202222222222cm,3.822222222222cm)(0.133333333333cm,0.133333333333cm){0.000000}{90.000000}
\psellipticarc[linewidth=0.100000000000mm,arrowinset=0]{->}(1.473134185720cm,5.267092621231cm)(0.133333333333cm,0.133333333333cm){0.000000}{15.945396}
\psellipticarc[linewidth=0.100000000000mm,arrowinset=0]{->}(2.806467519035cm,5.648045001948cm)(0.133333333333cm,0.133333333333cm){0.000000}{15.945396}
\end{pspicture}
\end{figure}
\end{document}
Too late. My tool is based on pstricks since quite a few years ago. Changing to another command set would be overkill.Stefan_K wrote:So, I recommend to give TikZ a try instead of PSTricks.
Re: Trashed psellipticarc when arrows too large
I've just coded the computation of the arrow length, from the pstricks manual. So, I could now compare the arc length to the arrow length, so the program can decide whether to output arrows or not. But computing an elliptical arc length is very difficult. Does anybody know how does pstricks determine whether arrows fit or not when drawing a psellipticarc?
Trashed psellipticarc when arrows too large
I just thought a perhaps better solution: can I code any kind of mask so that only the part inside the angle is drawn? Of course the mask should affect only the arc line and the arrow. This would be great because it would draw the part of the arrow tip that fits inside the angle.
Can this be done in pstricks? How?
FIXED: I finally got an acceptable result by using psclip/endpsclip, with a triangle as the clipping region. The triangle covers the arc, with some additional space, for accounting for the arrow width. It would be preferable that pstricks wouldn't draw arrows when they're going to trash an arc, but this workaround provides a result which satisfies me.
Can this be done in pstricks? How?
FIXED: I finally got an acceptable result by using psclip/endpsclip, with a triangle as the clipping region. The triangle covers the arc, with some additional space, for accounting for the arrow width. It would be preferable that pstricks wouldn't draw arrows when they're going to trash an arc, but this workaround provides a result which satisfies me.