Using vectors to calculate the area of a triangle and the positional relationship between a point and a line

Triangle area calculation

Δ \DeltaΔ A B C ABC ABC中, A B → \overrightarrow{AB} AB =( x 1 x_1 x1, y 1 y_1y1), A C → \overrightarrow{AC} AC =( x 2 x_2 x2, y 2 y_2y2), then the triangle area is: S Δ ABC S_{\Delta}ABCSDABC= 1 2 \frac{1}{2} 21 ∣ x 2 y 1 − x 1 y 2 ∣ \begin{vmatrix}x_{2}y_{1}-x_{1}y_{2}\end{vmatrix} x2y1x1y2


Judgment of point and position

Straight line: through point AB
Point: point C
Let the starting point of the vector be A, the end point be B, and the judgment point be C. Using the formula S = x 2 y 1 − x 1 y 2 x_{2}y_{1}-x_{1}y_{2}x2y1x1y2Judgment:
If S < 0: C is in AB → \overrightarrow{AB}AB The counterclockwise direction of
if S > 0 : C is in AB → \overrightarrow{AB}AB The clockwise direction
of if S = 0 : collinear

Guess you like

Origin blog.csdn.net/OnePiece_zym/article/details/104658578