Hi All-
First, thanks to Bill for doing this. I've added
a couple of notes below.
Bill Hibbard wrote:
>
> I just but a new release of VisAD on the server, that
> supports 3-D clipping. See visad/examples/Test35.java
> for an example.
>
> Applications can set up to six arbitrarily oriented clipping
> planes using a new method of DisplayRendererJ3D:
>
> /** define a clipping plane in (XAxis, YAxis, ZAxis) space
> plane number must be in (0, ..., 5)
> clip plane defined by ax + by + cz + d <= 0
> */
> public void setClip(int plane, boolean enable, float a, float b, float c,
> float d)
> throws VisADException;
>
> This only clips data depictions, not axis scales etc.
> From Test35.java, to clip to the usual box (i.e., x, y and
> z values in the range -1.0 to +1.0), do:
>
> DisplayRendererJ3D dr = (DisplayRendererJ3D) display.getDisplayRenderer();
> dr.setClip(0, true, 1.0f, 0.0f, 0.0f, -1.0f);
> dr.setClip(1, true, -1.0f, 0.0f, 0.0f, -1.0f);
> dr.setClip(2, true, 0.0f, 1.0f, 0.0f, -1.0f);
> dr.setClip(3, true, 0.0f, -1.0f, 0.0f, -1.0f);
> dr.setClip(4, true, 0.0f, 0.0f, 1.0f, -1.0f);
> dr.setClip(5, true, 0.0f, 0.0f, -1.0f, -1.0f);
>
Comments:
1) In the snippet above, you might want to use something slightly
smaller than -1.0f (e.g. -1.01 or -1.1). On my Windows machine,
I found that anything rendered in Z plane rendered at 1.0 or
-1.0 would waft in and out of the display as it was rotated.
Changing the -1.0 to -1.01f fixed this.
2) Clipping only works if you are using a version of Java3D
that is >= 1.2. The code determines this automagically
and if you are running with Java3D 1.1.x and try to call setClip,
a DisplayException will be thrown. So, let the buyer beware
when you use this method.
Don
*************************************************************
Don Murray UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx P.O. Box 3000
(303) 497-8628 Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************