|
Here's a challenge for you: Write an algorithm -- a step-by-step procedure -- to determine whether a point is inside a triangle.The input to the algorithm is eight numbers: the x,y coordinates of a single point, P and 3 pairs of x,y coordinates giving the corners A, B, and C of the triangle. The output from the algorithm is the word "Inside" if the point is inside the triangle, or the words "Not Inside" if the point is not inside the triangle. This web page actually contains the algorithm, written in JavaScript. Try do do the challenge yourself. Then, if you want to check your answer, look at an explanation of how I met this challenge. There are examples written in JavaScript, REXX, and even an Excel Spreadsheet! Related Pages in this website
|
|
The webmaster and author of the Math
Help site is Graeme McRae. |