Math Help?

Scott Rossi scott at
Fri Apr 30 16:43:47 EDT 2010

Recently, Jeff Massung wrote:

> Given a line segment AB, and a point C, take the dot product of AC * AB:
> dot = [(B-A).x * (C-A).x] + [(B-A).y * (C-A).y]
> The dot product (of two, normalized vectors) will give you the cosine of the
> angle between them. You actually don't care about the cosine, but the cosine
> of [0,90] will be >= 0 and the cosine of (90,180] will be < 0. That's all
> you care about.
> So, if you have a triangle made up of points A,B,C and a random point D, you
> can do:
> dot[0] = AD * AB
> dot[1] = BD * BC
> dot[2] = CD * CA
> If any of those dot products are negative, then the point is outside the
> triangle. If all of them are positive, then the point is inside the
> triangle.

Dot products... normalized vectors... head starting to spin... vision
getting blurry... 

OK, Jeff, so does (B-A).x mean the x coordinate of point B minus the x
coordinate of point A?

Thanks & Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design

More information about the Use-livecode mailing list