Learn R Programming

geophys (version 1.2-1)

TriangleInfo: Triangle Information

Description

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

Usage

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

Value

  • list
  • BIx,y location of center of inscribed circle
  • CIRCUMx,y location of center of circumscribed circle
  • IHx,y location of Intersection of bisectors
  • CENcentroid location
  • rradius of inscribed circle
  • Rradius of circumscribed circle
  • AngBisloci of vectors bisecting each corner on opposite leg
  • Hlengths of altitudes
  • Mlengthsof medians
  • TEElengths of perpendiculars
  • AreaArea of triangle

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 .

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

Run this code
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)

Run the code above in your browser using DataLab