Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/svg-3d-simplicial-complex
Renders a simplicial complex to a list of polygons in SVG
https://github.com/mikolalysenko/svg-3d-simplicial-complex
Last synced: about 2 months ago
JSON representation
Renders a simplicial complex to a list of polygons in SVG
- Host: GitHub
- URL: https://github.com/mikolalysenko/svg-3d-simplicial-complex
- Owner: mikolalysenko
- License: mit
- Created: 2014-03-22T19:01:18.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-03-22T23:49:32.000Z (almost 11 years ago)
- Last Synced: 2024-04-26T18:06:15.899Z (8 months ago)
- Language: JavaScript
- Size: 348 KB
- Stars: 24
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
svg-3d-simplicial-complex
=========================
Renders a simplicial complex to a list of elements in an SVG file# Example
```javascript
var bunny = require("bunny")
var mat4 = require("gl-matrix").mat4
var render = require("svg-3d-simplicial-complex")console.log('')
console.log(render(bunny.cells, bunny.positions, {
view: mat4.lookAt(mat4.create(), [5, 10, 20], [0,2,0], [0,1,0]),
projection: mat4.perspective(mat4.create(),
Math.PI/4.0,
1.0,
0.1,
1000.0),
viewport: [[0,0], [512,512]]
}))
console.log("")
```Output svg:
# Install
```
npm install svg-3d-simplicial-complex
```# API
### `require("svg-3d-simplicial-complex")(cells,positions,[,options])`
Renders a simplicial complex as a list of elements* `cells` is an indexed list of facets
* `positions` is a list of vertex positions
* `options` is an object that has the following optional properties:+ `model` the model matrix for the camera
+ `view` the view matrix for the camera
+ `projection` the projection matrix for the camera
+ `viewport` the viewport for the rendered svgConventions for camera and viewport follow those from WebGL
**Returns** A string of `` svg elements that renders the simplicial complex.
# Credits
(c) 2014 Mikola Lysenko. MIT License