# svg-intersections

> A library of intersection algorithms covering all SVG shape types

Latest version **0.4.0** (published 2018-02-12) · BSD license · 0 weekly downloads

## Install

```sh
npm install svg-intersections
pnpm add svg-intersections
yarn add svg-intersections
bun add svg-intersections
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2018-02-12 |
| First published | 2015-08-07 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | separate (@types/svg-intersections) |
| Module format | CommonJS |
| Node | >= 0.10.4 |
| Dependencies | 2 |
| Unpacked size | 108.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kevin Lindsey |
| Maintainers | jbreckel, jfschwarz, signavio |
| Keywords | intersection, bezier, circle, ellipse, line, polygon, rectangle, path |

## Links

- npm: https://www.npmjs.com/package/svg-intersections
- Repository: https://github.com/effektif/svg-intersections
- Homepage: https://github.com/effektif/svg-intersections#readme
- Issues: https://github.com/effektif/svg-intersections/issues
- npm.io page: https://npm.io/package/svg-intersections

## Dependencies (2)

- [kld-affine](https://npm.io/package/kld-affine.md) 2.0.0
- [kld-polynomial](https://npm.io/package/kld-polynomial.md) 0.1.1

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.4.0 (latest) — 2018-02-12
- 0.3.2 — 2017-10-30
- 0.3.1 — 2017-08-17
- 0.3.0 — 2017-01-23
- 0.2.5 — 2016-07-05
- 0.2.4 — 2016-06-08
- 0.2.3 — 2015-08-10
- 0.2.2 — 2015-08-07
- 0.2.1 — 2015-08-07
- 0.2.0 — 2015-08-07

## README

svg-intersections
=================

A library of intersection algorithms covering all SVG shape types.  
Possible to intersect rotated/scaled/skewed shapes.


Installation
-------
    npm install svg-intersections



API
---

This module exports two functions: 

The `intersect` function takes two shapes as an input an returns an result 
object providing a result status, and all intersection points of the two shapes.

```intersect (shape1, shape2)```


The `shape` function wraps the necessary input parameters for each of 
the two shapes. It requires the SVG element name of the shape as a string 
and an object of the SVG element's attributes.

```shape (svgElementName, svgAttributes)```


Usage example
-------------

**Example 1:**

![Example image](./images/UsageExample1.png)

```javascript
    
    var svgIntersections = require('svg-intersections');
    var intersect = svgIntersections.intersect;
    var shape = svgIntersections.shape;

    var intersections = intersect(  
        shape("circle", { cx: 0, cy: 0, r: 50 }),
        shape("rect", { x: 0, y: 0, width: 60, height: 30 })  
    );

```


Credits
-------

The implementation is based on the intersection procedures by Kevin Lindsey 
([http://www.kevlindev.com](www.kevlindev.com)) with contributions by 
Robert Benko ([http://www.quazistax.com](www.quazistax.com)).

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