(source, min, max)
| 2 | * This program are made available under the terms of the Apache License, Version 2.0 |
| 3 | * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ |
| 4 | function wrap(source, min, max) { |
| 5 | if (source === max || source === min) { |
| 6 | return source; |
| 7 | } |
| 8 | let len = max - min; |
| 9 | return ((source - min) % len + len) % len + min |
| 10 | } |
| 11 | |
| 12 | function rad(angle) { |
| 13 | return angle * Math.PI / 180; |