def point_inside_loop(loop_coords, mous_loc):
nverts = len(loop_coords)
# vectorize our two item tuple
out = Vector(outside_loop(loop_coords))
vec_mous = Vector(mous_loc)
intersections = 0
for i in range(0, nverts):
a = Vector(loop_coords[i-1])
b = Vector(loop_coords[i])
if intersect_line_line_2d(vec_mous, out, a, b):
intersections += 1
inside = False
if fmod(intersections, 2):
inside = True
return inside
# === OpenGL drawing functions ===
评论列表
文章目录