program_02 PROGRAM_02 - Point/Triangle Orientation Define a triangle T: Enter [ T.v1.x, T.v1.y]: [4,0] Enter [ T.v2.x, T.v2.y]: [3,4] Enter [ T.v3.x, T.v3.y]: [0,1] Orientation test value = 3.638034 The triangle is properly oriented. Edge1 = v2-v1, length = 4.123106 Edge2 = v3-v2, length = 4.242641 Edge3 = v1-v3, length = 4.123106 Now we see whether a point is in the triangle. Enter a point [ P.x, P.y], or RETURN to quit: [3,2] Distance to line through edge 1 = 0.485071 Distance to line through edge 2 = 1.414214 Distance to line through edge 3 = 1.697749 The point is INSIDE the triangle. Enter a point [ P.x, P.y], or RETURN to quit: [2,3] Distance to line through edge 1 = 1.212678 Distance to line through edge 2 = 0.000000 Distance to line through edge 3 = 2.425356 The point is ON the triangle Enter a point [ P.x, P.y], or RETURN to quit: [1,4] Distance to line through edge 1 = 1.940285 Distance to line through edge 2 = -1.414214 Distance to line through edge 3 = 3.152963 The point is OUTSIDE the triangle Enter a point [ P.x, P.y], or RETURN to quit: [3,4] Distance to line through edge 1 = 0.000000 Distance to line through edge 2 = 0.000000 Distance to line through edge 3 = 3.638034 The point is ON the triangle Enter a point [ P.x, P.y], or RETURN to quit: [4,4] Distance to line through edge 1 = -0.970143 Distance to line through edge 2 = 0.707107 Distance to line through edge 3 = 3.880570 The point is OUTSIDE the triangle Enter a point [ P.x, P.y], or RETURN to quit: [3,4] Distance to line through edge 1 = 0.000000 Distance to line through edge 2 = 0.000000 Distance to line through edge 3 = 3.638034 The point is ON the triangle Enter a point [ P.x, P.y], or RETURN to quit: [4,4] Distance to line through edge 1 = -0.970143 Distance to line through edge 2 = 0.707107 Distance to line through edge 3 = 3.880570 The point is OUTSIDE the triangle Enter a point [ P.x, P.y], or RETURN to quit: [3,5] Distance to line through edge 1 = -0.242536 Distance to line through edge 2 = -0.707107 Distance to line through edge 3 = 4.608177 The point is OUTSIDE the triangle Enter a point [ P.x, P.y], or RETURN to quit: [4,5] Distance to line through edge 1 = -1.212678 Distance to line through edge 2 = 0.000000 Distance to line through edge 3 = 4.850713 The point is OUTSIDE the triangle Enter a point [ P.x, P.y], or RETURN to quit: PROGRAM_02 Normal end of execution.