planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

8
node_modules/@mapbox/point-geometry/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,8 @@
language: node_js
node_js:
- "0.10"
before_install:
- npm install -g npm@~1.4.6
script:
- npm test
- npm run cov

5
node_modules/@mapbox/point-geometry/HISTORY.md generated vendored Normal file
View File

@@ -0,0 +1,5 @@
## 0.1.0
* Adds [rotateAround](https://github.com/mapbox/point-geometry/pull/5) and
[multByPoint](https://github.com/mapbox/point-geometry/pull/7) and divByPoint
methods.

13
node_modules/@mapbox/point-geometry/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,13 @@
Copyright (c) 2015, Mapbox <>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

364
node_modules/@mapbox/point-geometry/README.md generated vendored Normal file
View File

@@ -0,0 +1,364 @@
# point-geometry
[![build status](https://secure.travis-ci.org/mapbox/point-geometry.png)](http://travis-ci.org/mapbox/point-geometry) [![Coverage Status](https://coveralls.io/repos/mapbox/point-geometry/badge.svg?branch=master)](https://coveralls.io/r/mapbox/point-geometry?branch=master)
a point geometry with transforms
### `Point(x, y)`
A standalone point geometry with useful accessor, comparison, and
modification methods.
### Parameters
| parameter | type | description |
| --------- | ------ | -------------------------------------------------------------------------------------- |
| `x` | Number | the x-coordinate. this could be longitude or screen pixels, or any other sort of unit. |
| `y` | Number | the y-coordinate. this could be latitude or screen pixels, or any other sort of unit. |
### Example
```js
var point = new Point(-77, 38);
```
### `clone`
Clone this point, returning a new point that can be modified
without affecting the old one.
**Returns** `Point`, the clone
### `add(p)`
Add this point's x & y coordinates to another point,
yielding a new point.
### Parameters
| parameter | type | description |
| --------- | ----- | --------------- |
| `p` | Point | the other point |
**Returns** `Point`, output point
### `sub(p)`
Subtract this point's x & y coordinates to from point,
yielding a new point.
### Parameters
| parameter | type | description |
| --------- | ----- | --------------- |
| `p` | Point | the other point |
**Returns** `Point`, output point
### `multByPoint(p)`
Multiply this point's x & y coordinates by point,
yielding a new point.
### Parameters
| parameter | type | description |
| --------- | ----- | --------------- |
| `p` | Point | the other point |
**Returns** `Point`, output point
### `divByPoint(p)`
Divide this point's x & y coordinates by point,
yielding a new point.
### Parameters
| parameter | type | description |
| --------- | ----- | --------------- |
| `p` | Point | the other point |
**Returns** `Point`, output point
### `mult(k)`
Multiply this point's x & y coordinates by a factor,
yielding a new point.
### Parameters
| parameter | type | description |
| --------- | ----- | ----------- |
| `k` | Point | factor |
**Returns** `Point`, output point
### `div(k)`
Divide this point's x & y coordinates by a factor,
yielding a new point.
### Parameters
| parameter | type | description |
| --------- | ----- | ----------- |
| `k` | Point | factor |
**Returns** `Point`, output point
### `rotate(a)`
Rotate this point around the 0, 0 origin by an angle a,
given in radians
### Parameters
| parameter | type | description |
| --------- | ------ | ---------------------------------- |
| `a` | Number | angle to rotate around, in radians |
**Returns** `Point`, output point
### `rotateAround(a, p)`
Rotate this point around p point by an angle a,
given in radians
### Parameters
| parameter | type | description |
| --------- | ------ | ---------------------------------- |
| `a` | Number | angle to rotate around, in radians |
| `p` | Point | Point to rotate around |
**Returns** `Point`, output point
### `matMult(m)`
Multiply this point by a 4x1 transformation matrix
### Parameters
| parameter | type | description |
| --------- | ----------------- | --------------------- |
| `m` | Array\.\<Number\> | transformation matrix |
**Returns** `Point`, output point
### `unit`
Calculate this point but as a unit vector from 0, 0, meaning
that the distance from the resulting point to the 0, 0
coordinate will be equal to 1 and the angle from the resulting
point to the 0, 0 coordinate will be the same as before.
**Returns** `Point`, unit vector point
### `perp`
Compute a perpendicular point, where the new y coordinate
is the old x coordinate and the new x coordinate is the old y
coordinate multiplied by -1
**Returns** `Point`, perpendicular point
### `round`
Return a version of this point with the x & y coordinates
rounded to integers.
**Returns** `Point`, rounded point
### `mag`
Return the magitude of this point: this is the Euclidean
distance from the 0, 0 coordinate to this point's x and y
coordinates.
**Returns** `Number`, magnitude
### `equals(other)`
Judge whether this point is equal to another point, returning
true or false.
### Parameters
| parameter | type | description |
| --------- | ----- | --------------- |
| `other` | Point | the other point |
**Returns** `boolean`, whether the points are equal
### `dist(p)`
Calculate the distance from this point to another point
### Parameters
| parameter | type | description |
| --------- | ----- | --------------- |
| `p` | Point | the other point |
**Returns** `Number`, distance
### `distSqr(p)`
Calculate the distance from this point to another point,
without the square root step. Useful if you're comparing
relative distances.
### Parameters
| parameter | type | description |
| --------- | ----- | --------------- |
| `p` | Point | the other point |
**Returns** `Number`, distance
### `angle`
Get the angle from the 0, 0 coordinate to this point, in radians
coordinates.
**Returns** `Number`, angle
### `angleTo(b)`
Get the angle from this point to another point, in radians
### Parameters
| parameter | type | description |
| --------- | ----- | --------------- |
| `b` | Point | the other point |
**Returns** `Number`, angle
### `angleWith(b)`
Get the angle between this point and another point, in radians
### Parameters
| parameter | type | description |
| --------- | ----- | --------------- |
| `b` | Point | the other point |
**Returns** `Number`, angle
### `angleWithSep(x, y)`
Find the angle of the two vectors, solving the formula for
the cross product a x b = |a||b|sin(θ) for θ.
### Parameters
| parameter | type | description |
| --------- | ------ | ---------------- |
| `x` | Number | the x-coordinate |
| `y` | Number | the y-coordinate |
**Returns** `Number`, the angle in radians
### `convert(a)`
Construct a point from an array if necessary, otherwise if the input
is already a Point, or an unknown type, return it unchanged
### Parameters
| parameter | type | description |
| --------- | ------------------------ | ----------------------- |
| `a` | Array\.\<Number\>\,Point | any kind of input value |
### Example
```js
// this
var point = Point.convert([0, 1]);
// is equivalent to
var point = new Point(0, 1);
```
**Returns** `Point`, constructed point, or passed-through value.
## Installation
Requires [nodejs](http://nodejs.org/).
```sh
$ npm install point-geometry
```
## Tests
```sh
$ npm test
```

312
node_modules/@mapbox/point-geometry/index.js generated vendored Normal file
View File

@@ -0,0 +1,312 @@
'use strict';
module.exports = Point;
/**
* A standalone point geometry with useful accessor, comparison, and
* modification methods.
*
* @class Point
* @param {Number} x the x-coordinate. this could be longitude or screen
* pixels, or any other sort of unit.
* @param {Number} y the y-coordinate. this could be latitude or screen
* pixels, or any other sort of unit.
* @example
* var point = new Point(-77, 38);
*/
function Point(x, y) {
this.x = x;
this.y = y;
}
Point.prototype = {
/**
* Clone this point, returning a new point that can be modified
* without affecting the old one.
* @return {Point} the clone
*/
clone: function() { return new Point(this.x, this.y); },
/**
* Add this point's x & y coordinates to another point,
* yielding a new point.
* @param {Point} p the other point
* @return {Point} output point
*/
add: function(p) { return this.clone()._add(p); },
/**
* Subtract this point's x & y coordinates to from point,
* yielding a new point.
* @param {Point} p the other point
* @return {Point} output point
*/
sub: function(p) { return this.clone()._sub(p); },
/**
* Multiply this point's x & y coordinates by point,
* yielding a new point.
* @param {Point} p the other point
* @return {Point} output point
*/
multByPoint: function(p) { return this.clone()._multByPoint(p); },
/**
* Divide this point's x & y coordinates by point,
* yielding a new point.
* @param {Point} p the other point
* @return {Point} output point
*/
divByPoint: function(p) { return this.clone()._divByPoint(p); },
/**
* Multiply this point's x & y coordinates by a factor,
* yielding a new point.
* @param {Point} k factor
* @return {Point} output point
*/
mult: function(k) { return this.clone()._mult(k); },
/**
* Divide this point's x & y coordinates by a factor,
* yielding a new point.
* @param {Point} k factor
* @return {Point} output point
*/
div: function(k) { return this.clone()._div(k); },
/**
* Rotate this point around the 0, 0 origin by an angle a,
* given in radians
* @param {Number} a angle to rotate around, in radians
* @return {Point} output point
*/
rotate: function(a) { return this.clone()._rotate(a); },
/**
* Rotate this point around p point by an angle a,
* given in radians
* @param {Number} a angle to rotate around, in radians
* @param {Point} p Point to rotate around
* @return {Point} output point
*/
rotateAround: function(a,p) { return this.clone()._rotateAround(a,p); },
/**
* Multiply this point by a 4x1 transformation matrix
* @param {Array<Number>} m transformation matrix
* @return {Point} output point
*/
matMult: function(m) { return this.clone()._matMult(m); },
/**
* Calculate this point but as a unit vector from 0, 0, meaning
* that the distance from the resulting point to the 0, 0
* coordinate will be equal to 1 and the angle from the resulting
* point to the 0, 0 coordinate will be the same as before.
* @return {Point} unit vector point
*/
unit: function() { return this.clone()._unit(); },
/**
* Compute a perpendicular point, where the new y coordinate
* is the old x coordinate and the new x coordinate is the old y
* coordinate multiplied by -1
* @return {Point} perpendicular point
*/
perp: function() { return this.clone()._perp(); },
/**
* Return a version of this point with the x & y coordinates
* rounded to integers.
* @return {Point} rounded point
*/
round: function() { return this.clone()._round(); },
/**
* Return the magitude of this point: this is the Euclidean
* distance from the 0, 0 coordinate to this point's x and y
* coordinates.
* @return {Number} magnitude
*/
mag: function() {
return Math.sqrt(this.x * this.x + this.y * this.y);
},
/**
* Judge whether this point is equal to another point, returning
* true or false.
* @param {Point} other the other point
* @return {boolean} whether the points are equal
*/
equals: function(other) {
return this.x === other.x &&
this.y === other.y;
},
/**
* Calculate the distance from this point to another point
* @param {Point} p the other point
* @return {Number} distance
*/
dist: function(p) {
return Math.sqrt(this.distSqr(p));
},
/**
* Calculate the distance from this point to another point,
* without the square root step. Useful if you're comparing
* relative distances.
* @param {Point} p the other point
* @return {Number} distance
*/
distSqr: function(p) {
var dx = p.x - this.x,
dy = p.y - this.y;
return dx * dx + dy * dy;
},
/**
* Get the angle from the 0, 0 coordinate to this point, in radians
* coordinates.
* @return {Number} angle
*/
angle: function() {
return Math.atan2(this.y, this.x);
},
/**
* Get the angle from this point to another point, in radians
* @param {Point} b the other point
* @return {Number} angle
*/
angleTo: function(b) {
return Math.atan2(this.y - b.y, this.x - b.x);
},
/**
* Get the angle between this point and another point, in radians
* @param {Point} b the other point
* @return {Number} angle
*/
angleWith: function(b) {
return this.angleWithSep(b.x, b.y);
},
/*
* Find the angle of the two vectors, solving the formula for
* the cross product a x b = |a||b|sin(θ) for θ.
* @param {Number} x the x-coordinate
* @param {Number} y the y-coordinate
* @return {Number} the angle in radians
*/
angleWithSep: function(x, y) {
return Math.atan2(
this.x * y - this.y * x,
this.x * x + this.y * y);
},
_matMult: function(m) {
var x = m[0] * this.x + m[1] * this.y,
y = m[2] * this.x + m[3] * this.y;
this.x = x;
this.y = y;
return this;
},
_add: function(p) {
this.x += p.x;
this.y += p.y;
return this;
},
_sub: function(p) {
this.x -= p.x;
this.y -= p.y;
return this;
},
_mult: function(k) {
this.x *= k;
this.y *= k;
return this;
},
_div: function(k) {
this.x /= k;
this.y /= k;
return this;
},
_multByPoint: function(p) {
this.x *= p.x;
this.y *= p.y;
return this;
},
_divByPoint: function(p) {
this.x /= p.x;
this.y /= p.y;
return this;
},
_unit: function() {
this._div(this.mag());
return this;
},
_perp: function() {
var y = this.y;
this.y = this.x;
this.x = -y;
return this;
},
_rotate: function(angle) {
var cos = Math.cos(angle),
sin = Math.sin(angle),
x = cos * this.x - sin * this.y,
y = sin * this.x + cos * this.y;
this.x = x;
this.y = y;
return this;
},
_rotateAround: function(angle, p) {
var cos = Math.cos(angle),
sin = Math.sin(angle),
x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y),
y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
this.x = x;
this.y = y;
return this;
},
_round: function() {
this.x = Math.round(this.x);
this.y = Math.round(this.y);
return this;
}
};
/**
* Construct a point from an array if necessary, otherwise if the input
* is already a Point, or an unknown type, return it unchanged
* @param {Array<Number>|Point|*} a any kind of input value
* @return {Point} constructed point, or passed-through value.
* @example
* // this
* var point = Point.convert([0, 1]);
* // is equivalent to
* var point = new Point(0, 1);
*/
Point.convert = function (a) {
if (a instanceof Point) {
return a;
}
if (Array.isArray(a)) {
return new Point(a[0], a[1]);
}
return a;
};

33
node_modules/@mapbox/point-geometry/package.json generated vendored Normal file
View File

@@ -0,0 +1,33 @@
{
"name": "@mapbox/point-geometry",
"version": "0.1.0",
"description": "a point geometry with transforms",
"main": "index.js",
"scripts": {
"test": "tape test.js",
"doc": "dox -r < index.js | doxme --readme > README.md",
"cov": "istanbul cover test.js && coveralls < ./coverage/lcov.info"
},
"repository": {
"type": "git",
"url": "git@github.com:mapbox/point-geometry.git"
},
"keywords": [
"point",
"geometry",
"primitive"
],
"author": "Tom MacWright",
"license": "ISC",
"bugs": {
"url": "https://github.com/mapbox/point-geometry/issues"
},
"homepage": "https://github.com/mapbox/point-geometry",
"devDependencies": {
"coveralls": "~2.10.1",
"dox": "^0.6.1",
"doxme": "^1.8.2",
"istanbul": "~0.2.11",
"tape": "~2.13.3"
}
}

139
node_modules/@mapbox/point-geometry/test.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
'use strict';
var test = require('tape').test;
var Point = require('./');
test('Point', function(t) {
t.test('.convert', function(t) {
t.equal(Point.convert(new Point(20, 30)).equals(new Point(20, 30)), true);
t.equal(Point.convert([20, 30]).equals(new Point(20, 30)), true);
t.equal(Point.convert('somestring'), 'somestring');
t.end();
});
t.test('vector operations', function(t) {
t.test('#mag', function(t) {
t.test('gets the magnitude of a vector', function() {
t.equal(new Point(0, 2).mag(), 2);
t.equal(new Point(0, 0).mag(), 0);
t.equal(new Point(10, 0).mag(), 10);
t.end();
});
});
t.test('#unit', function(t) {
t.test('calculates the unit vector', function() {
t.deepEqual(new Point(0, 1000).unit(), new Point(0, 1));
t.end();
});
});
t.test('#equals', function(t) {
t.equals((new Point(0, 0).equals(new Point(0, 0))), true, 'equal');
t.equals((new Point(0, 0).equals(new Point(0, 10))), false, 'not equal');
t.end();
});
t.test('#dist', function(t) {
t.equals((new Point(0, 10).dist(new Point(0, 0))), 10);
t.equals((new Point(Math.sqrt(2), Math.sqrt(2)).dist(new Point(0, 0))), 2);
t.equals((new Point(0, 0).dist(new Point(0, 0))), 0);
t.end();
});
t.test('#mult', function(t) {
t.equals((new Point(0, 0).mult(5)).equals(new Point(0, 0)), true);
t.equals((new Point(0, 1).mult(5)).equals(new Point(0, 5)), true);
t.equals((new Point(1, 1).mult(5)).equals(new Point(5, 5)), true);
t.end();
});
t.test('#div', function(t) {
t.equals((new Point(0, 0).div(5)).equals(new Point(0, 0)), true);
t.equals((new Point(0, 1).div(5)).equals(new Point(0, 1/5)), true);
t.equals((new Point(1, 1).div(5)).equals(new Point(1/5, 1/5)), true);
t.end();
});
t.test('#multByPoint', function(t) {
t.equals((new Point(0, 0).multByPoint(new Point(5,5))).equals(new Point(0, 0)), true);
t.equals((new Point(0, 1).multByPoint(new Point(5,5))).equals(new Point(0, 5)), true);
t.equals((new Point(1, 1).multByPoint(new Point(4,5))).equals(new Point(4, 5)), true);
t.end();
});
t.test('#divByPoint', function(t) {
t.equals((new Point(0, 0).divByPoint(new Point(5,5))).equals(new Point(0, 0)), true);
t.equals((new Point(0, 1).divByPoint(new Point(5,5))).equals(new Point(0, 1/5)), true);
t.equals((new Point(1, 1).divByPoint(new Point(4,5))).equals(new Point(1/4, 1/5)), true);
t.end();
});
t.test('#rotate', function(t) {
t.equals((new Point(0, 0).rotate(0)).equals(new Point(0, 0)), true);
t.deepEquals((new Point(0, 1).rotate(Math.PI/2)).round(), new Point(-1, 0));
t.deepEquals((new Point(0, 1).rotate(Math.PI)).round(), new Point(0, -1));
t.end();
});
t.test('#rotateAround', function(t) {
t.deepEquals((new Point(2, 3).rotateAround(Math.PI/2, new Point(2,2))).round(), new Point(1, 2));
t.deepEquals((new Point(2, 3).rotateAround(Math.PI, new Point(2,2))).round(), new Point(2, 1));
t.end();
});
t.test('#round', function(t) {
t.equals((new Point(0, 0).round()).equals(new Point(0, 0)), true);
t.equals((new Point(0, 0.5).round()).equals(new Point(0, 1)), true);
t.equals((new Point(0.2, 0.2).round()).equals(new Point(0, 0)), true);
t.end();
});
t.test('#angle', function(t) {
t.equals((new Point(0, 0).angle()), 0);
t.equals((new Point(10, 10).angle()), Math.PI / 4);
t.equals((new Point(0, 10).angle()), Math.PI / 2);
t.equals((new Point(10, 0).angle()), 0);
t.end();
});
t.test('#angleTo', function(t) {
var b = new Point(0, 0);
t.equals((new Point(0, 0).angleTo(b)), 0);
t.equals((new Point(10, 10).angleTo(b)), Math.PI / 4);
t.equals((new Point(0, 10).angleTo(b)), Math.PI / 2);
t.equals((new Point(10, 0).angleTo(b)), 0);
t.end();
});
t.test('#angleWith', function(t) {
var b = new Point(0, 0);
t.equals((new Point(0, 0).angleWith(b)), 0);
t.equals((new Point(10, 10).angleWith(b)), 0);
t.equals((new Point(0, 10).angleWith(b)), 0);
t.equals((new Point(10, 0).angleWith(b)), 0);
t.end();
});
t.test('#angleWithSep', function(t) {
t.equals((new Point(0, 0).angleWithSep(0, 0)), 0);
t.equals((new Point(10, 10).angleWithSep(0, 0)), 0);
t.equals((new Point(0, 10).angleWithSep(0, 0)), 0);
t.equals((new Point(10, 0).angleWithSep(0, 0)), 0);
t.end();
});
t.test('#matMult', function(t) {
t.equals((new Point(0, 0).matMult([0, 0, 0, 0])).equals(new Point(0, 0)), true);
t.deepEquals((new Point(1, 1).matMult([0, 0, 0, 0])), new Point(0, 0));
t.deepEquals((new Point(1, 1).matMult([1, 0, 1, 0])), new Point(1, 1));
t.deepEquals((new Point(1, 1).matMult([1, 0, 0, 0])), new Point(1, 0));
t.deepEquals((new Point(1, 1).matMult([0, 0, 1, 0])), new Point(0, 1));
t.deepEquals((new Point(1, 1).matMult([0, 0, 1, 2])), new Point(0, 3));
t.deepEquals((new Point(1, 1).matMult([1, 1, 1, 1])), new Point(2, 2));
t.end();
});
t.test('#perp', function(t) {
t.test('calculates a vector perpendicular to the given vector', function() {
t.deepEqual(new Point(0, 1000).perp(), new Point(-1000, 0));
t.end();
});
});
t.test('#add', function(t) {
t.test('adds two vectors', function() {
t.deepEqual(new Point(0, 0).add(new Point(10, 10)), new Point(10, 10));
t.end();
});
});
t.test('#sub', function(t) {
t.test('adds subtracts a vector from another', function() {
t.deepEqual(new Point(0, 0).sub(new Point(10, 10)), new Point(-10, -10));
t.end();
});
});
});
});