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

Home » Public Forums » archive » Centroid computation for a 3D array in PV-Wave
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Centroid computation for a 3D array in PV-Wave [message #10727] Fri, 09 January 1998 00:00
Nagesh Mallugari is currently offline  Nagesh Mallugari
Messages: 4
Registered: April 1997
Junior Member
Hi!
Can anybody suggest an efficient way to compute a centroid for 3D
array in PV-Wave?
Thanks to David Foster of UCSD, he forwarded a couple of methods of
centroid computation for a 2D array in IDL which he saved from the
discussions on this news group. The following are the methods:

> sz = size(array)
> xcoors = indgen(sz(1)) # replicate(1,sz(2))
> ycoors = replicate(1,sz(1)) # indgen(sz(2))
>
> xcg = total(array*xcoors)/total(array)
> ycg = total(array*ycoors)/total(array)

---------------------------


sz = size(array)
tot = total(array)

xcg = total(total(array,2)*indgen(sz(1)))/tot
ycg = total(total(array,1)*indgen(sz(2)))/tot



But PV-Wave does not allow the usage of 'Total' function as in the second
form of the code. And though I understood how the first form of code works
for 2D centroid computation, I could not extend it to work for a 3D array.
Any suggestions will be appreciated.

thanks,
Nagesh
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Digital Chart of the World (GTOPO30) in IDL?
Next Topic: IDL Course in Denmark

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

Current Time: Wed Oct 08 19:42:45 PDT 2025

Total time taken to generate the page: 0.00533 seconds