How to use the atan function from mathjs

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

116
117
118
119
120
121
122
123
124
125
//frameCount++;
//console.log(frame);
if(frame.hands.length>0){
        serverControlEnabled = true;
        var hand = frame.hands[0];
        var horizonAngle = math.atan(hand.palmNormal[0]/hand.palmNormal[1]) * (180/math.pi);
        var directionAngle = math.atan(hand.palmNormal[2]/hand.palmNormal[1]) * (180/math.pi);
        var clockWiseAngle = -(math.atan(hand.direction[0]/hand.direction[2]) * (180/math.pi)-45);
        connection.send(JSON.stringify({action: "updateFrame",
                                                                leapNumberOfHands: frame.hands.length,
fork icon1
star icon2
watch icon2

+ 3 other calls in file

187
188
189
190
191
192
193
194
195
196
}
let minus = function(x){
  return -x;
}
let atan = function(x){
  return Mathjs.atan(x);
}
let acoth = function(x){
  return Mathjs.acoth(x);
}
fork icon0
star icon1
watch icon1

+ 7 other calls in file

44
45
46
47
48
49
50
51
52
53
  }
  return cur;
}

newDirection(ray) {
  const theta1 = atan(ray.direction[1] / ray.direction[0]);
  if (!ray.notInAir) {
    ray.notInAir = true;
    const theta2 = asin(sin(theta1) / this.n);
    if (ray.direction[0] < 0) {
fork icon1
star icon0
watch icon0

+ 3 other calls in file

107
108
109
110
111
112
113
114
115
clone() {
    return new Point(this.x, this.y);
}
get angle() {
    let unit_vector = this.normalize();
    return math.atan(math.divide(unit_vector.y, unit_vector.x));
}
set angle(new_angle) {
    let magnitude = this.magntitude;
fork icon1
star icon0
watch icon1

70
71
72
73
74
75
76
77
78
a_z = a_z + g_z;

// estimated pitch
theta_hat = asin(-a_y);
// estimated roll
phi_hat = atan(-a_x/a_z);

// earth magnetic vector
D = (2 + 31/60 + 48/3600 ) * (pi/180);
fork icon0
star icon0
watch icon2

+ 5 other calls in file