Re: Data structuring for a mesh of convex polygons

Hi Ajay,

> I am having performance problems with displaying a mesh, and am
> not sure if I have modelled it properly. Perhaps some detail will make
> this clearer... (please bear with me... :-))
> 
> --------------------------------------------------------------------------
> 
> I have been trying to create an application that can draw a mesh of
> 'nodes', where the nodes are convex polygons, that are defined by corner
> points, each having an x and a y coordinate.
> 
> It would look something like,
> 
> ----------------------
> |  |2 /  |   | 7/     |
> |1 | /   |   | /   8  |
> |  |/ 3  | 4  /-------|
> |--|---------/
> |      \     |
> |  5    \  6 |
> -------------| , say, for a mesh with 8 nodes.
> 
> What is required is to draw an outline of the node, and also to fill
> the node with colour. This has been done already, using Gridded2DSets
> to draw the outline of the node, and Irregular2DSets for filling the node
> with colour. For the outline, I have a FlatField, with the Gridded2DSet as
> the domain, and range mapping to RGB, then a FieldImpl with domain a
> simple index, and range having all the FlatFields, like
> (index -> ((x,y) -> (r,g,b))), where the index indicates the node being
> dealt with.
> 
> -----------------------------------------------------------------------------
> 
> So, the question really boils down to whether modelling this problem
> in this way is the best possible. I have been having considerable
> performance problems by modelling a large number of nodes like this, since
> there are many data references which get added to the display (one for
> each node), and the rendering is very slow. Bill has been gracious to give
> me some suggestions for speeding things up, for instance to call the
> disableAction() method on the display, before adding data references, and
> then enabling it again. However, the performance is still quite poor.

I am not sure why you need a DataReference for each node, since the
single FieldImpl object with MathType (index -> ((x,y) -> (r,g,b)))
includes all nodes and can be linked to the Display via a single
DataReference.

If using a single DataReference in this way does not speed things
up enough, you might try combining all your Irregular2DSets in a
single UnionSet, then using it as the domain Set of a single
FlatField in pleace of your FieldImpl. The FlatField would have
MathType ((x,y) -> (r,g,b)). The number of range (r, g, b) values
would be the sum of the number of points in your Irregular2DSets.
The range (r, g, b) values corresponding to an Irregular2DSet
would take the color value associated with that Set. This would
probably be faster than the FieldImpl.

Please let me know if you have any problems.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


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