Processing math: 100%

sknano.core.geometric_regions.Triangle.contains

Triangle.contains(point)[source][source]

Test region membership of point in Triangle.

Parameters:

point : array_like

Returns:

bool

True if point is within Triangle, False, otherwise.

Notes

A point (px,py) is within the bounded region of a triangle with corner points p1=(x1,y1), p2=(x2,y2), and p3=(x3,y3), if the following is true:

(x1x3)py+(x3px)y1+(pxx1)y3(y1y2)x3+(y2y3)x1+(y3y1)x20(x2x1)py+(pxx2)y1+(x1px)y2(y1y2)x3+(y2y3)x1+(y3y1)x20(x2x3)py+(x3px)y2+(pxx2)y3(y1y2)x3+(y2y3)x1+(y3y1)x20