<jupyter_start><jupyter_text>Two 2D curves intersections<jupyter_code>import numpy as np
import matplotlib.pyplot as plt

from skcurve.curves import lissajous
from skcurve.plot import curveplot<jupyter_output><empty_output><jupyter_text>Create 2D curve objectsWe create two "lissajous" curve objects with different parameters<jupyter_code>crv1 = lissajous(t_start=-0.05, t_stop=np.pi*2-0.05, p_count=500, a=3, b=4)
crv2 = lissajous(t_start=0.05, t_stop=np.pi*2+0.05, p_count=500, a=3, b=4, d=1.0)<jupyter_output><empty_output><jupyter_text>Find all intersections between two curves<jupyter_code>%%time
intersections = crv1.intersect(crv2)
print(f'The number of intersections: {len(intersections)}')<jupyter_output>The number of intersections: 48
Wall time: 118 ms<jupyter_text>Plot curves and intersection pointsWe use `curveplot` to plot the curves, and intersection points.<jupyter_code>intsct_px = [] 
intsct_py = []

for n, intersection in enumerate(intersections, start=1):
    p = intersection.intersect_point
    intsct_px.append(p[0])    
    intsct_py.append(p[1])

f, ax = plt.subplots(1, 1, figsize=(9, 7))

# we can use chained API for plot two and more curves
curveplot(crv1, axes=ax).curveplot(crv2)

st1 = crv1[0]
st2 = crv2[0]

ax.scatter([st1[0]], [st1[1]], color='r', marker='.', zorder=3);
ax.scatter([st2[0]], [st2[1]], color='b', marker='.', zorder=4);

ax.scatter(intsct_px, intsct_py, zorder=5, edgecolor='k', facecolor='r');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14073071718538566, 'fraction_numerical': 0.04262516914749662, 'mean_word_length': 7.038043478260869, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '246636', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 613, 'n_tokens_neox': 578, 'n_words': 124, 'path': 'examples/curves_intersections.ipynb', 'repo_name': 'espdev/scikit-curve', 'size': '1478'}