Re: Animated Line 2D

Hello Rakesh,

Rakesh Rathod wrote:
Hi everyone,
I used code from P5_01 to get animated line.I want animated line that gradually rises in X-Y plot.But as soon as i set the samples in FlatField all other values are initiated with zero.

Have you tried initializing the zero values with Float.Nan. Those won't be drawn, and in the next steps you gradually substitute those with your values.
Is there any way around by which i can show a line gradually from ie..(1,1)-->(2,2)..sleep..(2,2)-->(3,3) and so on.

On the other hand, if your line is a "string", something like a flying worm ;-), then consider usig another MathType and Data object than those of P5_1.

The line can be modelled by a

Gridded2DSet(MathType type, float[][] samples, int lengthX)
a 2-D set with manifold dimension = 1, with null errors, CoordinateSystem and Units are defaults from type

where samples is

float[][] samples = new float[]{{xo,xn},{yo,yn}}; // simple line

or even

float[][] samples = new float[]{{xo,x1,...,xn},{yo,y1,...,yn}}; // a polyline

No need for a FlatField here. After each thread.sleep you recreate samples (and also the set) and call
data.Ref.setData( yourGridded2DSet);

A line in 3D uses a 3D set with samples like float[][]{{x_vals},{y_vals},{z_vals}}

(I think the visad.examples.VisuTraj has such an approach.)


Hope this helps,


Ugo

Rakesh
------------------------------------------------------------------------
Do you Yahoo!?
SBC Yahoo! DSL <http://pa.yahoo.com/*http://rd.yahoo.com/evt=1207/*http://promo.yahoo.com/sbc/> - Now only $29.95 per month!


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