POV-Ray : Newsgroups : povray.advanced-users : Test if point in triangle : Re: Test if point in triangle Server Time
4 May 2024 04:31:35 EDT (-0400)
  Re: Test if point in triangle  
From: scott
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.