Determine whether the triangle is clockwise or clockwise.
Source: Internet
Author: User
Use the vector cross product to determine whether it is clockwise or clockwise. If the vector p = (x1, Y1), q = (X2, Y2) is set, the vector cross product is defined as (0, 0) the signed area of the parallelogram consisting of P1, P2, and P1 + P2, that is, p × q = x1 * Y2-X2 * Y1. The result is a scalar. Obviously, the properties include P x q =-(q x P) and P x (-q) =-(P x q ). A very important property of the cross product is that it can be used to determine the clockwise relationship between two vectors:
If p × q> 0, P is clockwise in Q.
If p × q <0, P is in the counterclockwise direction of Q.
If p × q = 0, p and q are both in the same direction, but they may be reversed.
Explanation: A × B = (Ay * BZ-by * AZ, AZ * Bx-Ax * BZ, ax * by-ay * BX) and because AZ BZ is 0, so a × B = (, ax * by-ay * BX) according to the right hand system (the Right Hand System is satisfied by the cross multiplication), if p × q> 0, ax * by-ay * BX> 0, that is, the thumb points up, so P is clockwise in Q.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.