dirSeg {pgirmess} | R Documentation |
Computes the direction of segments from the first top clockwise (North = 0)
dirSeg(x,deg=TRUE)
x |
a matrix or data frame of 4 columns giving the coordinates of each segment tops x1, y1, x2, y2 |
deg |
if TRUE (default) the output is in degrees, otherwise in radians |
The first two colomns give the first top coordinates, x then y, and the next two the second top coordinates.
A vector of directions
code{dirProj}, code{gzAzimuth}
x2<-rnorm(10) y2<-rnorm(10) mydata<-cbind(0,0,x2,y2) dirs<-dirSeg(mydata) dirs plot(range(mydata[,c(1,3)]),range(mydata[,c(2,4)]),type="n") Segments(mydata) text(mydata[,3],mydata[,4],paste(round(dirs,0),"°"),cex=0.7)