Skip to content

Conversation

@dominik-babic
Copy link

The previous raytrace range calculation approach of comparing ax and ay ran into issues when the laser origin was close to the:

  • Vertical wall, rays that are outside [-45°, 45°] would be interpreted as horizontal.
  • Horizontal wall, rays that are outside [45°, 135°] would be interpreted as vertical.

This PR improves the ray tracing logic in the World::Raytrace method by explicitly tracking whether the current iteration is along the X or Y axis.

Key improvements:

Ray tracing logic and range calculation:

  • Introduced a new boolean variable along_x to explicitly track whether the ray iteration is along the X or Y axis.
  • Updated the range calculation to use along_x instead of comparing ax and ay, making it clear whether the crossing was vertical or horizontal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant