Re: Applying shapes in animation

Hi Jay,

> I have been trying to get shapes at particular x,y and z coordinates in an 
> animation. The x,y and z value also have corresponding r,g and b values to 
> color the points. Now I can see the points but I wanted to display a Cube 
> shape at each point in the animation and then color the Cube according to a 
> particular look up table. I have given some relevant code below. I have seen 
> Test47 and Test46 but could not figure out how to incorporate the shapes with 
> the animation. The setShapeSet method of ShapeControl does not take Set just 
> SimpleSet and I have my time_set as a Set. Can anyone help me with this?

Don't pass your time_set to the ShapeControl. You need a ScalarMap
of some RealType to Display.Shape. Values of this RealType will
define indices into the array of shapes you pass to the setShapes()
method of your ShapeControl, quantized according to the SimpleSet
you pass to setShapeSet(). Remember to call setShapeSet() before
you call setShapes().

If you want a cube at each point, pass 'new Integer1DSet(1)' to
setShapeSet(), then construct a cube as in visad/examples/
and pass it in a singleton array to setShapes(). You can map 'x'
to Shape, since the Integer1DSet(1) with one member means that 'x'
values are ignored.

Good luck,

>  RealType x = RealType.getRealType("x"+stickpid);
>  RealType y = RealType.getRealType("y"+stickpid);
>  RealType z = RealType.getRealType("z"+stickpid);
>  RealType r = RealType.getRealType("red"+stickpid);
>  RealType g = RealType.getRealType("green"+stickpid);
>  RealType b = RealType.getRealType("blue"+stickpid);
>  RealType[] time = {RealType.Time};
>  RealTupleType time_type = new RealTupleType(time);
>  DateTime base = new DateTime(1999, 122, 57060);
>  double start = base.getValue();
>  Set time_set = new Linear1DSet(time_type, start, start + 5.0,max_points);
>  RealTupleType sensor_tuple_t = new RealTupleType(new RealType[] 
> {x,y,z,r,g,b});
>  FunctionType time_samples_sensor_t = new 
> FunctionType(time_type,sensor_tuple_t);
>   FieldImpl image_sequence_sensor4_t = new FieldImpl(time_samples_sensor_t, 
> time_set);
>   for(int i=startframe;i<stopframe;i=i+stepby)
> {
>      double[] sensor_data = 
> {sensor4[i][0],sensor4[i][1],sensor4[i][2],rsen,gsen,bsen};
>    RealTupleIface sensor_sample = new RealTuple(sensor_tuple_t,sensor_data);
>    image_sequence_sensor4_t.setSample(i,sensor_sample);
> }
>  ScalarMap xmap=new ScalarMap(x, Display.XAxis);
>  ScalarMap ymap=new ScalarMap(y, Display.YAxis);
>  ScalarMap zmap=new ScalarMap(z, Display.ZAxis);
>  ScalarMap rmap=new ScalarMap(r, Display.Red);
>  ScalarMap gmap=new ScalarMap(g, Display.Green);
>  ScalarMap bmap=new ScalarMap(b, Display.Blue);
>  ScalarMap map1animation =  new ScalarMap(RealType.Time, Display.Animation);

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