SFML community forums
Help => General => Topic started by: Szustarol on September 26, 2017, 05:52:39 pm
-
I think the image explains it all, Is it possible to measure which border will a ray "hit" if it was longer without using complex trigonometry?
-
Do you need to calculate where it intersects or just know if it intersects?
Neither require trig, but calculating the intersections just requires you to use a (linear) system of 2 equations.
-
Especially easy if you're doing digital differential analysis for the raycast:
https://github.com/dabbertorres/raycast-sfml/blob/master/Raycast-SFML/math.cpp#L43
-
IF i know which side it hits calculating where it hits is really simple so i jest need to know which side