Description Usage Arguments Examples
View source: R/functions.r View source: R/polar2cart.r
Converts polar co-ordinates to the cartesian system.
1 | polar2cart(x, y, dist, bearing, as.deg = FALSE)
|
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. |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.