See if a ray collides with a boundary
You can use this to test for a collision with a ray and any type of boundary: tlBox, tlCircle, tlLine and tlPolygon.
Pass the origin of the ray with px and py, and set the direction of the raycast with dx and dy vector. dx and dy will be normalised and extended
infinitely if maxdistance equals 0 (default), otherwise set maxdistance to how ever far you want the ray to extend to before stopping. If the ray starts
inside the poly then result.RayOriginInside will be set to true. You can find the angle of reflection to bounce the ray using ReboundVector.