Learn R Programming

geophys (version 1.4-1)

points2line: Points to Line

Description

Given a point and a matrix of lines, calculate the projection of the vector of the point to the first coordinate of each line and the perpendicular distance.

Usage

points2line(Lp, VL)

Arguments

Lp

Point list (x,y)

VL

Matrix of points, N by 4 as X1, Y1, X2, Y2

Value

list:

rat

cosine projection

srat

sine projection

Details

The first point in the matrix is considered the base.

See Also

REplane

Examples

Run this code
# NOT RUN {

S= stressSETUP()
      pstart()
PLOTbox(S$Rax, S$Rbox, axcol= 'green', boxcol= 'purple')
      PLOTplane(S$Rp, planecol="brown")

 basepoint = 3

        legpoints = c(7,4,2)

   

        VL =   cbind( rep(S$Rbox[basepoint,1] , length(legpoints)),
     rep(S$Rbox[basepoint,2] , length(legpoints)),
          S$Rbox[legpoints,1], S$Rbox[legpoints,2])

      Lp=list() 
Lp$x=c(40.0180732557)
Lp$y=c(40.4847345741)

 G = points2line(Lp, VL )

# }

Run the code above in your browser using DataLab