Slashdot Mirror


Programming Challenge: Triangles Puzzle

Frank Buss writes "Last week was a challenge to write a program, which solves a simple geometric problem. There was nothing to win, only the solutions at the end are the win for all readers, but nevertheless the response was great (some thousands of web-hits) and there are some nice solutions."

1 of 40 comments (clear)

  1. Re:One problem I've always wanted to solve... by Anonymous Coward · · Score: 1, Insightful

    The three points (call them p1, p2, p3) form three lines - any two of the points describe a line on the plain. Now determine, with respect to each of those lines, if p4 is on the same side of the line as the third point. So, if p4 is on the same side of p1-p2 as p3, and on the same side of p1-p3 as p2, and on the same side of p2-p3 as p1 - then it is in the triangle.