This is kind of an embarrassing one.

I’m trying to draw a perpendicular line to two given vectors and I can’t work it out for the life of me. I suppose what I’m receiving with atan (or PVector.getAngle) is not what I was expecting… ie a degree returned within 360 degrees.

```
size(400,400)
nx1, ny1 = 200,100
nx2, ny2 = 100,300
noFill()
strokeWeight(3)
stroke(255,0,0)
line(nx1,ny1, nx2, ny2)
nx3 = nx2-((nx2-nx1)/2)
ny3 = ny2-((ny2-ny1)/2)
ellipse(nx3,ny3,20,20)
stroke(255,255,0)
a = atan2(ny2-ny1, nx2-nx1)
print "angle", a
print "angle deg", degrees(a)
r = 100 # max addition push
a-=90
linex = r * cos(a)
liney = r * sin(a)
line(nx3, ny3, nx3+linex, ny3+liney)
```