How to use the intersect function from mathjs
Find comprehensive JavaScript mathjs.intersect code examples handpicked from public code repositorys.
19 20 21 22 23 24 25 26 27 28
//ISSUE!!!!! if the ray extends past the mirror, an intersection will be given where one doesn't exist //COMPENSATE FOR THIS!! intersectPoint(ray) { //intersection of lines formed by the mirror and ray, both defined by two points let intersection = intersect(this.endpoint1, this.endpoint2, ray.position, [ ray.position[0] + ray.direction[0], ray.position[1] + ray.direction[1], ]); if (intersection == null) {
1
0
0
63 64 65 66 67 68 69 70 71 72
//FUNCTION OF SHAME //LEARN HOW TO USE MODULES, YOU HAG rayLineIntersection(ray, line) { //intersection of lines formed by the mirror and ray, both defined by two points let intersection = intersect(line[0], line[1], ray.position, [ ray.position[0] + ray.direction[0], ray.position[1] + ray.direction[1], ]); if (intersection == null) {
1
0
0
+ 3 other calls in file
mathjs.evaluate is the most popular function in mathjs (87200 examples)