-
Notifications
You must be signed in to change notification settings - Fork 15
RayCasting
Vinicius Reif Biavatti edited this page Oct 4, 2019
·
23 revisions
To create the RayCasting logic we will use some trigonometry functions like Math.sin and Math.cos. These functions works with radian values, not degrees. We are using degree values in the attributes. So, the first thing to do is to create a function that converts the degree value to radian value. We can use the formule below for this:
Formule: degree * π / 180
With the formule as base, we will create the function:
/**
* Cast degree to radian
* @param {degree} degree
*/
function degreeToRadians(degree) {
let pi = Math.PI;
return degree * pi / 180;
}Copyright © 2018 Vinícius Reif Biavatti
- Home
- RayTrancing
- Examples
- Basic Tutorial
- Intermediary Tutorial
- Advanced Tutorial