if (FALSE) {
A<-c(1,1); B<-c(2,0); C<-c(1.5,2); p<-c(1.4,1.2)
Tr<-rbind(A,B,C)
in.triangle(p,Tr)
p<-c(.4,-.2)
in.triangle(p,Tr)
#for the vertex A
in.triangle(A,Tr)
in.triangle(A,Tr,boundary=FALSE)
#for a point on the edge AB
D3<-(A+B)/2
in.triangle(D3,Tr)
in.triangle(D3,Tr,boundary=FALSE)
#for a NA entry point
p<-c(NA,.2)
in.triangle(p,Tr)
}
Run the code above in your browser using DataLab