Home > SPlaC v1_0 > Mie > GEN > GenGetStPtSph.m

GenGetStPtSph

PURPOSE ^

Get spherical coordinates for a point in Cartesian coordinates

SYNOPSIS ^

function stPtSph=GenGetStPtSph(stPt)

DESCRIPTION ^

 Get spherical coordinates for a point in Cartesian coordinates

 - Parameters: structure stPt with fields x,y,z (possibly arrays)

 - Returns: structure stPtSph with fields r, theta, phi (same size as
 x,y,z)

 This file is part of the SPlaC v1.0 package (copyright 2008)
 Check the README file for further information

EXAMPLE OF OUTPUT ^

Example figure output

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 stPtSph.r=sqrt( (stPt.x).^2 + (stPt.y).^2 + (stPt.z).^2);
0002 % use atan2 to avoid infinities problems
0003 stPtSph.theta=pi/2-atan2(stPt.z,sqrt((stPt.x).^2+(stPt.y).^2));
0004 stPtSph.phi=atan2(stPt.y,stPt.x);
0005

This web page is part of the SPlaC package © 2008. Contact: Eric Le Ru
Generated on Wed 03-Dec-2008 11:10:14 by m2html © 2003 (adapted)