NORMvec: Plot Normal Vector

Description Usage Arguments Value Note Author(s) See Also Examples

Description

Calculate and plot a normal vecotor to a plane

Usage

1
NORMvec(PPs, xscale, Rview, aglyph = list(), add = TRUE)

Arguments

PPs

Points for plotting, these define the plane

xscale

scale for the figure

Rview

viewing matrix

aglyph

glyph for plotting the normal vector in 3D

add

logical, whether to add to current plot

Value

Graphical Side effects

Note

Used internally

Author(s)

Jonathan M. Lees<jonathan.lees@unc.edu>

See Also

pstart, PLOTbox, PLOTplane, stress

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#######    set colors
 axcol = 'black'
 boxcol = 'blue'
 planecol = 'brown'

####   view angle
 Rview  =    RFOC::ROTZ(-130) 

###   set arbitrary scale
    xscale = 100

###  set glphy for plotting 3D vectors
 headlen =xscale* .3/6
       len =xscale* .7/6
       basethick =xscale* 0.05/2
       headlip =xscale* .02/2
       aglyph = RFOC::Z3Darrow(len = len , basethick =basethick ,
             headlen =headlen , headlip=headlip )

####   set three points and combine them with rbind
     P1 = xscale*c(.2, 1,1,0)
    P2 = xscale*c(1, .1,1,0)
    P3 = xscale*c(1, 1,.4,0)

    PPs = rbind(P1, P2, P3)
    
  ###  convert points for view
Rp = PPs  

###   create box  and scale it
   BOX <-matrix(c(0,0,0,0,
            0, 1, 0,0,
            0, 1, 1,0,
            0, 0, 1,0,
            1,0,0,0,
            1, 1, 0,0,
            1, 1, 1,0,
            1, 0, 1,0), ncol=4, byrow=TRUE)


    BOX = xscale*BOX

    ##############   create axes and scale them
AX = matrix(c(0,0,0,0,
            1, 0, 0,0,
            0, 0, 0,0,
            0, 1, 0,0,
            0,0,0,0,
            0, 0, 1,0), ncol=4, byrow=TRUE)

    AX = 1.5*xscale*AX

 ##############   rotate axes and box
    Rax =  AX 

    
          Rbox =   BOX 

 ##############  start the figure
pstart(xscale=xscale)
 ######  plot the box
PLOTbox(Rax, Rbox, axcol= 'black', boxcol= 'blue')
 ##############  plot the plane
PLOTplane(Rp)

#######  plot the normal
 NN = NORMvec(PPs, xscale, Rview,aglyph=aglyph, add=TRUE)

geophys documentation built on May 1, 2019, 9:26 p.m.