tests for 2d triangle and quad intersection would only work if the points were ordered clockwise.

now return 1 for clockwise, -1 for counter-clockwise and 0 for no intersection.
This commit is contained in:
Campbell Barton
2008-09-29 02:16:18 +00:00
parent f001e58768
commit 25fc47aaf2
3 changed files with 65 additions and 25 deletions

View File

@@ -59,8 +59,16 @@ def PointInTriangle2D(pt, tri_pt1, tri_pt2, tri_pt3):
"""
Takes 4 vectors (one for the test point and 3 for the triangle)
This is a 2d function so only X and Y are used, Z and W will be ignored.
@rtype: bool
@return: True or False depending on the points intersection.
@rtype: int
@return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection.
"""
def PointInQuad2D(pt, quad_pt1, quad_pt2, quad_pt3):
"""
Takes 5 vectors (one for the test point and 5 for the quad)
This is a 2d function so only X and Y are used, Z and W will be ignored.
@rtype: int
@return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection.
"""
def BoxPack2D(boxlist):