TriangleInfo: Triangle Information

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/TriangleInfo.R

Description

Given a triangle (three non-colinear points, return info that is useful

Usage

1
TriangleInfo(P1, P2 = c(0, 1), P3 = c(1, 0), add = FALSE)

Arguments

P1

vector or list(x,y) of 2D point 1

P2

vector or list(x,y) of 2D point 2

P3

vector or list(x,y) of 2D point 3

add

logical, if TRUE add a variety of lines to the plot

Details

If either P1 P2 or P3 are an x,y list, they are converted to vectors.

If P2 and P3 are missing, P1 contains all the points. Input can be list of 3 x,y values, a 3 by 2 matrix .

Value

list

BI

x,y location of center of inscribed circle

CIRCUM

x,y location of center of circumscribed circle

IH

x,y location of Intersection of bisectors

CEN

centroid location

r

radius of inscribed circle

R

radius of circumscribed circle

AngBis

loci of vectors bisecting each corner on opposite leg

H

lengths of altitudes

M

lengthsof medians

TEE

lengths of perpendiculars

Area

Area of triangle

Author(s)

Jonathan M. Lees<[email protected]>

References

http://en.wikipedia.org/wiki/Triangle_center

http://en.wikipedia.org/wiki/Encyclopedia_of_Triangle_Centers

See Also

Intersect2points, Sect2vex, AXB.prod, TriangleCenter, rot2Zplane

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
P1 = runif(2)
P2 = runif(2)
P3 = runif(2)

  

theX = c(P1[1],P2[1], P3[1])
theY = c(P1[2],P2[2], P3[2])


        plot(theX , theY, asp=1)
        
        
        points(theX , theY)
        text(theX , theY, labels=1:3, pos=3)
        lines(c(theX, theX[1]), c(theY, theY[1]) )

TriangleInfo(P1, P2, P3, add=TRUE)
#####    TriangleInfo(rbind(P1, P2, P3),   add=TRUE)

geophys documentation built on May 29, 2017, 3:05 p.m.