distance <- function(x1,y1,x2,y2) sqrt((x1-x2)^2+(y1-y2)^2) aligned <- function(x1,y1,x2,y2,x3,y3,e) abs(distance(x1,y1,x2,y2)-distance(x1,y1,x3,y3))