comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Newbie question (w/colorful points)...
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Newbie question (w/colorful points)... [message #23287 is a reply to message #23286] Wed, 17 January 2001 20:08 Go to previous messageGo to previous message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
RandyStack wrote:

> << As to the fastest way to create the array, I'm
> not sure I can decipher how a 8192 vector
> relates to a 512x512 array. >>
>
> The 8192-element vector just contains the coordinates that I need to plot.
> Basically...
>
> xy(n,0)=x coordinate for point n (values 0-511)
> xy(n,1)=y coordinate for point n (values 0-511)
> hls(n,0)=hue for point n
> hls(n,1)=luminance for point n
> hls(n,2)=saturation for point n
>
> Without IDL, I'd normally go something like...
>
> declare mat(512,512,3)
> loop n from 0 to 8191
> mat(xy(n,0),xy(n,1),0)=hls(n,0)
> mat(xy(n,0),xy(n,1),1)=hls(n,1)
> mat(xy(n,0),xy(n,1),2)=hls(n,2)
> end loop
>
> ...then convert the resulting 512x512 HLS matrix mat() to RGB for display. Was
> just looking for a more expedient way to handle this in IDL rather than
> looping.
>
> Thanks,
> ~Randy

Hi Randy,

you can speed the thing up using matrix operations:

mat0=mat[*,*,0]
mat0[ xy[*,0], xy[*,1]]=hls[*,0]

mat1=mat[*,*,1]
mat1[ xy[*,0], xy[*,1]]=hls[*,1]

mat2=mat[*,*,2]
mat2[ xy[*,0], xy[*,1]]=hls[*,2]

mat[*,*,0]=mat0
mat[*,*,1]=mat1
mat[*,*,2]=mat2

In IDL the expression:
a[v1,v2,...vn] with a=n dim array, v1,v2,...vn=1 dim arrays
is a n dimensional array if the size of v1, v2, .. vn differ and one dimesional
is the size of v1,v2,...vn are the same.

cheers,
:-) marc
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Filling an array
Next Topic: Tiltmeter

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 17:35:23 PDT 2025

Total time taken to generate the page: 1.99988 seconds