diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3a03d01 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,60 @@ +name: geometry-processing - Continuous Integration + +on: + push + +jobs: + test: + name: Run Unit Tests + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + lfs: true + + - name: Install Testing Frameworks + run: | + echo '{ "type": "module", "scripts": { "test": "mocha tests/**/*.js --reporter mocha-github-actions-reporter" } }' >package.json + npm install --save-dev mocha chai mocha-github-actions-reporter + + - name: Run Unit Tests + timeout-minutes: 5 + run: npm test + + docs: + name: Build Docs + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + lfs: true + + - name: Install Doc Generation Frameworks + run: | + echo '{ "type": "module", "scripts": { "docs": "jsdoc -c doc-config/jsdoc.conf.json -t node_modules/ink-docstrap/template/ -R README.md -r -d docs ./" } }' >package.json + npm install --save-dev jsdoc ink-docstrap + + - name: Pre-Process Docs + run: | + cp doc-config/site.cosmo-rohan.css node_modules/ink-docstrap/template/static/styles/site.cosmo-rohan.css + + - name: Generate Docs + run: npm run docs + + - name: Post-Process Docs + run: sed -e 's/imgs\//..\/imgs\//g' docs/index.html > docs/index.html.tmp && mv docs/index.html.tmp docs/index.html + + - name: Commit Updated Docs + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Actions" + git add docs + git diff-index --quiet HEAD || git commit -m "Rebuild Docs" + + - name: Push Changes to branch + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} diff --git a/core/corner.js b/core/corner.js index 7aef8f1..d59ff3e 100644 --- a/core/corner.js +++ b/core/corner.js @@ -1,5 +1,3 @@ -"use strict"; - class Corner { /** * This class represents a corner in a {@link module:Core.Mesh Mesh}. It is a convenience @@ -58,3 +56,5 @@ class Corner { return this.index; } } + +export default Corner; \ No newline at end of file diff --git a/core/discrete-exterior-calculus.js b/core/discrete-exterior-calculus.js index d89cf07..d2914f0 100644 --- a/core/discrete-exterior-calculus.js +++ b/core/discrete-exterior-calculus.js @@ -1,7 +1,9 @@ -"use strict"; +import LinearAlgebra from '../linear-algebra/linear-algebra.js'; +let SparseMatrix = LinearAlgebra.SparseMatrix; +let Triplet = LinearAlgebra.Triplet; /** - * This class contains methods to build common {@link https://cs.cmu.edu/~kmcrane/Projects/DDG/paper.pdf discrete exterior calculus} operators. + * This class contains methods to build common {@link https://www.cs.cmu.edu/~kmcrane/Projects/DDG/paper.pdf discrete exterior calculus} operators. * @memberof module:Core */ class DEC { @@ -124,3 +126,5 @@ class DEC { return SparseMatrix.fromTriplet(T); } } + +export default DEC; \ No newline at end of file diff --git a/core/edge.js b/core/edge.js index dc87ad5..2501f9b 100644 --- a/core/edge.js +++ b/core/edge.js @@ -1,5 +1,3 @@ -"use strict"; - class Edge { /** * This class represents an edge in a {@link module:Core.Mesh Mesh}. @@ -30,3 +28,5 @@ class Edge { return this.index; } } + +export default Edge; \ No newline at end of file diff --git a/core/face.js b/core/face.js index 7b555eb..1b4cbea 100644 --- a/core/face.js +++ b/core/face.js @@ -1,5 +1,3 @@ -"use strict"; - class Face { /** * This class represents a face in a {@link module:Core.Mesh Mesh}. @@ -306,4 +304,6 @@ class FaceCornerIterator { } } } -} \ No newline at end of file +} + +export default Face; \ No newline at end of file diff --git a/core/geometry.js b/core/geometry.js index b66e054..0050e04 100644 --- a/core/geometry.js +++ b/core/geometry.js @@ -1,4 +1,10 @@ -"use strict"; +import LinearAlgebra from '../linear-algebra/linear-algebra.js'; +let Vector = LinearAlgebra.Vector; +let Complex = LinearAlgebra.Complex; +let SparseMatrix = LinearAlgebra.SparseMatrix; +let Triplet = LinearAlgebra.Triplet; +let ComplexSparseMatrix = LinearAlgebra.ComplexSparseMatrix; +let ComplexTriplet = LinearAlgebra.ComplexTriplet; class Geometry { /** @@ -245,7 +251,7 @@ class Geometry { /** * Computes the circumcentric dual area of a vertex. - * @see {@link http://cs.cmu.edu/~kmcrane/Projects/Other/TriangleAreasCheatSheet.pdf} + * @see {@link http://www.cs.cmu.edu/~kmcrane/Projects/Other/TriangleAreasCheatSheet.pdf} * @method module:Core.Geometry#circumcentricDualArea * @param {module:Core.Vertex} v The vertex whose circumcentric dual area needs to be computed. * @returns {number} @@ -572,3 +578,5 @@ function normalize(positions, vertices, rescale = true) { } } } + +export { Geometry, normalize }; \ No newline at end of file diff --git a/core/halfedge.js b/core/halfedge.js index 202f902..fc3cdbd 100644 --- a/core/halfedge.js +++ b/core/halfedge.js @@ -1,5 +1,3 @@ -"use strict"; - /** * This module implements a halfedge mesh data structure and its associated geometry. * A halfedge mesh stores mesh elements such as vertices, edges and faces as well as @@ -58,3 +56,5 @@ class Halfedge { return this.index; } } + +export default Halfedge; \ No newline at end of file diff --git a/core/mesh-subset.js b/core/mesh-subset.js index cc0f947..f54ff90 100644 --- a/core/mesh-subset.js +++ b/core/mesh-subset.js @@ -1,5 +1,3 @@ -"use strict"; - class MeshSubset { /** * This class represents a subset of a {@link module:Core.Mesh Mesh} @@ -212,3 +210,5 @@ class MeshSubset { return true; } } + +export default MeshSubset; \ No newline at end of file diff --git a/core/mesh.js b/core/mesh.js index 8bf01fd..852ee76 100644 --- a/core/mesh.js +++ b/core/mesh.js @@ -1,4 +1,8 @@ -"use strict"; +import Vertex from './vertex.js'; +import Edge from './edge.js'; +import Face from './face.js'; +import Halfedge from './halfedge.js'; +import Corner from './corner.js'; class Mesh { /** @@ -207,7 +211,7 @@ class Mesh { } // index elements - this.indexElements(); + this.indexElements(); return true; } @@ -401,3 +405,5 @@ function indexElements(elementList) { return index; } + +export { Mesh, indexElements } \ No newline at end of file diff --git a/core/vertex.js b/core/vertex.js index d9708ae..d3980b6 100644 --- a/core/vertex.js +++ b/core/vertex.js @@ -1,5 +1,3 @@ -"use strict"; - class Vertex { /** * This class represents a vertex in a {@link module:Core.Mesh Mesh}. @@ -335,4 +333,6 @@ class VertexCornerIterator { } } } -} \ No newline at end of file +} + +export default Vertex; \ No newline at end of file diff --git a/doc-config/jsdoc.conf.json b/doc-config/jsdoc.conf.json index 435d2e4..94cea71 100644 --- a/doc-config/jsdoc.conf.json +++ b/doc-config/jsdoc.conf.json @@ -26,6 +26,6 @@ "hardwrap": true }, "source": { - "excludePattern": "geometry-processing-js/node" + "excludePattern": "node_modules" } } diff --git a/docs/classes.list.html b/docs/classes.list.html index d18a082..4728373 100644 --- a/docs/classes.list.html +++ b/docs/classes.list.html @@ -47,7 +47,7 @@
The implementation of geometry-processing-js attempts to minimize the use of obscure Javascript language features. It should not be too difficult for anyone with experience in a dynamic language like Python or familiar with the principles of Object Oriented Programming to get a handle on Javascript syntax by reading through some of the code in this framework. The documentation contains examples specific to this framework which will also be of help. For a more formal introduction to Javascript, checkout this really nice tutorial.
This documentation was generated using jsdoc and ink-docstrap. We used a modified version of the cosmo theme. After installing jsdoc and ink-docstrap, you can build the documentation by running
-jsdoc -c node_modules/ink-docstrap/template/jsdoc.conf.json -t node_modules/ink-docstrap/template/ -R geometry-processing-js/README.md -r -d geometry-processing-js/docs
-
+See guide here.
Email: rohansawhney@cs.cmu.edu
@@ -206,9 +204,9 @@