|
|
> Suppose you have a line from point A to point B. Compute the vector AB,
> dot product V . A and call it k.
If you do this in 2D, minus the unnecessary normalization, the math is
equivalent to doing the 3D cross product while ignoring the components you
know to be 0.
inline vec_t Vec2Cross( const vec2_t v1, const vec2_t v2 )
{
return v1[0] * v2[1] - v1[1] * v2[0];
}
If the result is positive, v2 points to the "left" of v1, otherwise it
points to the "right".
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
|