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

I wonder if there's a way to get the display aspect ratio values via an API 
call, and not hard-code them like I did?



________________________________
 From: Don Murray <don.murray@xxxxxxxx>
To: Ken Ellinwood <kellinwood@xxxxxxxxx> 
Cc: "idvusers@xxxxxxxxxxxxxxxx" <idvusers@xxxxxxxxxxxxxxxx> 
Sent: Monday, August 12, 2013 5:19 AM
Subject: Re: [idvusers] Better flow vector arrow rendering, how?
 

Hi Ken-

thanks for looking into this.  We're going to evaluate these changes to 
see if it makes sense to roll them into VisAD.

Don

On 8/8/13 1:30 PM, Ken Ellinwood wrote:
> 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 <mailto:kellinwood@xxxxxxxxx>>
>  > To: "idvusers@xxxxxxxxxxxxxxxx <mailto:idvusers@xxxxxxxxxxxxxxxx>"
> <idvusers@xxxxxxxxxxxxxxxx <mailto: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 <mailto:idvusers@xxxxxxxxxxxxxxxx>
>  > For list information, to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
>  > _______________________________________________
>  > idvusers mailing list
>  > idvusers@xxxxxxxxxxxxxxxx <mailto: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 <mailto:idvusers@xxxxxxxxxxxxxxxx>
> For list information, to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
> <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/