# cross product of sides of a triangle

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

• The absolute value of cross product of two sides of triangle gives you the half of area of triangle formed by these two vectors. – arberavdullahu Nov 3 '16 at 21:31
• @arberavdullahu: I think you mean twice, not half. :) – Blue Nov 3 '16 at 21:35
• Yeah I meant the half of absolute value gives the area :), thank you @Blue – arberavdullahu Nov 3 '16 at 21:38

## 1 Answer

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?)