51d1f1a277
Resolves: #1998306
56 lines
1.7 KiB
Diff
56 lines
1.7 KiB
Diff
Subject: [PATCH] Allow arrows with zero length on arcs
|
|
|
|
Use the tangent, not a secant, for short arrows on arcs.
|
|
---
|
|
fig2dev/bound.c | 9 ++++-----
|
|
fig2dev/tests/output.at | 8 ++++++++
|
|
2 files changed, 12 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/fig2dev/bound.c b/fig2dev/bound.c
|
|
index ce7f4d1..9e997b7 100644
|
|
--- a/fig2dev/bound.c
|
|
+++ b/fig2dev/bound.c
|
|
@@ -1095,16 +1095,15 @@ compute_arcarrow_angle(double x1, double y1, double x2, double y2,
|
|
r=sqrt(dx*dx+dy*dy);
|
|
h = (double) arrow->ht;
|
|
/* lines are made a little thinner in set_linewidth */
|
|
- thick = (arrow->thickness <= THICK_SCALE) ?
|
|
- 0.5* arrow->thickness :
|
|
- arrow->thickness - THICK_SCALE;
|
|
+ thick = arrow->thickness <= THICK_SCALE ?
|
|
+ 0.5 * arrow->thickness : arrow->thickness - THICK_SCALE;
|
|
/* lpt is the amount the arrowhead extends beyond the end of the line */
|
|
lpt = thick/2.0/(arrow->wid/h/2.0);
|
|
/* add this to the length */
|
|
h += lpt;
|
|
|
|
- /* radius too small for this method, use normal method */
|
|
- if (h > 2.0*r) {
|
|
+ /* secant would be too large or too small */
|
|
+ if (h > 2.0*r || h < 0.01*r) {
|
|
arc_tangent_int(x1,y1,x2,y2,direction,x,y);
|
|
return;
|
|
}
|
|
diff --git a/fig2dev/tests/output.at b/fig2dev/tests/output.at
|
|
index 79788cc..9150dbe 100644
|
|
--- a/fig2dev/tests/output.at
|
|
+++ b/fig2dev/tests/output.at
|
|
@@ -175,6 +175,14 @@ AT_CHECK([fig2dev -L pict2e -P big1.fig big1.tex && \
|
|
], 0, ignore)
|
|
AT_CLEANUP
|
|
|
|
+AT_SETUP([accept arc arrows with zero height, ticket #74])
|
|
+AT_KEYWORDS(pict2e)
|
|
+AT_CHECK([fig2dev -L pict2e <<EOF
|
|
+FIG_FILE_TOP
|
|
+5 1 0 1 0 7 50 -1 -1 0.0 0 0 1 0 0.0 0.0 600 0 0 600 -600 0
|
|
+ 1 1 1.0 60.0 0.0
|
|
+EOF], 0, ignore)
|
|
+AT_CLEANUP
|
|
|
|
AT_BANNER([Test svg output language.])
|
|
AT_SETUP([compare patterns with template])
|
|
--
|
|
2.31.1
|
|
|