Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
How to measure which border will the ray "hit"
Print
Pages: [
1
]
Author
Topic: How to measure which border will the ray "hit" (Read 2225 times)
0 Members and 1 Guest are viewing this topic.
Szustarol
Newbie
Posts: 19
How to measure which border will the ray "hit"
«
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?
Logged
JayhawkZombie
Jr. Member
Posts: 76
Re: How to measure which border will the ray "hit"
«
Reply #1 on:
September 27, 2017, 06:50:28 am »
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.
Logged
dabbertorres
Hero Member
Posts: 505
Re: How to measure which border will the ray "hit"
«
Reply #2 on:
September 27, 2017, 11:45:41 am »
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
Logged
Github
Szustarol
Newbie
Posts: 19
Re: How to measure which border will the ray "hit"
«
Reply #3 on:
September 27, 2017, 03:11:43 pm »
IF i know which side it hits calculating where it hits is really simple so i jest need to know which side
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
How to measure which border will the ray "hit"
anything