| 6 | } |
| 7 | } |
| 8 | class Rad extends Angle { |
| 9 | static turn = 2 * Math.PI; |
| 10 | sin() { |
| 11 | return Math.sin(this.value); |
| 12 | } |
| 13 | cos() { |
| 14 | return Math.cos(this.value); |
| 15 | } |
| 16 | tan() { |
| 17 | return Math.tan(this.value); |
| 18 | } |
| 19 | sincos() { |
| 20 | return [ |
| 21 | Math.sin(this.value), |
| 22 | Math.cos(this.value) |
| 23 | ]; |
| 24 | } |
| 25 | csc() { |
| 26 | return 1 / this.sin(); |
| 27 | } |
| 28 | cot() { |
| 29 | return 1 / this.tan(); |
| 30 | } |
| 31 | sec() { |
| 32 | return 1 / this.cos(); |
| 33 | } |
| 34 | asin() { |
| 35 | return Math.asin(this.value); |
| 36 | } |
| 37 | acos() { |
| 38 | return Math.acos(this.value); |
| 39 | } |
| 40 | atan() { |
| 41 | return Math.atan(this.value); |
| 42 | } |
| 43 | add(other) { |
| 44 | const value = other instanceof Angle ? other.toRad().value : other; |
| 45 | return new Rad(this.value + value); |
| 46 | } |
| 47 | sub(other) { |
| 48 | const value = other instanceof Angle ? other.toRad().value : other; |
| 49 | return new Rad(this.value - value); |
| 50 | } |
| 51 | mul(other) { |
| 52 | const value = other instanceof Angle ? other.toRad().value : other; |
| 53 | return new Rad(this.value * value); |
| 54 | } |
| 55 | div(other) { |
| 56 | const value = other instanceof Angle ? other.toRad().value : other; |
| 57 | return new Rad(this.value / value); |
| 58 | } |
| 59 | neg() { |
| 60 | return new Rad(-this.value); |
| 61 | } |
| 62 | eq(other) { |
| 63 | const value = other instanceof Angle ? other.toRad().value : other; |
| 64 | return this.value === value; |
| 65 | } |
nothing calls this directly
no outgoing calls
no test coverage detected