segseg

WebJar for segseg

Лицензия

Лицензия

MIT
Группа

Группа

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

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

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

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

0.2.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

segseg
WebJar for segseg
Ссылка на сайт

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

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

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

https://github.com/tmpvar/segseg

Скачать segseg

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

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

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

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

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

segseg

Build Status

Intersection detection between two line segments in 2d space.

Usage

import segseg from 'segseg'


/*
                (0, 5)
                   |
  (-10, 0) --------+-------  (10, 0)
                   |
                (0, -5)
*/

const isect = [ NaN, NaN ] // the output vector where collision point is stored

//                       seg 1                   seg 2
//                ┌-------------------┐   ┌-----------------┐
if (segseg(isect, [ -10, 0 ], [ 10, 0 ],  [ 0, 5 ], [ 0, -5 ]))
    console.log('intersected!', isect.join(','))  // output:   intersected! 0,0

Node compatibility

This is a pure es module, and requires node v12+ to run. However if you're using a popular bundler such as rollup, webpack, etc. This should be compatible with most frontend setups too.

Credits

This code was ported from Mukesh Prasad's example implementation which was included in graphics gems 2.

Internally the code uses a point-segment check for some edge cases, from https://gist.github.com/mattdesl/47412d930dcd8cd765c871a65532ffac

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

Версия
0.2.2