diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 06b86e86..15d04546 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,10 @@ -### Building and Contributing +# Contributing + +## License Agreement + +When providing any contributions, you must agree and be legally entitled to provide them for use and distribution in the project under the same terms as the [license](https://github.com/liabru/matter-js/blob/master/LICENSE), otherwise they can not be accepted. + +## Building To build you must first install [node.js](http://nodejs.org/) and [gulp](http://gulpjs.com/), then run @@ -8,8 +14,10 @@ This will install the required build dependencies, then run gulp dev -which is a task that builds the `matter-dev.js` file, spawns a `connect` and `watch` server, then opens `demo/dev.html` in your browser. Any changes you make to the source will automatically rebuild `matter-dev.js` and reload your browser for quick and easy testing. +which is a task that builds the `matter-dev.js` file, spawns a development server and opens `http://localhost:8000/demo/index.html` in your browser. Any changes you make to the source will automatically rebuild `matter-dev.js` and reload your browser. + +## Contributions -Contributions are welcome, please ensure they follow the same style and architecture as the rest of the code. You should run `gulp test` to ensure `eslint` gives no errors. Please do not include any changes to the files in the `build` directory. +Contributions by pull request are welcome! Please ensure they follow the same style and architecture as the rest of the code. You should run `gulp test` and ensure there are no reported errors. Please do not include any changes to the files in the `build` directory. All contributors must agree to the license agreement described at the beginning of this document. -If you'd like to contribute but not sure what to work on, feel free to message me. Thanks! \ No newline at end of file +If you'd like to contribute but not sure what to work on, feel free to get in touch. \ No newline at end of file diff --git a/LICENSE b/LICENSE index d434f8fb..0e1ed72f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Liam Brummitt +Copyright (c) Liam Brummitt and contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/body/Body.js b/src/body/Body.js index 271413c7..5f47a54f 100644 --- a/src/body/Body.js +++ b/src/body/Body.js @@ -626,6 +626,7 @@ var Axes = require('../geometry/Axes'); * @return {} */ var _totalProperties = function(body) { + // from equations at: // https://ecourses.ou.edu/cgi-bin/ebook.cgi?doc=&topic=st&chap_sec=07.2&page=theory // http://output.to/sideway/default.asp?qno=121100087 diff --git a/src/core/Common.js b/src/core/Common.js index b3c1c69e..350e7518 100644 --- a/src/core/Common.js +++ b/src/core/Common.js @@ -279,7 +279,7 @@ module.exports = Common; }; var _seededRandom = function() { - // https://gist.github.com/ngryman/3830489 + // https://en.wikipedia.org/wiki/Linear_congruential_generator Common._seed = (Common._seed * 9301 + 49297) % 233280; return Common._seed / 233280; }; @@ -411,7 +411,9 @@ module.exports = Common; * @return {array} Partially ordered set of vertices in topological order. */ Common.topologicalSort = function(graph) { - // https://mgechev.github.io/javascript-algorithms/graphs_others_topological-sort.js.html + // https://github.com/mgechev/javascript-algorithms + // Copyright (c) Minko Gechev (MIT license) + // Modifications: tidy formatting and naming var result = [], visited = [], temp = []; diff --git a/src/geometry/Svg.js b/src/geometry/Svg.js index 4f8a8c94..971d0ab7 100644 --- a/src/geometry/Svg.js +++ b/src/geometry/Svg.js @@ -151,6 +151,9 @@ var Bounds = require('../geometry/Bounds'); var _svgPathToAbsolute = function(path) { // http://phrogz.net/convert-svg-path-to-all-absolute-commands + // Copyright (c) Gavin Kistner + // http://phrogz.net/js/_ReuseLicense.txt + // Modifications: tidy formatting and naming var x0, y0, x1, y1, x2, y2, segs = path.pathSegList, x = 0, y = 0, len = segs.numberOfItems; diff --git a/src/geometry/Vertices.js b/src/geometry/Vertices.js index e35e50e4..1dd769f9 100644 --- a/src/geometry/Vertices.js +++ b/src/geometry/Vertices.js @@ -150,7 +150,7 @@ var Common = require('../core/Common'); j; // find the polygon's moment of inertia, using second moment of area - // http://www.physicsforums.com/showthread.php?t=25293 + // from equations at http://www.physicsforums.com/showthread.php?t=25293 for (var n = 0; n < v.length; n++) { j = (n + 1) % v.length; cross = Math.abs(Vector.cross(v[j], v[n])); @@ -354,6 +354,7 @@ var Common = require('../core/Common'); */ Vertices.isConvex = function(vertices) { // http://paulbourke.net/geometry/polygonmesh/ + // Copyright (c) Paul Bourke (use permitted) var flag = 0, n = vertices.length, @@ -396,7 +397,7 @@ var Common = require('../core/Common'); * @return [vertex] vertices */ Vertices.hull = function(vertices) { - // http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain + // http://geomalgorithms.com/a10-_hull-1.html var upper = [], lower = [], @@ -411,7 +412,7 @@ var Common = require('../core/Common'); }); // build lower hull - for (i = 0; i < vertices.length; i++) { + for (i = 0; i < vertices.length; i += 1) { vertex = vertices[i]; while (lower.length >= 2 @@ -423,7 +424,7 @@ var Common = require('../core/Common'); } // build upper hull - for (i = vertices.length - 1; i >= 0; i--) { + for (i = vertices.length - 1; i >= 0; i -= 1) { vertex = vertices[i]; while (upper.length >= 2 diff --git a/src/module/license.js b/src/module/license.js index df34e832..a8a00999 100644 --- a/src/module/license.js +++ b/src/module/license.js @@ -1,7 +1,7 @@ /** * The MIT License (MIT) * - * Copyright (c) 2014 Liam Brummitt + * Copyright (c) Liam Brummitt and contributors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal