Re: Small error in point position, also rendering-order question

  • To: Ian Graham <ian@xxxxxxxxxx>
  • Subject: Re: Small error in point position, also rendering-order question
  • From: Bill Hibbard <billh@xxxxxxxxxxxxx>
  • Date: Fri, 13 Jun 2003 04:59:02 -0500 (CDT)
Hi Ian,

> I've discovered that points of a plot are not being plotted centred around
> the correct position.  Instead they're plotted with the lower left corner at
> that position.  I'm using a DisplayImplJ2D  to show a scatterplot of
> (index->(x,y,z,label)).  You can easily verify this by changing the point
> size of a plot.  I'm under pressure right now with some other stuff, so I'm
> hoping someone else who knows the VisAD code better could fix it more
> easily.

Thanks for finding this. The fix is in the visad_src-2.0.jar
and visad.jar files at:

> Also, I'm plotting both points and labels.  Is it really necessary to force
> only one renderer to be employed?  As it is it seems I have to create a
> completely separate set of types (index->(textX,textY,textLabel)) to display
> my text.  I'm sharing the same data values for the separate data reference,
> but I would have thought it common to do something like this, and it seems a
> shame to be going through all the coordinate transformations multiple times.
> But that bothers me less than the fact that my app has to manage all the
> separate maps and controls and axes for such a simple requirement.

The approach of most visualization systems is to have lists
of functions for all the most common operations, such as
plotting points with labels. Those systems also generally
have enumerated lists of the various types of data they handle.
NCAR Graphics and McIDAS are classic examples of such systems.

The VisAD approach to generality is different. It defines a
few basic elements that can be combined to create arbitrary
data and displays. This is ultimately much more flexible, but
is not as convenient as the long list of options. We are
developing Python libraries for supporting the more convenient
list of options approach. Furthermore, when VisAD's reductionist
approach lacks efficiency, it allows applications to define
custom DataRenderers.

> I'm also concerned about the order that my various data references are
> rendered.  Ugo's tutorial example for showing isocontours over an image
> works correctly, adding the data_ref first and then the iso_data.  But I'm
> finding that in order to have my text on top of my points I'm having to add
> the data reference for my text first, and then the data reference for my
> points.  So that must mean that the rendering order is actually defined by
> some other means that I'm unaware of.  How _is_ the rendering order defined?

In a DisplayImplJ2D, depictions using points and lines are
rendered after depictions using triangles and textures, so
that points and lines will be in front of triangles and
textures. Within these two general categories, data are
rendered in the INVERSE order of their addReference() calls.

In a DisplayImplJ3D, data are rendered in the order of their
addReference() calls (this inconsistency with DisplayImplJ2D
was caused by confusion with early versions of Java3D). In a
DisplayImplJ3D with a TwoDDisplayRendererJ3D, implicit ZAxis
offsets are used to put points and lines in front of triangles
and textures.

> And one last thing.  The text control allows me to control justification,
> but I'd also like to offset the text slightly by a consistent amount and I
> don't see an easy way to do so.  The need for this is clear if I'm drawing
> both points and text and I don't want them to overlap.

You can offset your text (or other data depictions) spatially by
ScalarMaps and ConstantMaps to Display.XAxisOffset, Display.YAxisOffset
and Display.ZAxisOffset.

Good luck,

  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: