NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
David Selleron wrote: > > Hello, > > How can I paint cells defined with 4 points ( An area used one color) ? > > p(10,10)--------------p(11,10)--------p(12,10) > | | | > | color 1 | color 2 | > | | | > p(10,09)--------------p(11,09)--------p(12,09) > > > if I associate a color to a point with function (x,y) -> (r,g,b), > the differents points are not on intersection of the color area. > When I use these points to draw a regular or scottich grid and color area, > the grid doesn't > defined the border of the differentes color area. > > > p(10,10)-----"---------p(11,10)--"--------p(12,10) > | " | " | > | color 1 " color 2 | color 2 " color 3 | > | " | " | > p(10,09)-----"---------p(11,09)--"--------p(12,09) You are right. The exact locations of the borders between texture pixels is complex and includes calculations inside of Java3D. Furthermore, for a nrows x ncols grid VisAD will make a texture of nrows x ncols pixels, whereas the grid has (nrows - 1) x (ncols - 1) grid interiors. To get exact control over grid box locations, you need to do something like what I described in an earlier email: Another approach is to use something similar to the approach in visad/examples/DelaunayTest.java, except that you will construct a FieldImpl with MathType like: (index -> ((x, y) -> (red, green, blue))) Where the FlatFields ((x, y) -> (red, green, blue)) have Gridded2DSet domains, each with only 4 = 2 x 2 points (one for each grid cell). The ScalarMaps are the usual: x -> XAxis y -> YAxis z -> ZAxis red -> Red green -> Green blue -> Blue But if you have a million grid boxes (as you say below) this will use a lot of memory. You have an unusual problem, combining: 1. the need for solid coloring of grid box interiors 2. irregular spacing of grid points 3. a million points I suspect the answer may need to be a custom DataRenderer, which gives you precise control over how you use Java3D. There is a tutorial on DataRenderers at: http://www.ssec.wisc.edu/~billh/dr_tutorial.html > Bill Hibbard said in another email : > > > This method in visad/DelaunayCustom.java: > > > > public static Irregular2DSet fill(Gridded2DSet set) > > > >will return an Irregular2DSet for the interior of the region > >surrounded by set, assuming it is a Gridded2DSet with manifold > >dimension = 1 that does not self-interset. Note 'fill' connects > >the first and last points of set to make a closed boundary. > > > >Then link the Irregular2DSet to your Display, passing an array of > >ConstantMaps to addReference() to define the color. > > If I have 3 Aeras, I have 3 Irregular2DSet ??? > How link an Irregular2DSet to a color ??? > > I have 1 million of areas, I can't used one Irregular2DSet for each area. > I have only Scottich grid, have you an optimized method to draw grid and > color area of the grid??? This answer that I sent to another user is not relevant to your problem with scotch grids. But the combination of irregular locations and large grid sizes is trouble with both IrregularSets and your scotch grids. Good luck, Bill
visad
archives: