polar2cart: Polar to cartesian

Description Usage Arguments Examples

View source: R/functions.r View source: R/polar2cart.r

Description

Converts polar co-ordinates to the cartesian system.

Usage

1
polar2cart(x, y, dist, bearing, as.deg = FALSE)

Arguments

x

The X cartesian co-ordinate of the point of origin.

y

The y cartesian co-ordinate of the point of origin.

dist

The distance (m) of each point from the point of origin.

bearing

The polar bearing of each point to convert.

as.deg

Logical. If true the polar bearing is in degrees.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Close any previously open graphic devices
graphics.off()

## Load the data
data(fluxes)

## Set the point of origin
x=0;y=0

## Use wind direction, distance and distance from the tower to convert
## to cartesian co-ordinates
pol<-polar2cart(x,y,fluxes$x_90.,fluxes$wind_dir,as.deg=TRUE)

## Plot the distance from the tower
plot(pol,xlab='X (m)',ylab='Y (m)',pch=16,cex=0.6)

## Add also the tower point
points(0,0,col=2,pch=16,cex=1.2)

Example output



FREddyPro documentation built on May 29, 2017, 7:22 p.m.