Re: [idvusers] Better flow vector arrow rendering, how?

It turns out that anti-aliasing is not the problem.  There were two things I 
did to get better arrow heads, and I've attached the before and after images.  
Note that I also switched to coloring the arrows using "One value colored by 
another"

First, I extended the length of the arrow head lines by setting BACK_SCALE to 
-0.35f on line 2664 of ShadowType.java.   This provided a moderate improvement 
since more pixels were being drawn for the arrow head, but the heads on 
horizontally oriented flow vectors were still didn't look like the heads on the 
vertically oriented vectors.

Second, and more importantly, I increased the amount of Y offset for the 
perpendicular component of the arrow head ends by the X aspect ratio value for 
the display.  My display has the aspect ratio values of X=2.3, Y=1.0, Z=0.4.   
Lines 2743 to 2746 became:

          a0 += PERP_SCALE * f1;
          a1 -= PERP_SCALE * f0 * 2.3;
          b0 -= PERP_SCALE * f1;
          b1 += PERP_SCALE * f0 * 2.3;

This fixes the difference in appearance between the horizontally and vertically 
oriented arrow heads.

Finally, I switched the arrows to "One value colored by another" so they could 
be colored relative to the underlying view, for a subtler look.

Ken


________________________________
 From: Don Murray (NOAA Affiliate) <don.murray@xxxxxxxx>
To: idvusers@xxxxxxxxxxxxxxxx 
Sent: Wednesday, July 31, 2013 8:54 AM
Subject: Re: [idvusers] Better flow vector arrow rendering, how?
 

Hi Ken-

I was hoping someone else would answer your question. ;-)  I think the 
main issue is anti-aliasing.  The vector is just 3 lines (2 for the 
arrow head, 1 for the arrow shaft).  You could also try setting the line 
width so the aliasing is not as much of a factor.

An alternative to changing the VisAD code would be to create your own 
DataRenderer and override the getDataRenderer method of 
ucar.visad.display.FlowDisplayable.  That's what I did to change the 
default behavior of WindBarbDisplayable.

There are examples of other flow DataRenderers (e.g. SwellRendererJ3D()) 
in the visad.bom class.

Don

On 7/31/13 12:16 PM, Ken Ellinwood wrote:
> Answering my own question... the relevant code appears to be in 
> visad.ShadowType.makeFlow().  I'll switch to the visad mailing list for 
> anything else on this issue.
>
> Ken
>
>
>
> ________________________________
>   From: Ken Ellinwood <kellinwood@xxxxxxxxx>
> To: "idvusers@xxxxxxxxxxxxxxxx" <idvusers@xxxxxxxxxxxxxxxx>
> Sent: Friday, July 26, 2013 3:32 PM
> Subject: [idvusers] Better flow vector arrow rendering, how?
>
>
> See the attached image which shows wind speed in a colored filled contour 
> display and the wind direction via a vector plan view.  I'm hoping to get 
> better quality arrow rendering in the vector plan view.  When the arrows are 
> oriented horizontally the arrow heads disappear and I'm hoping to fix this 
> somehow, even if it means modifying the code.  I've got the IDV, Visad, and 
> NetCDF code for the the 4.0u1 release loaded into my IDE.  I've been 
> searching and setting breakpoints hoping to figure out where the arrows are 
> rendered, but haven't stubled up on it yet.  Any clues?
>
> Thanks,
>
> Ken
> _______________________________________________
> idvusers mailing list
> idvusers@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit: 
> http://www.unidata.ucar.edu/mailing_lists/
> _______________________________________________
> idvusers mailing list
> idvusers@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, visit: 
> http://www.unidata.ucar.edu/mailing_lists/
>

-- 
Don Murray
NOAA/ESRL/PSD and CIRES
303-497-3596
http://www.esrl.noaa.gov/psd/people/don.murray/

_______________________________________________
idvusers mailing list
idvusers@xxxxxxxxxxxxxxxx
For list information, to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/ 

Attachment: multi_1.glo_30m.t00z.f003.wind-north-pacific-2.png
Description: PNG image

Attachment: multi_1.glo_30m.t00z.f003.wind-north-pacific-3.png
Description: PNG image