Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

earcut

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

earcut - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

.eslintrc

51

package.json
{
"name": "earcut",
"version": "1.3.0",
"version": "1.4.0",
"description": "The fastest and smallest JavaScript polygon triangulation library for your WebGL apps",

@@ -17,52 +17,11 @@ "main": "src/earcut.js",

"devDependencies": {
"browserify": "^8.1.3",
"browserify": "^9.0.3",
"coveralls": "^2.11.2",
"eslint": "^0.15.0",
"istanbul": "^0.3.5",
"eslint": "^0.16.1",
"istanbul": "^0.3.7",
"mkdirp": "^0.5.0",
"tape": "^3.5.0",
"uglify-js": "^2.4.16",
"watchify": "^2.3.0"
},
"eslintConfig": {
"rules": {
"no-use-before-define": [
2,
"nofunc"
],
"camelcase": 2,
"space-after-function-name": 2,
"space-in-parens": 2,
"space-before-blocks": 2,
"space-after-keywords": 2,
"space-before-function-parentheses": [
2,
{
"anonymous": "always",
"named": "never"
}
],
"comma-style": 2,
"no-lonely-if": 2,
"no-else-return": 2,
"new-cap": 2,
"no-empty": 2,
"no-new": 2,
"key-spacing": 2,
"no-multi-spaces": 2,
"space-in-brackets": 2,
"brace-style": 2,
"quotes": [
2,
"single"
],
"indent": 2,
"curly": 0,
"no-constant-condition": 0
},
"env": {
"node": true,
"browser": true
}
"watchify": "^2.4.0"
}
}

@@ -86,8 +86,13 @@ ## Earcut

#### Ports
#### Ports to other languages
- [mapbox/earcut.hpp](https://github.com/mapbox/earcut.hpp) (C++11)
- [Cawfree/earcut-j](https://github.com/Cawfree/earcut-j) (Java)
#### Changelog
##### 1.4.0 (Mar 9, 2015)
- Fixed indexed output to produce indices not multiplied by dimension and work with any number of dimensions.
##### 1.3.0 (Feb 24, 2015)

@@ -94,0 +99,0 @@

@@ -168,7 +168,7 @@ 'use strict';

if (i === null) {
var dim = node.p.length;
var vertices = triangles.vertices;
node.index = i = vertices.length;
vertices.push(node.p[0]);
vertices.push(node.p[1]);
if (node.p.length > 2) vertices.push(node.p[2]);
node.index = i = vertices.length / dim;
for (var d = 0; d < dim; d++) vertices.push(node.p[d]);
}

@@ -175,0 +175,0 @@ triangles.indices.push(i);

@@ -22,2 +22,5 @@ 'use strict';

indicesCreationTest('indices-2d');
indicesCreationTest('indices-3d');
function areaTest(filename, expectedDeviation, indexed) {

@@ -34,10 +37,12 @@ expectedDeviation = expectedDeviation || 0.000001;

area = 0,
i;
i,
dim;
if (vertices) {
dim = data[0][0].length;
for (i = 0; i < indices.length; i += 3) {
area += triangleArea(
[vertices[indices[i]], vertices[indices[i] + 1]],
[vertices[indices[i + 1]], vertices[indices[i + 1] + 1]],
[vertices[indices[i + 2]], vertices[indices[i + 2] + 1]]);
[vertices[dim * indices[i]], vertices[dim * indices[i] + 1]],
[vertices[dim * indices[i + 1]], vertices[dim * indices[i + 1] + 1]],
[vertices[dim * indices[i + 2]], vertices[dim * indices[i + 2] + 1]]);
}

@@ -82,1 +87,12 @@ } else {

}
function indicesCreationTest(filename) {
test(filename, function (t) {
var data = JSON.parse(fs.readFileSync(path.join(__dirname, '/fixtures/' + filename + '.json'))),
created = earcut(data.input, true);
t.ok(JSON.stringify(created.vertices) === JSON.stringify(data.expected.vertices), 'created vertices [' + created.vertices + '] are as expected: [' + data.expected.vertices + ']');
t.ok(JSON.stringify(created.indices) === JSON.stringify(data.expected.indices), 'created indices [' + created.indices + '] are as expected: [' + data.expected.indices + ']');
t.end();
});
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc