This is really basic, but I'm a humble programmer, not a mathematician, and while working on a small script in which I need to determine a right angle, I realized that I don't really know what the best approach is.

Here's the abstract: I have 3 points, A,B,C, I want to determine if B forms a right angle between A and C. My only thought is to find the angle between A,B and B,C, arbitrarily subtract one from the other, and if the absolute value is 90 then we have a right angle.

Here's the full context: What I'm actually trying to do is, given a bezier curve defined as p1,cp1,cp2,p2 and another random point, pt, I want to find what point along the bezier curve is exactly perpendicular to the the target point(pt). Scary, huh? I have a function which I can use to walk the bezier curve at really small increments, finding points along the way, so eventually I'll find one point on the curve whose angle from previous point on the curve and angle to target point should form a right angle, or at least very close. The closest will be close enough, I hope.

Any help on the right angle is really what I need. Any better ideas on finding a perpendicular point along a bezier curve to a target point would be welcome, too.

Thanks!

- aaron