|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
548 bytes
|
| Line | |
|---|
| 1 | import {asin, atan2, cos, sin, sqrt} from "../math.js";
|
|---|
| 2 |
|
|---|
| 3 | export function azimuthalRaw(scale) {
|
|---|
| 4 | return function(x, y) {
|
|---|
| 5 | var cx = cos(x),
|
|---|
| 6 | cy = cos(y),
|
|---|
| 7 | k = scale(cx * cy);
|
|---|
| 8 | if (k === Infinity) return [2, 0];
|
|---|
| 9 | return [
|
|---|
| 10 | k * cy * sin(x),
|
|---|
| 11 | k * sin(y)
|
|---|
| 12 | ];
|
|---|
| 13 | }
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | export function azimuthalInvert(angle) {
|
|---|
| 17 | return function(x, y) {
|
|---|
| 18 | var z = sqrt(x * x + y * y),
|
|---|
| 19 | c = angle(z),
|
|---|
| 20 | sc = sin(c),
|
|---|
| 21 | cc = cos(c);
|
|---|
| 22 | return [
|
|---|
| 23 | atan2(x * sc, z * cc),
|
|---|
| 24 | asin(z && y * sc / z)
|
|---|
| 25 | ];
|
|---|
| 26 | }
|
|---|
| 27 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.