Description Usage Arguments Examples
computes the position of a projected point in the basis formed by a segment
1 | projpointonseg_a(p, s, method = "euclidean")
|
p |
a numeric vector of length 2 |
s |
a 2x2 numeric matrix, representing a segment. Each row of the matrix are the coordinates of a extreme point of the segment. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | zz<-function(p){
s=matrix(c(0,1,0,0),2,2)
plot(s,type="l",xlim=c(-.5,1.5),
xlab="",ylab="",
xaxt='n',yaxt='n')
points(x=p[1],y=p[2] ,col="red",cex=2)
points(closestpointonseg(p,s)[1],closestpointonseg(p,s)[2],col="red",cex=2)
segments(x0 = p[1],y0=p[2],x1=closestpointonseg(p,s)[1],y1=closestpointonseg(p,s)[2],col="red")
text(projpointonseg_a(p,s),-.8,paste0("a=",projpointonseg_a(p,s)))}
par(oma=c(0,0,0,0),mfrow=c(1,4))
zz(c(-.5,1))
zz(0:1)
zz(c(.5,1))
zz(c(1.5,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.