[UP]


Manual Reference Pages  - cartesian_to_spherical (3)

NAME

cartesian_to_spherical(3f) - [M_units:TRIGONOMETRY] convert Cartesian coordinates to ISO polar coordinates (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Results
Examples
Author
License

SYNOPSIS

subroutine cartesian_to_spherical(x,y,z,radius,inclination,azimuth)

    real,intent(in)  :: x,y,z
    real,intent(out) :: radius,inclination,azimuth

DESCRIPTION

Convert a cartesian point <X,Y,Z> to ISO 8000-2:2009 polar coordinates <radius, inclination, azimuth> with angles in radians using the formulas

      radius=sqrt(x**2+y**2+z**2)
      inclination=acos(z/radius)
      azimuth=atan2(y,x)

OPTIONS

X The distance along the x-axis
Y The distance along the y-axis
Z The distance along the z-axis

RESULTS

RADIUS The radial distance from the origin (O) to the point (P)
INCLINATION
  The zenith angle in radians between the zenith reference direction (z-axis) and the line OP
AZIMUTH
  The azimuth angle in radians between the azimuth reference direction (x-axis) and the orthogonal projection of the line OP of the reference plane (x-y plane).

EXAMPLES

examples of usage

   program demo_cartesian_to_spherical
   use M_units, only : cartesian_to_spherical
   implicit none
   real    :: x,y,z
   real    :: r,i,a
   integer :: ios
   INFINITE: do
      read(*,*,iostat=ios) x, y, z
      if(ios.ne.0)exit INFINITE
      call cartesian_to_spherical(x,y,z,r,i,a)
      write(*,*)’x=’,x,’ y=’,y,’ z=’,z,’radius=’,r,’inclination=’,i,’azimuth=’,a
   enddo INFINITE
   end program demo_cartesian_to_spherical

AUTHOR

John S. Urban

LICENSE

Public Domain


cartesian_to_spherical (3) March 11, 2021
Generated by manServer 1.08 from b71c6ea7-68a6-4a39-a4bf-cda09233717b using man macros.