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

Home » Public Forums » archive » 'vectorizing functions'
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
'vectorizing functions' [message #52524] Tue, 06 February 2007 03:58
leatherback is currently offline  leatherback
Messages: 15
Registered: November 2005
Junior Member
Dear All,

I am working on a script to convert a whole series of x-y coordinates
into path-descriptions:

- Distance between two points
- Angle compared to <0,1> vector
- Angle between consecutive steps

I -think- I have a function which calculates the angle between 2
vectors. However, as I have long lists of points (At the moment some 3
million, and growing with 100/hr) I would like to do this based on
blocks of data, and use the IDL ability to do array-calculations.. I
have written a buffer-reader for my data, which will allow me to read
chunks of data from a file. I would like to process each chunk in one
go, instead of one point at a time. Could somebody perhaps assist me
in converting the functions I have written, and accept points [x,y],
to functions that will operate on arrays [[x], [y]] of points?

Thanks!

The functions:

function calculate_length, vector

length = sqrt(vector[0]^2 + vector[1]^2)
return, length

end

;--------------------

function calculate_angle, vector1, vector2

; Length of the two vectors
length1 = calculate_length(vector1)
length2 = calculate_length(vector2)

;==> Before running check whether Cos_theta=0 is valid in all cases.
Prob. not! <==
if ((length1 EQ 0) or (length2 EQ 0)) THEN begin

Cos_theta = 0

endif else begin

Cos_theta = (TRANSPOSE(vector1) # vector2) / (length1 * length2)

endelse

Theta = ACOS(Cos_theta) * (180 / !pi)

return, Theta

end
[Message index]
 
Read Message
Previous Topic: Orthorectification (quickbird), RPC, APM
Next Topic: IDLDE Custom Layout

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

Current Time: Sun Oct 12 05:23:43 PDT 2025

Total time taken to generate the page: 0.48205 seconds