# simplicial-complex-contour

> Extract a contour on a simplicial complex

Latest version **1.0.2** (published 2015-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install simplicial-complex-contour
pnpm add simplicial-complex-contour
yarn add simplicial-complex-contour
bun add simplicial-complex-contour
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2015-03-24 |
| First published | 2014-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Mikola Lysenko |
| Maintainers | mikolalysenko |
| Keywords | simplicial, complex, contour, line, triangle, tetrahedra, mesh |

## Links

- npm: https://www.npmjs.com/package/simplicial-complex-contour
- Repository: https://github.com/mikolalysenko/simplicial-complex-contour
- Issues: https://github.com/mikolalysenko/simplicial-complex-contour/issues
- npm.io page: https://npm.io/package/simplicial-complex-contour

## Dependencies (4)

- [ndarray](https://npm.io/package/ndarray.md) ^1.0.15
- [ndarray-sort](https://npm.io/package/ndarray-sort.md) ^1.0.0
- [typedarray-pool](https://npm.io/package/typedarray-pool.md) ^1.1.0
- [marching-simplex-table](https://npm.io/package/marching-simplex-table.md) ^1.0.0

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2015-03-24
- 1.0.1 — 2015-03-24
- 1.0.0 — 2014-12-05

## README

simplicial-complex-contour
==========================
Finds a piecewise-linear isocontour on a simplicial complex using the marching simplex method.

# Example

```javascript
var extractContour = require('simplicial-complex-contour')
var bunny = require('bunny')

//Solve for the curve z=0 on the surface of the bunny
var zvalues = bunny.positions.map(function(p) {
  return p[2]
})
var curve = extractContour(bunny.cells, zvalues, 0.0)

//Unpack edges and positions of curve
var curveEdges = curve.cells
var curvePositions = curve.vertexWeights.map(function(w,i) {
  var a = bunny.positions[curve.vertexIds[i][0]]
  var b = bunny.positions[curve.vertexIds[i][1]]

  return [
    w * a[0] + (1 - w) * b[0],
    w * a[1] + (1 - w) * b[1],
    w * a[2] + (1 - w) * b[2]
  ]
})

//Render the curve
console.log({
  cells: curveEdges,
  positions: curvePositions
})
```

# Install

```
npm install simplicial-complex-contour
```

# API

#### `require('simplicial-complex-contour')(cells, values[, level])`
Computes a piecewise linear solution to the solution `values=levels`

* `cells` is an array of simplices represented by tuples of vertex indices
* `values` is an array of values defined at each vertex of the cell complex
* `level` is the level at which the surface is extracted (Default 0)

**Returns** An object with 3 properties

* `cells` which are the cells of the extracted isosurface
* `vertexIds` which is an array of pairs of vertex ids encoding the crossing edges
* `vertexWeights` which are linear weights applied to each vertex

# Credits
(c) 2014 Mikola Lysenko. MIT License

---
_Source: https://npm.io/package/simplicial-complex-contour · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
