How to use the cross function from mathjs

Find comprehensive JavaScript mathjs.cross code examples handpicked from public code repositorys.

197
198
199
200
201
202
203
204
205
206
  var A = x - x1;
  var B = y - y1;
  var C = x2 - x1;
  var D = y2 - y1;

  return math.cross([A, B, 0], [C, D, 0])[2] > 0;
}
exports.cross_z_pos = cross_z_pos;

function intersection (x1, y1, x2, y2, x3, y3, x4, y4) {
fork icon1
star icon1
watch icon2

68
69
70
71
72
73
74
75
76
77
//dvec: direction vector wall[1]-wall[0]
function getImageSoundSource(wall = [], speaker = []) {
    let lvec = wall[0];
    let svec = math.subtract(wall[1], wall[0]);
    let dvec = math.subtract(wall[3], wall[0]);
    let normal = math.cross(dvec, svec);
    normal = math.divide(normal, math.norm(normal));
    let levToSpeaker = math.subtract(lvec, speaker);
    // calculating intersectionpoint of plane and speaker
    let lambda = math.dot(normal, levToSpeaker) / (normal[0] + normal[1] + normal[2]);
fork icon0
star icon0
watch icon0

+ 23 other calls in file