polar_to_cartesian(3f) - [M_pixel:TRIGONOMETRY] convert polar coordinates to Cartesian coordinates (LICENSE:PD)
Synopsis
Description
Options
Results
Examples
Author
License
subroutine polar_to_cartesian(radius,inclination,x,y)
real,intent(in) :: radius,inclination real,intent(out) :: x,y
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)
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).
X The distance along the x-axis Y The distance along the y-axis
examples of usage
program demo_polar_to_cartesian use M_pixel, only : polar_to_cartesian implicit none real :: x,y real :: r,i !!integer :: ios!!INFINITE: do !! write(*,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
John S. Urban
Public Domain
Nemo Release 3.1 | polar_to_cartesian (3m_pixel) | April 21, 2023 |