octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #47185] Improved code attached for quiver3 and


From: Dave Goel
Subject: [Octave-bug-tracker] [bug #47185] Improved code attached for quiver3 and __quiver__ , making arrowheads actually visible:
Date: Thu, 18 Feb 2016 05:28:06 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?47185>

                 Summary: Improved code attached for quiver3 and __quiver__ ,
making arrowheads actually visible: 
                 Project: GNU Octave
            Submitted by: deego
            Submitted on: Thu 18 Feb 2016 05:28:05 AM GMT
                Category: Plotting
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Other
                  Status: None
             Assigned to: None
         Originator Name: Dave Goel
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

Dear Octave,

The arrowhead drawing in both matlab and octave is a massive hack. In
principle, of course, the arrowhead is a nice round cone. In practice, being
the hack it is, it is a 2-d arrow, and has its own plane. The problem is that
many times, its plane is the "into the screen" plane, which renders the
arrowhead basically invisible.

If you look at this figure, http://gnufans.net/~fsbot/tmp/before.png
, you will see many arrows that are basically invisible. In fact, a user (remo
on #octave) came in complaining about precisely this issue.

Now, compare the before- image with the and after- image here: 
http://gnufans.net/~fsbot/tmp/after.png

The  after-image guarantees that every single arrowhead will be visible. 

In keeping with the hack, the only trick I employed is to use 4 arrows instead
of 2 per arrowhead. You don't readily see them, but every head now has 4
arrows. That's still not a nice round cone around the head, but is much closer
to the concept.

Here is the simple fix I made to __quiver__.m to accomplish this: 
I replaced this code:

## if (is3d)


      ## h2 = plot3 ([xarrw1.'; xend.'; xarrw2.'; NaN(1, length (x))](:),
      ##             [yarrw1.'; yend.'; yarrw2.'; NaN(1, length (y))](:),
      ##             [zarrw1.'; zend.'; zarrw2.'; NaN(1, length (z))](:),
      ##             "linestyle", ls, "color", lc, "parent", hg);


by: 


    if (is3d)

      xarrw3=xarrw1; yarrw3=yarrw2;
      xarrw4=xarrw2; yarrw4=yarrw1;
      nans2=NaN(1,2*length(xend));
      xarrw13=[xarrw1(:); xarrw3(:)];
      xarrw24=[xarrw2(:); xarrw4(:)];
      yarrw13=[yarrw1(:); yarrw3(:)];
      yarrw24=[yarrw2(:); yarrw4(:)];
      zarrw13=[zarrw1(:); zarrw1(:)];
      zarrw24=[zarrw2(:); zarrw2(:)];
      xend11=[xend(:); xend(:)];
      yend11=[yend(:); yend(:)];
      zend11=[zend(:); zend(:)];


      h2 = plot3 ( ...
                   [xarrw13(:), xend11(:),  xarrw24(:), nans2(:)]' ,
                   [yarrw13(:), yend11(:),  yarrw24(:), nans2(:)]' ,
                   [zarrw13(:), zend11(:),  zarrw24(:), nans2(:)]' ,
                   "linestyle", ls, "color", lc, "parent", hg);




It would be wonderful if GNU Octave could incorporate this code or the
equivalent =)

Many thanks,
Dave


 








    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47185>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]