Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 855b023 commit b2e535fCopy full SHA for b2e535f
qml2DRaycastingEngine/Particle.qml
@@ -143,11 +143,16 @@ Item {
143
// euclidian distance
144
let dist = distance(particle.pos, pt);
145
146
- // angle of the ray relative to the direction of the camera
147
- const a = ray.heading - particle.heading;
148
-
149
// decrease fisheye effect
150
if (!fisheye) {
+ // calculate the angle diference between the ray and the "camera"
+ let a = particle.heading - ray.heading;
+ if (a < 0)
151
+ a += 2*Math.PI;
152
+ if (a > 2*Math.PI)
153
+ a -= 2*Math.PI;
154
+
155
+ // multiply the euclidian distance by the cosine of the new angle
156
dist *= Math.cos(a);
157
}
158
qml2DRaycastingEngine/screenshot.gif
207 KB
0 commit comments