[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [OctDev] quiver3: 1 bug (arrow heads) + 1 fix + 1 improvement (set a
From: |
David Bateman |
Subject: |
Re: [OctDev] quiver3: 1 bug (arrow heads) + 1 fix + 1 improvement (set arrow color) |
Date: |
Tue, 05 Feb 2008 01:34:31 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20070914) |
Konstantinos Poulios wrote:
> Hi,
>
> first of all I hope that here is the right place to report this bug. I
> would also like to apologize for mixing one possible bug + fix and one
> suggestion for improvement in the same mail. Anyway, it's both about
> quiver.
>
> FIRST: the bug
> ---------------------
> In my Windows installation of Octave-Forge Version 3.0.0 I 've noticed
> that the arrow heads plotted by quiver3 are not parallel to the arrow.
>
> Test: >> quiver([0,1],[0,1],[0,1],[1,2],[1,2],[1,2])
> >> set(gca,'view',[90,0])
>
> Fix:
> removing the "/3" from the end of line 161 in "__quiver__.m" seems to
> solve the problem
>
> line 161
> <-- zarrw1 = zarrw2 = zend - w(:) * arrowsize / 3;
> --> zarrw1 = zarrw2 = zend - w(:) * arrowsize;
>
>
> SECOND: the improvement
> ---------------------
> quiver3 accepts as 8th argument a linespec. Though, defining a color in
> this linespec won't work. In order to make that work I had to modify the
> "__quiver__.m" as following:
>
> line 136
> <-- "linestyle", linespec.linestyle);
> --> "linestyle", linespec.linestyle,"color",linespec.color);
>
> line 140
> <-- "linestyle", linespec.linestyle);
> --> "linestyle", linespec.linestyle,"color",linespec.color);
>
> line 182
> <-- "linestyle", linespec.linestyle);
> --> "linestyle", linespec.linestyle,"color", linespec.color);
>
> line 186
> <-- "linestyle", linespec.linestyle);
> --> "linestyle", linespec.linestyle,"color", linespec.color);
>
>
>
> Test: >> quiver([0,1],[0,1],[0,1],[1,2],[1,2],[1,2],0,'g')
>
>
>
> I hope to help someone with this information. I have also attached my
> original and modified "__quiver__.m" files.
>
>
> best regards
>
> Kostas
>
Kostas,
This is an octave function, and so it must be changed in the core of
octave itself. That being said, I think your change is fine and propose
it in the attached form as a patch with an appropriate changelog entry.
D.
Index: scripts/plot/__quiver__.m
===================================================================
RCS file: /usr/local/cvsroot/octave/scripts/plot/__quiver__.m,v
retrieving revision 1.2
diff -u -r1.2 __quiver__.m
--- scripts/plot/__quiver__.m 26 Nov 2007 21:24:33 -0000 1.2
+++ scripts/plot/__quiver__.m 5 Feb 2008 00:33:17 -0000
@@ -133,11 +133,13 @@
h1 = plot3 ([x.'; xend.'; NaN(1, length (x))](:),
[y.'; yend.'; NaN(1, length (y))](:),
[z.'; zend.'; NaN(1, length (z))](:),
- "linestyle", linespec.linestyle);
+ "linestyle", linespec.linestyle,
+ "color", linespec.color);
else
h1 = plot ([x.'; xend.'; NaN(1, length (x))](:),
[y.'; yend.'; NaN(1, length (y))](:),
- "linestyle", linespec.linestyle);
+ "linestyle", linespec.linestyle,
+ "color", linespec.color);
endif
else
if (is3d)
@@ -158,7 +160,7 @@
yarrw1 = ytmp - (x - xend) * arrowsize / 3;
yarrw2 = ytmp + (x - xend) * arrowsize / 3;
if (is3d)
- zarrw1 = zarrw2 = zend - w(:) * arrowsize / 3;
+ zarrw1 = zarrw2 = zend - w(:) * arrowsize;
endif
if (have_line_spec)
@@ -179,11 +181,13 @@
h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
[yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
[zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
- "linestyle", linespec.linestyle);
+ "linestyle", linespec.linestyle,
+ "color", linespec.color);
else
h2 = plot ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
[yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
- "linestyle", linespec.linestyle);
+ "linestyle", linespec.linestyle,
+ "color", linespec.color);
endif
endif
elseif (is3d)
2008-02-05 Kostas Poulios <address@hidden>
* plot/__quiver__.m: make arrow head be in z-plane of the arrow
body. Allow the linespec to specify the arrow color.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [OctDev] quiver3: 1 bug (arrow heads) + 1 fix + 1 improvement (set arrow color),
David Bateman <=