Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2e535f

Browse files
committed
qml2DRaycastingEngine: new screenshot
1 parent 855b023 commit b2e535f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

qml2DRaycastingEngine/Particle.qml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,16 @@ Item {
143143
// euclidian distance
144144
let dist = distance(particle.pos, pt);
145145

146-
// angle of the ray relative to the direction of the camera
147-
const a = ray.heading - particle.heading;
148-
149146
// decrease fisheye effect
150147
if (!fisheye) {
148+
// calculate the angle diference between the ray and the "camera"
149+
let a = particle.heading - ray.heading;
150+
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
151156
dist *= Math.cos(a);
152157
}
153158

qml2DRaycastingEngine/screenshot.gif

207 KB
Loading

0 commit comments

Comments
 (0)