Date: Wed, 19 Nov 1997 19:37:57 -0500

From: Alex Bogomolny

Having a 3d case is probably stupid.

But returning to your example:

It's all a question of choosing equations that correspond to the same orientations.

The triangle in your case is defined by three points: (0,0), (1.5, 0), (0,3).

Choose the boundary traversal direction: (0,0) -> (1.5, 0) -> (0,3) -> (0,0)

This gives you vectors (1.5, 0), (-1.5, 3), (0, -3). Use the transformation (a,b) -> (b, -a) to get perpendicular vectors: (0, -1.5), (3, 1.5), (-3, 0). These leads to equations:

-1.5y = 0

3x + 1.5y - 4.5 = 0

-3x = 0

Define:

- f1(x,y) = -1.5y
- f2(x,y) = 3x + 1.5y - 4.5
- f3(x,y) = -3x

Point: (1,3).

- f1(1,3) = -4.5 < 0
- f2(1,3) = 3 > 0
- f3(1,3) = -3 < 0

Not all signs are the same. Hence the point is outside the triangle.

Check for point (.5, .5):

- f1(.5, .5) = -0.75 < 0
- f2(.5, .5) = -2.25 < 0
- f3(.5, .5) = -1.5 < 0

All signs are the same. Therefore, the point is inside the triangle.

Regards,

Alexander Bogomolny

61178958 |