toCartesian: Converting between Polar and Cartesian Coordinates

Description Usage Arguments See Also Examples

View source: R/Fisheyer_Functions.r

Description

The Cartesian system locates points on a plane by measuring the horizontal and vertical distances from an arbitrary origin to a point. These are usually denoted as a pair of values (X,Y).

The Polar system locates the point by measuring the straight line distance, usually denoted by R, from the origin to the point and the angle of an imaginary line from the origin to the point, q, (Greek letter Theta), measured counterclockwise from the positive X axis.

The conversion math is fairly straightforward:

Polar from Cartesian:

R=Sqrt(x2+y2);

Theta=ArcTan(Y/X);

Cartesian From Polar:

X= R*cos(Theta)

Y= R*sin(Theta)

Usage

1
2
toCartesian(t1, rP)
toPolar(x, y)

Arguments

t1

Theta

rP

Radius

x

x coordinate

y

y coordinate

See Also

atan2, cos, sin

Examples

1
2
   toPolar(1,1)
   toCartesian(toPolar(1,1)[1], toPolar(1,1)[2])

Example output

Loading required package: tkrplot
Loading required package: tcltk
Warning messages:
1: no DISPLAY variable so Tk is not available 
2: loading Rplot failed 
       t1        rP 
0.7853982 1.4142136 
x.rP y.rP 
   1    1 

fisheyeR documentation built on May 2, 2019, 12:47 a.m.