POV-Ray : Newsgroups : povray.advanced-users : Test if point in triangle Server Time
24 Apr 2024 19:54:48 EDT (-0400)
  Test if point in triangle (Message 1 to 3 of 3)  
From: Mike Horvath
Subject: Test if point in triangle
Date: 12 Feb 2016 14:09:36
Message: <56be2df0$1@news.povray.org>
Can anyone tell me of a simple formula to test whether a 2D point is 
inside a triangle? It is a right triangle with two equal sides. Thanks.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Test if point in triangle
Date: 12 Feb 2016 14:30:40
Message: <56be32e0$1@news.povray.org>
On 2/12/2016 2:09 PM, Mike Horvath wrote:
> Can anyone tell me of a simple formula to test whether a 2D point is
> inside a triangle? It is a right triangle with two equal sides. Thanks.
>
>
> Mike

Never mind. I figured if X + Y < 1, then the point is inside the triangle.


Mike


Post a reply to this message

From: scott
Subject: Re: Test if point in triangle
Date: 17 Feb 2016 04:22:07
Message: <56c43bbf@news.povray.org>
>> Can anyone tell me of a simple formula to test whether a 2D point is
>> inside a triangle? It is a right triangle with two equal sides. Thanks.
>>
>>
>> Mike
>
> Never mind. I figured if X + Y < 1, then the point is inside the triangle.

How about (X,Y) = (-5,-5) ?

X+Y<1 just tests that it is on one side of one edge.

You also need X>0 and Y>0 for the other two edges of the triangle 
(assuming your other two edges run along the axes).


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.