Subject: Re: Point inside a triangle
Date: Wed, 19 Nov 1997 18:03:19 -0500
From: Alex Bogomolny

Dear Irina:

The question is not at all stupid and students taking a Computer Graphics course would learn a couple of possible answers.

Yours is right but computing angles on a PC involves floating point arithmetic and trigonometric functions. It's much simpler and, definitely faster, to write equations of the three sides of a triangle and substitute your point into each. If the three results all have the same sign, the point is inside the triangle. Otherwise, it's outside.

Is it beautiful enough for you?

Best regards,
Alexander Bogomolny

|Reply| |Up| |Down| |Exchange index| |Contents| |Store|

Copyright © 1996-2018 Alexander Bogomolny