$\begingroup$

i am given with a triangle and and i read here that i can cross product of the two sides of a triangle gives it orientation. what does cross product of sides of a triangle mean. here is the formula:

/ Input VECTOR a, b, c; // the parts of our triangle. // if (b.x - a.x) * (c.y - b.y) - (c.x - b.x) * (b.y - a.y) > 0 // we are counter-clockwise 
$\endgroup$3

1 Answer

$\begingroup$

It is not necessary at all to use cross product.

A more reasonable approach is to consider that the expression above is a determinant

$$(b.x - a.x) * (c.y - b.y) - (c.x - b.x) * (b.y - a.y)=$$

$$\left|\matrix{(b.x - a.x) & (c.x - b.x) \\ (b.y - a.y) & (c.y - b.y)}\right|=det(\vec{AB},\vec{BC})$$ This determinant has a natural geometric meaning: it is twice the area of triangle ABC, with a sign: this area being the usual area (positive) with a sign that depends on the orientation of ABC: if one turns in the trigonometric orientation (resp. its inverse), the determinant is positive (resp. negative, i;e;, the opposite of the positive value found).

See the nice explanations in (Why determinant of a 2 by 2 matrix is the area of a parallelogram?)

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy