pythonarcade/arcade

Bug in arcade.geometry function

bunny-therapist opened this issue · 0 comments

Bug Report

System Info

Run this and paste the output here: python -m arcade

Arcade 3.0.0.dev24

vendor: Intel
renderer: Intel(R) UHD Graphics
version: (3, 3)
python: 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
platform: win32
pyglet version: 2.0.9
PIL version: 9.4.0

Actual behavior:

For certain values (seems specifically sensitive to x-values - I noticed this as bugs affecting a range of x-values in my game), arcade.geometry.is_point_in_polygon returns False for a point that is clearly inside a given rectangle.

Expected behavior:

The function should return True for points inside the rectangle.

Steps to reproduce/example code:

import arcade

# Corners of a rectangle:
corners = [(9984.0, 2112.0), (10048.0, 2112.0), (10048.0, 2048.0), (9984.0, 2048.0)]

# Point inside a rectangle:
x =10016.0
y = 2080.0

# This assertion fails, but it should pass:
assert arcade.geometry.is_point_in_polygon(x, y, corners)