triangulate-polyline

WebJar for triangulate-polyline

Лицензия

Лицензия

MIT
Группа

Группа

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

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

triangulate-polyline
Последняя версия

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

1.0.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

triangulate-polyline
WebJar for triangulate-polyline
Ссылка на сайт

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

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

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

https://github.com/mikolalysenko/triangulate-polyline

Скачать triangulate-polyline

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

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

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : cdt2d jar [1.0.0,2)

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

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

triangulate-polyline

Triangulates a polygon with holes encoded as a list of loops.

Example

var triangulate = require("triangulate-polyline")

var positions = [
  [-2, -2],
  [ 2, -2],
  [ 2,  2],
  [-2,  2],
  [-1, -1],
  [ 1, -1],
  [ 1,  1],
  [-1,  1]
]

var loops = [
  [0, 1, 2, 3],
  [4, 5, 6, 7]
]

console.log(triangulate(loops, positions))

Example output:

[ [ 3, 7, 2 ],
  [ 3, 0, 7 ],
  [ 0, 4, 7 ],
  [ 4, 0, 1 ],
  [ 5, 4, 1 ],
  [ 6, 5, 1 ],
  [ 6, 1, 2 ],
  [ 7, 6, 2 ] ]

Install

npm install triangulate-polyline

API

require("triangulate-polyline")(loops, positions)

Triangulates a complex polygon

  • loops is a list of vertices of the polygon, where each vertex is represented as an index into positions
  • positions is a list of vertex positions encoded, each represented by a length 2 array

Returns A list of triangles represented by triples of indices of position indices.

Note This library is built on top of poly2tri, which is not robust. Points which are close together or near the boundary of other loops may be incorrectly classified and could result in broken triangulations.

Credits

(c) 2014 Mikola Lysenko. MIT License

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

Версия
1.0.3