Metadata-Version: 2.4
Name: intersect
Version: 1.3.2
Summary: Intersection Of two curves
Home-page: https://github.com/sukhbinder/intersection
Author: sukhbinder
Author-email: sukh2010@yahoo.com
License: MIT
Keywords: Intersection,curves,numpy
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 2.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# Intersection Of two curves in Pure numpy
[![PyPI](https://img.shields.io/pypi/v/intersection.svg)](https://pypi.org/project/intersection/)
[![Changelog](https://img.shields.io/github/v/release/sukhbinder/intersection?include_prereleases&label=changelog)](https://github.com/sukhbinder/intersection/releases)
[![Tests](https://github.com/sukhbinder/intersection/workflows/Test/badge.svg)](https://github.com/sukhbinder/intersection/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/sukhbinder/intersection/blob/main/LICENSE)


Inspired from [this](http://uk.mathworks.com/matlabcentral/fileexchange/11837-fast-and-robust-curve-intersections) matlab implementation, wrote this python implementation of how to detect intersection of two curves.


![image](https://raw.githubusercontent.com/sukhbinder/intersection/master/images/curve_intersection_python.png)


## Example usage

```python
from intersect import intersection

a, b = 1, 2
phi = np.linspace(3, 10, 100)
x1 = a*phi - b*np.sin(phi)
y1 = a - b*np.cos(phi)

x2 = phi
y2 = np.sin(phi)+2
x, y, i, j = intersection(x1, y1, x2, y2)

print(f"curves intersect at elements {i, j}, corresponding to coordinates {x,y}")
plt.plot(x1, y1, c="r")
plt.plot(x2, y2, c="g")
plt.plot(x, y, "*k")
plt.show()


```

## Install
To install

```bash

pip install intersect

```
