[UP]


Manual Reference Pages  - polar_to_cartesian (3)

NAME

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

CONTENTS

Synopsis
Description
Options
Results
Examples
Author
License

SYNOPSIS

subroutine polar_to_cartesian(radius,inclination,x,y)

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

DESCRIPTION

Convert polar coordinate <radius, inclination > with angles in radians to cartesian point <X,Y> using the formulas

      x=radius*cos(inclination)
      y=radius*sin(inclination)

OPTIONS

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

RESULTS

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

EXAMPLES

examples of usage

   program demo_polar_to_cartesian
   use M_units, only : polar_to_cartesian
   implicit none
   real    :: x,y
   real    :: r,i
   integer :: ios
   INFINITE: do
      write(*,’(g0)’,advance=’no’)’Enter radius and inclination(in radians):’
      read(*,*,iostat=ios) r, i
      if(ios.ne.0)exit INFINITE
      call polar_to_cartesian(r,i,x,y)
      write(*,*)’x=’,x,’ y=’,y,’radius=’,r,’inclination=’,i
   enddo INFINITE
   end program demo_polar_to_cartesian

AUTHOR

John S. Urban

LICENSE

Public Domain


polar_to_cartesian (3) March 11, 2021
Generated by manServer 1.08 from 0b81a8d0-b06f-46f1-8ced-01a186505c33 using man macros.