Skip to content

Commit

Permalink
Update message for Raycast (#397)
Browse files Browse the repository at this point in the history
* Update message for Raycast

* Add missing parenthesis
  • Loading branch information
hhsaez committed Apr 28, 2020
1 parent 27f9e46 commit 6623f08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/regl-worldview/src/utils/Raycast.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class Ray {
return vec3.distance(this.origin, point);
}

// https://stackoverflow.com/questions/7168484/3d-line-segment-and-plane-intersection/35396994#35396994
// https://commons.apache.org/proper/commons-math/javadocs/api-3.6/src-html/org/apache/commons/math3/geometry/euclidean/threed/Plane.html#line.394
planeIntersection(planeCoordinate: Vec3, planeNormal: Vec3): ?Vec3 {
const d = vec3.dot(planeNormal, planeCoordinate);
const cosine = vec3.dot(planeNormal, this.dir);
Expand All @@ -39,7 +39,7 @@ export class Ray {
return null;
}

const x = d - vec3.dot(planeNormal, this.origin) / cosine;
const x = (d - vec3.dot(planeNormal, this.origin)) / cosine;
const contact = vec3.add([0, 0, 0], this.origin, vec3.scale(tempVec, this.dir, x));
return contact;
}
Expand Down

0 comments on commit 6623f08

Please sign in to comment.