Question: Please help explain the logic behind the return statement in function turn. Is that a formula from Geometry? How did the someone think that? Please

Please help explain the logic behind the return statement in function turn. Is that a formula from Geometry? How did the someone think that? Please help find how that was formed. :

int turn( int x1, int y1, int x2, int y2, int x3, int y3 ) {

return (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1);

}

This program to determine the direction made by points in a quadrant where if the result returned by function turn is

= 0 then it is a straight line

> 0 then it is left turn

< 0 then it is a right turn.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!