svg-path-contours

WebJar for svg-path-contours

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

svg-path-contours
Последняя версия

Последняя версия

2.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

svg-path-contours
WebJar for svg-path-contours
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/mattdesl/svg-path-contours

Скачать svg-path-contours

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/svg-path-contours/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>svg-path-contours</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/svg-path-contours/
implementation 'org.webjars.npm:svg-path-contours:2.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/svg-path-contours/
implementation ("org.webjars.npm:svg-path-contours:2.0.0")
'org.webjars.npm:svg-path-contours:jar:2.0.0'
<dependency org="org.webjars.npm" name="svg-path-contours" rev="2.0.0">
  <artifact name="svg-path-contours" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='svg-path-contours', version='2.0.0')
)
libraryDependencies += "org.webjars.npm" % "svg-path-contours" % "2.0.0"
[org.webjars.npm/svg-path-contours "2.0.0"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.webjars.npm : abs-svg-path jar [0.1.1,0.2)
org.webjars.npm : adaptive-bezier-curve jar [1.0.3,2)
org.webjars.npm : normalize-svg-path jar [0.1.0,0.2)
org.webjars.npm : vec2-copy jar [1.0.0,2)

Модули Проекта

Данный проект не имеет модулей.

svg-path-contours

stable

Approximates an SVG path into a discrete list of 2D contours (polylines). This is useful for collision detection, intersection, triangulation & WebGL rendering, etc. It does not attempt to clean or optimize the discretized points.

img

Usage:

var parse = require('parse-svg-path')
var contours = require('svg-path-contours')

var path = 'm10,10C45.812,24.024,45.673,24,45.529,24H31.625
   c0.482-3.325,6.464-2.758,8.913-3.155z'

var result = contours(parse(path))

/* 
[ 
 [ [10,10], ...etc ]
 [ [x, y], ... ]
]
*/

Triangulation example:

var parse = require('parse-svg-path')
var simplify = require('simplify-path')
var contours = require('svg-path-contours')
var triangulate = require('triangulate-contours')

//get a list of polylines/contours from svg contents
var lines = contours(parse(path))

//simplify the contours before triangulation
lines = lines.map(function(path) {
    return simplify(path, threshold)
})

//turns into triangles, returns { positions, cells }
var shape = triangulate(lines)

//now draw the simplicial complex with Canvas/WebGL/etc

See demo/index.js for exmaple.

Usage

NPM

contours(svg)

Takes parsed SVG contents from parse-svg-path and produces a list of 2D polylines representing the contours of the shape.

License

MIT, see LICENSE.md for details.

Версии библиотеки

Версия
2.0.0