dirSeg: Computes segment directions.

View source: R/dirSeg.r

dirSegR Documentation

Computes segment directions.

Description

Computes the direction of segments from the first top clockwise (North = 0)

Usage

dirSeg(x,deg=TRUE)

Arguments

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

Details

The first two colomns give the first top coordinates, x then y, and the next two the second top coordinates.

Value

A vector of directions

See Also

dirProj, gzAzimuth

Examples


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),"\u00b0"),cex=0.7)
  

pgirmess documentation built on April 8, 2023, 1:12 a.m.

Related to dirSeg in pgirmess...