├── .gitignore
├── tests
├── data
│ ├── test_none_line.py
│ ├── test_degenerate_duplicates_01.py
│ ├── test_isect_cross_01.py
│ ├── test_none_square.py
│ ├── test_isect_bowtie_01.py
│ ├── test_degenerate_zero_length_01.py
│ ├── test_none_circle.py
│ ├── test_degenerate_zero_length_02.py
│ ├── test_isect_crosshatch_02.py
│ ├── test_degenerate_colinear_01.py
│ ├── test_none_circle_2x.py
│ ├── test_none_circle_zigzag.py
│ ├── test_degenerate_colinear_02.py
│ ├── test_isect_crosshatch_01.py
│ ├── test_isect_crosshatch_03.py
│ ├── test_isect_crosshatch_04.py
│ ├── test_isect_spiro_01.py
│ └── test_isect_bowtie_circle_01.py
├── data_svg
│ ├── test_none_line.svg
│ ├── test_isect_cross_01.svg
│ ├── test_none_square.svg
│ ├── test_isect_bowtie_01.svg
│ ├── test_degenerate_zero_length_01.svg
│ ├── test_none_circle.svg
│ ├── test_degenerate_zero_length_02.svg
│ ├── test_none_circle_2x.svg
│ ├── test_none_circle_zigzag.svg
│ ├── test_isect_crosshatch_02.svg
│ ├── test_isect_crosshatch_01.svg
│ └── test_isect_bowtie_circle_01.svg
└── tests.py
├── setup.py
├── LICENSE
├── pyproject.toml
└── readme.rst
/.gitignore:
--------------------------------------------------------------------------------
1 | __pycache__/
2 | *.py[cod]
3 | *.egg-info
4 |
--------------------------------------------------------------------------------
/tests/data/test_none_line.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-1.000000, -1.000000), (1.000000, 1.000000)),
3 | )
4 |
--------------------------------------------------------------------------------
/tests/data/test_degenerate_duplicates_01.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((1.0, 1.0), (0.0, 1.0)),
3 | ((0.0, 1.0), (1.0, 1.0)),
4 | ((1.0, 1.0), (1.0, 1.0)),
5 | )
6 |
--------------------------------------------------------------------------------
/tests/data/test_isect_cross_01.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((1.000000, 0.000000), (-1.000000, -0.000000)),
3 | ((0.000000, 1.000000), (0.000000, -1.000000)),
4 | )
5 |
--------------------------------------------------------------------------------
/tests/data/test_none_square.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-1.000000, 1.000000), (-1.000000, -1.000000)),
3 | ((-1.000000, -1.000000), (1.000000, -1.000000)),
4 | ((1.000000, -1.000000), (1.000000, 1.000000)),
5 | ((1.000000, 1.000000), (-1.000000, 1.000000)),
6 | )
7 |
--------------------------------------------------------------------------------
/tests/data/test_isect_bowtie_01.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-1.000000, 1.000000), (1.000000, -1.000000)),
3 | ((1.000000, -1.000000), (-1.000000, -1.000000)),
4 | ((-1.000000, -1.000000), (1.000000, 1.000000)),
5 | ((1.000000, 1.000000), (-1.000000, 1.000000)),
6 | )
7 |
--------------------------------------------------------------------------------
/tests/data_svg/test_none_line.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/data_svg/test_isect_cross_01.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/data_svg/test_none_square.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | from setuptools import setup
4 |
5 | setup(
6 | name='isect_segments-bentley_ottmann',
7 | version='0.1.0',
8 | license='MIT',
9 | description='BentleyOttmann sweep-line implementation',
10 | author='Campbell Barton',
11 | author_email='ideasman42@gmail.com',
12 | url='https://github.com/ideasman42/isect_segments-bentley_ottmann',
13 | py_modules=['poly_point_isect'],
14 | zip_safe=True,
15 | classifiers=[
16 | 'Development Status :: 5 - Production/Stable',
17 | 'Intended Audience :: Developers',
18 | 'License :: OSI Approved :: MIT License',
19 | 'Operating System :: OS Independent',
20 | 'Programming Language :: Python',
21 | 'Programming Language :: Python :: 3',
22 | ],
23 | )
24 |
--------------------------------------------------------------------------------
/tests/data_svg/test_isect_bowtie_01.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010 by Bart Kiers
2 | Copyright (c) 2015 by Campbell Barton
3 |
4 | Permission is hereby granted, free of charge, to any person
5 | obtaining a copy of this software and associated documentation
6 | files (the "Software"), to deal in the Software without
7 | restriction, including without limitation the rights to use,
8 | copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the
10 | Software is furnished to do so, subject to the following
11 | conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | OTHER DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: GPL-2.0-or-later
2 |
3 | [tool.autopep8]
4 | # Configuration for `autopep8`, allowing the command: autopep8 .
5 | # to reformat all source files.
6 | #
7 | # NOTE: the settings defined here map directly to command line arguments
8 | # which will override these settings when passed in to autopep8.
9 |
10 | max_line_length = 120
11 |
12 | ignore = [
13 | # Info: Use `isinstance()` instead of comparing types directly.
14 | # Why disable? Changes code logic, in rare cases we want to compare exact types.
15 | "E721",
16 | # Info: Fix bare except.
17 | # Why disable? Disruptive, leave our exceptions alone.
18 | "E722",
19 | # Info: Fix module level import not at top of file.
20 | # Why disable? Re-ordering imports is disruptive and breaks some scripts
21 | # that need to check if a module has already been loaded in the case of reloading.
22 | "E402",
23 | # Info: Fix various deprecated code (via lib2to3)
24 | # Why disable? Does nothing besides incorrectly adding a duplicate import,
25 | # could be reported as a bug except this is likely to be removed soon, see:
26 | # https://github.com/python/cpython/issues/84540.
27 | "W690",
28 | ]
29 |
30 | # Use aggressive as many useful edits are disabled unless it's enabled.
31 | # Any edits which are overly disruptive or risky can be removed in the `ignore` list.
32 | aggressive = 2
33 |
--------------------------------------------------------------------------------
/tests/data/test_degenerate_zero_length_01.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-1.000000, 0.000000), (0.000000, 1.000000)),
3 | ((-1.000000, 0.000000), (-1.000000, 0.000000)),
4 | ((0.000000, -1.000000), (-1.000000, 0.000000)),
5 | ((1.000000, 0.000000), (0.000000, -1.000000)),
6 | ((1.000000, 0.000000), (1.000000, 0.000000)),
7 | ((0.000000, 1.000000), (1.000000, 0.000000)),
8 | ((0.000000, 1.000000), (0.000000, 1.000000)),
9 | ((0.000000, -1.000000), (0.000000, -1.000000)),
10 | ((-0.900000, 0.000000), (0.000000, 0.900000)),
11 | ((-0.900000, 0.000000), (-0.900000, 0.000000)),
12 | ((0.000000, -0.900000), (-0.900000, 0.000000)),
13 | ((0.900000, 0.000000), (0.000000, -0.900000)),
14 | ((0.900000, 0.000000), (0.900000, 0.000000)),
15 | ((0.000000, 0.900000), (0.900000, 0.000000)),
16 | ((0.000000, 0.900000), (0.000000, 0.900000)),
17 | ((0.000000, -0.900000), (0.000000, -0.900000)),
18 | ((-0.800000, 0.000000), (0.000000, 0.800000)),
19 | ((-0.800000, 0.000000), (-0.800000, 0.000000)),
20 | ((0.000000, -0.800000), (-0.800000, 0.000000)),
21 | ((0.800000, 0.000000), (0.000000, -0.800000)),
22 | ((0.800000, 0.000000), (0.800000, 0.000000)),
23 | ((0.000000, 0.800000), (0.800000, 0.000000)),
24 | ((0.000000, 0.800000), (0.000000, 0.800000)),
25 | ((0.000000, -0.800000), (0.000000, -0.800000)),
26 | ((-0.700000, 0.000000), (0.000000, 0.700000)),
27 | ((-0.700000, 0.000000), (-0.700000, 0.000000)),
28 | ((0.000000, -0.700000), (-0.700000, 0.000000)),
29 | ((0.700000, 0.000000), (0.000000, -0.700000)),
30 | ((0.700000, 0.000000), (0.700000, 0.000000)),
31 | ((0.000000, 0.700000), (0.700000, 0.000000)),
32 | ((0.000000, 0.700000), (0.000000, 0.700000)),
33 | ((0.000000, -0.700000), (0.000000, -0.700000)),
34 | )
35 |
--------------------------------------------------------------------------------
/tests/data/test_none_circle.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-0.195090, 0.980785), (0.000000, 1.000000)),
3 | ((-0.382683, 0.923880), (-0.195090, 0.980785)),
4 | ((-0.555570, 0.831470), (-0.382683, 0.923880)),
5 | ((-0.707107, 0.707107), (-0.555570, 0.831470)),
6 | ((-0.831470, 0.555570), (-0.707107, 0.707107)),
7 | ((-0.923880, 0.382683), (-0.831470, 0.555570)),
8 | ((-0.980785, 0.195090), (-0.923880, 0.382683)),
9 | ((-1.000000, 0.000000), (-0.980785, 0.195090)),
10 | ((-0.980785, -0.195090), (-1.000000, 0.000000)),
11 | ((-0.923880, -0.382683), (-0.980785, -0.195090)),
12 | ((-0.831470, -0.555570), (-0.923880, -0.382683)),
13 | ((-0.707107, -0.707107), (-0.831470, -0.555570)),
14 | ((-0.555570, -0.831470), (-0.707107, -0.707107)),
15 | ((-0.382683, -0.923880), (-0.555570, -0.831470)),
16 | ((-0.195090, -0.980785), (-0.382683, -0.923880)),
17 | ((0.000000, -1.000000), (-0.195090, -0.980785)),
18 | ((0.195091, -0.980785), (0.000000, -1.000000)),
19 | ((0.382684, -0.923879), (0.195091, -0.980785)),
20 | ((0.555571, -0.831469), (0.382684, -0.923879)),
21 | ((0.707107, -0.707106), (0.555571, -0.831469)),
22 | ((0.831470, -0.555570), (0.707107, -0.707106)),
23 | ((0.923880, -0.382683), (0.831470, -0.555570)),
24 | ((0.980785, -0.195089), (0.923880, -0.382683)),
25 | ((1.000000, 0.000001), (0.980785, -0.195089)),
26 | ((0.980785, 0.195091), (1.000000, 0.000001)),
27 | ((0.923879, 0.382684), (0.980785, 0.195091)),
28 | ((0.831469, 0.555571), (0.923879, 0.382684)),
29 | ((0.707106, 0.707108), (0.831469, 0.555571)),
30 | ((0.555569, 0.831470), (0.707106, 0.707108)),
31 | ((0.382682, 0.923880), (0.555569, 0.831470)),
32 | ((0.195089, 0.980786), (0.382682, 0.923880)),
33 | ((0.000000, 1.000000), (0.195089, 0.980786)),
34 | )
35 |
--------------------------------------------------------------------------------
/tests/data/test_degenerate_zero_length_02.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-1.000000, 1.000000), (1.000000, 1.000000)),
3 | ((-1.000000, 1.000000), (-1.000000, 1.000000)),
4 | ((-1.000000, -1.000000), (-1.000000, 1.000000)),
5 | ((1.000000, -1.000000), (-1.000000, -1.000000)),
6 | ((1.000000, -1.000000), (1.000000, -1.000000)),
7 | ((1.000000, 1.000000), (1.000000, -1.000000)),
8 | ((1.000000, 1.000000), (1.000000, 1.000000)),
9 | ((-1.000000, -1.000000), (-1.000000, -1.000000)),
10 | ((-0.900000, 0.900000), (0.900001, 0.900000)),
11 | ((-0.900000, 0.900000), (-0.900000, 0.900000)),
12 | ((-0.900000, -0.900000), (-0.900000, 0.900000)),
13 | ((0.900001, -0.900000), (-0.900000, -0.900000)),
14 | ((0.900001, -0.900000), (0.900001, -0.900000)),
15 | ((0.900001, 0.900000), (0.900001, -0.900000)),
16 | ((0.900001, 0.900000), (0.900001, 0.900000)),
17 | ((-0.900000, -0.900000), (-0.900000, -0.900000)),
18 | ((-0.800000, 0.800000), (0.800000, 0.800000)),
19 | ((-0.800000, 0.800000), (-0.800000, 0.800000)),
20 | ((-0.800000, -0.800000), (-0.800000, 0.800000)),
21 | ((0.800000, -0.800000), (-0.800000, -0.800000)),
22 | ((0.800000, -0.800000), (0.800000, -0.800000)),
23 | ((0.800000, 0.800000), (0.800000, -0.800000)),
24 | ((0.800000, 0.800000), (0.800000, 0.800000)),
25 | ((-0.800000, -0.800000), (-0.800000, -0.800000)),
26 | ((-0.700000, 0.700000), (0.700000, 0.700000)),
27 | ((-0.700000, 0.700000), (-0.700000, 0.700000)),
28 | ((-0.700000, -0.700000), (-0.700000, 0.700000)),
29 | ((0.700000, -0.700000), (-0.700000, -0.700000)),
30 | ((0.700000, -0.700000), (0.700000, -0.700000)),
31 | ((0.700000, 0.700000), (0.700000, -0.700000)),
32 | ((0.700000, 0.700000), (0.700000, 0.700000)),
33 | ((-0.700000, -0.700000), (-0.700000, -0.700000)),
34 | )
35 |
--------------------------------------------------------------------------------
/tests/data/test_isect_crosshatch_02.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((0.000000, 1.000000), (0.000000, -1.000000)),
3 | ((1.000000, 0.300000), (-1.000000, 0.300000)),
4 | ((1.000000, 0.800000), (-1.000000, 0.800000)),
5 | ((-0.100000, 1.000000), (-0.100000, -1.000000)),
6 | ((-0.400000, 1.000000), (-0.400000, -1.000000)),
7 | ((-0.500000, 1.000000), (-0.500000, -1.000000)),
8 | ((-0.600000, 1.000000), (-0.600000, -1.000000)),
9 | ((-0.900000, 1.000000), (-0.900000, -1.000000)),
10 | ((0.900000, 1.000000), (0.900000, -1.000000)),
11 | ((0.600000, 1.000000), (0.600000, -1.000000)),
12 | ((0.500000, 1.000000), (0.500000, -1.000000)),
13 | ((0.400000, 1.000000), (0.400000, -1.000000)),
14 | ((0.100000, 1.000000), (0.100000, -1.000000)),
15 | ((1.000000, 0.000000), (-1.000000, 0.000000)),
16 | ((1.000000, 0.100000), (-1.000000, 0.100000)),
17 | ((1.000000, 0.200000), (-1.000000, 0.200000)),
18 | ((1.000000, 0.400000), (-1.000000, 0.400000)),
19 | ((1.000000, 0.500000), (-1.000000, 0.500000)),
20 | ((1.000000, 0.600000), (-1.000000, 0.600000)),
21 | ((1.000000, 0.700000), (-1.000000, 0.700000)),
22 | ((1.000000, 0.900000), (-1.000000, 0.900000)),
23 | ((1.000000, -0.900000), (-1.000000, -0.900000)),
24 | ((1.000000, -0.800000), (-1.000000, -0.800000)),
25 | ((1.000000, -0.700000), (-1.000000, -0.700000)),
26 | ((1.000000, -0.600000), (-1.000000, -0.600000)),
27 | ((1.000000, -0.500000), (-1.000000, -0.500000)),
28 | ((1.000000, -0.400000), (-1.000000, -0.400000)),
29 | ((1.000000, -0.300000), (-1.000000, -0.300000)),
30 | ((1.000000, -0.200000), (-1.000000, -0.200000)),
31 | ((1.000000, -0.100000), (-1.000000, -0.100000)),
32 | ((-0.200000, 1.000000), (-0.200000, -1.000000)),
33 | ((-0.300000, 1.000000), (-0.300000, -1.000000)),
34 | ((-0.700000, 1.000000), (-0.700000, -1.000000)),
35 | ((-0.800000, 1.000000), (-0.800000, -1.000000)),
36 | ((0.800000, 1.000000), (0.800000, -1.000000)),
37 | ((0.700000, 1.000000), (0.700000, -1.000000)),
38 | ((0.300000, 1.000000), (0.300000, -1.000000)),
39 | ((0.200000, 1.000000), (0.200000, -1.000000)),
40 | )
41 |
--------------------------------------------------------------------------------
/tests/data/test_degenerate_colinear_01.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-0.900000, 0.900000), (1.000000, -1.000000)),
3 | ((-1.000000, 1.000000), (0.900000, -0.900000)),
4 | ((-0.900000, 0.800000), (0.900000, -1.000000)),
5 | ((-1.000000, 0.900000), (0.800000, -0.900000)),
6 | ((-0.900000, 0.700000), (0.800000, -1.000000)),
7 | ((-1.000000, 0.800000), (0.700000, -0.900000)),
8 | ((-0.900000, 0.600000), (0.700000, -1.000000)),
9 | ((-1.000000, 0.700000), (0.600000, -0.900000)),
10 | ((0.900000, -0.800000), (-0.900000, 1.000000)),
11 | ((1.000000, -0.900000), (-0.800000, 0.900000)),
12 | ((0.900000, -0.700000), (-0.800000, 1.000000)),
13 | ((1.000000, -0.800000), (-0.700000, 0.900000)),
14 | ((0.900000, -0.600000), (-0.700000, 1.000000)),
15 | ((1.000000, -0.700000), (-0.600000, 0.900000)),
16 | ((0.300000, 0.300000), (1.000000, 1.000000)),
17 | ((0.200000, 0.200000), (0.900000, 0.900000)),
18 | ((0.400000, 0.300000), (1.000000, 0.900000)),
19 | ((0.300000, 0.200000), (0.900000, 0.800000)),
20 | ((0.500000, 0.300000), (1.000000, 0.800000)),
21 | ((0.400000, 0.200000), (0.900000, 0.700000)),
22 | ((0.600000, 0.300000), (1.000000, 0.700000)),
23 | ((0.500000, 0.200000), (0.900000, 0.600000)),
24 | ((0.800000, 0.900000), (0.200000, 0.300000)),
25 | ((0.900000, 1.000000), (0.300000, 0.400000)),
26 | ((0.700000, 0.900000), (0.200000, 0.400000)),
27 | ((0.800000, 1.000000), (0.300000, 0.500000)),
28 | ((0.600000, 0.900000), (0.200000, 0.500000)),
29 | ((0.700000, 1.000000), (0.300000, 0.600000)),
30 | ((-0.900000, -0.900000), (-0.200000, -0.200000)),
31 | ((-1.000000, -1.000000), (-0.300000, -0.300000)),
32 | ((-0.800000, -0.900000), (-0.200000, -0.300000)),
33 | ((-0.900000, -1.000000), (-0.300000, -0.400000)),
34 | ((-0.700000, -0.900000), (-0.200000, -0.400000)),
35 | ((-0.800000, -1.000000), (-0.300000, -0.500000)),
36 | ((-0.600000, -0.900000), (-0.200000, -0.500000)),
37 | ((-0.700000, -1.000000), (-0.300000, -0.600000)),
38 | ((-0.400000, -0.300000), (-1.000000, -0.900000)),
39 | ((-0.300000, -0.200000), (-0.900000, -0.800000)),
40 | ((-0.500000, -0.300000), (-1.000000, -0.800000)),
41 | ((-0.400000, -0.200000), (-0.900000, -0.700000)),
42 | ((-0.600000, -0.300000), (-1.000000, -0.700000)),
43 | ((-0.500000, -0.200000), (-0.900000, -0.600000)),
44 | )
45 |
--------------------------------------------------------------------------------
/tests/data_svg/test_degenerate_zero_length_01.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/data_svg/test_none_circle.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/data_svg/test_degenerate_zero_length_02.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/data/test_none_circle_2x.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-0.195090, 0.980785), (0.000000, 1.000000)),
3 | ((-0.382683, 0.923880), (-0.195090, 0.980785)),
4 | ((-0.555570, 0.831470), (-0.382683, 0.923880)),
5 | ((-0.707107, 0.707107), (-0.555570, 0.831470)),
6 | ((-0.831470, 0.555570), (-0.707107, 0.707107)),
7 | ((-0.923880, 0.382683), (-0.831470, 0.555570)),
8 | ((-0.980785, 0.195090), (-0.923880, 0.382683)),
9 | ((-1.000000, 0.000000), (-0.980785, 0.195090)),
10 | ((-0.980785, -0.195090), (-1.000000, 0.000000)),
11 | ((-0.923880, -0.382683), (-0.980785, -0.195090)),
12 | ((-0.831470, -0.555570), (-0.923880, -0.382683)),
13 | ((-0.707107, -0.707107), (-0.831470, -0.555570)),
14 | ((-0.555570, -0.831470), (-0.707107, -0.707107)),
15 | ((-0.382683, -0.923880), (-0.555570, -0.831470)),
16 | ((-0.195090, -0.980785), (-0.382683, -0.923880)),
17 | ((0.000000, -1.000000), (-0.195090, -0.980785)),
18 | ((0.195091, -0.980785), (0.000000, -1.000000)),
19 | ((0.382684, -0.923879), (0.195091, -0.980785)),
20 | ((0.555571, -0.831469), (0.382684, -0.923879)),
21 | ((0.707107, -0.707106), (0.555571, -0.831469)),
22 | ((0.831470, -0.555570), (0.707107, -0.707106)),
23 | ((0.923880, -0.382683), (0.831470, -0.555570)),
24 | ((0.980785, -0.195089), (0.923880, -0.382683)),
25 | ((1.000000, 0.000001), (0.980785, -0.195089)),
26 | ((0.980785, 0.195091), (1.000000, 0.000001)),
27 | ((0.923879, 0.382684), (0.980785, 0.195091)),
28 | ((0.831469, 0.555571), (0.923879, 0.382684)),
29 | ((0.707106, 0.707108), (0.831469, 0.555571)),
30 | ((0.555569, 0.831470), (0.707106, 0.707108)),
31 | ((0.382682, 0.923880), (0.555569, 0.831470)),
32 | ((0.195089, 0.980786), (0.382682, 0.923880)),
33 | ((0.000000, 1.000000), (0.195089, 0.980786)),
34 | ((-0.175581, 0.882707), (-0.000000, 0.900000)),
35 | ((-0.344415, 0.831492), (-0.175581, 0.882707)),
36 | ((-0.500013, 0.748323), (-0.344415, 0.831492)),
37 | ((-0.636396, 0.636396), (-0.500013, 0.748323)),
38 | ((-0.748323, 0.500013), (-0.636396, 0.636396)),
39 | ((-0.831492, 0.344415), (-0.748323, 0.500013)),
40 | ((-0.882707, 0.175581), (-0.831492, 0.344415)),
41 | ((-0.900000, 0.000000), (-0.882707, 0.175581)),
42 | ((-0.882707, -0.175581), (-0.900000, 0.000000)),
43 | ((-0.831492, -0.344415), (-0.882707, -0.175581)),
44 | ((-0.748323, -0.500013), (-0.831492, -0.344415)),
45 | ((-0.636396, -0.636396), (-0.748323, -0.500013)),
46 | ((-0.500013, -0.748323), (-0.636396, -0.636396)),
47 | ((-0.344415, -0.831492), (-0.500013, -0.748323)),
48 | ((-0.175581, -0.882707), (-0.344415, -0.831492)),
49 | ((0.000000, -0.900000), (-0.175581, -0.882707)),
50 | ((0.175582, -0.882707), (0.000000, -0.900000)),
51 | ((0.344415, -0.831491), (0.175582, -0.882707)),
52 | ((0.500014, -0.748322), (0.344415, -0.831491)),
53 | ((0.636397, -0.636396), (0.500014, -0.748322)),
54 | ((0.748323, -0.500013), (0.636397, -0.636396)),
55 | ((0.831492, -0.344414), (0.748323, -0.500013)),
56 | ((0.882707, -0.175580), (0.831492, -0.344414)),
57 | ((0.900000, 0.000001), (0.882707, -0.175580)),
58 | ((0.882707, 0.175582), (0.900000, 0.000001)),
59 | ((0.831491, 0.344416), (0.882707, 0.175582)),
60 | ((0.748322, 0.500014), (0.831491, 0.344416)),
61 | ((0.636395, 0.636397), (0.748322, 0.500014)),
62 | ((0.500012, 0.748323), (0.636395, 0.636397)),
63 | ((0.344414, 0.831492), (0.500012, 0.748323)),
64 | ((0.175580, 0.882707), (0.344414, 0.831492)),
65 | ((-0.000000, 0.900000), (0.175580, 0.882707)),
66 | )
67 |
--------------------------------------------------------------------------------
/tests/data/test_none_circle_zigzag.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-0.195090, 0.980785), (0.000000, 1.000000)),
3 | ((-0.382683, 0.923880), (-0.195090, 0.980785)),
4 | ((-0.555570, 0.831470), (-0.382683, 0.923880)),
5 | ((-0.707107, 0.707107), (-0.555570, 0.831470)),
6 | ((-0.831470, 0.555570), (-0.707107, 0.707107)),
7 | ((-0.923880, 0.382683), (-0.831470, 0.555570)),
8 | ((-0.980785, 0.195090), (-0.923880, 0.382683)),
9 | ((-0.651678, 0.500014), (0.831491, 0.344416)),
10 | ((0.831491, 0.344416), (-0.817293, 0.175582)),
11 | ((-0.882707, 0.175581), (0.768508, 0.344415)),
12 | ((0.768508, 0.344415), (-0.748323, 0.500013)),
13 | ((-0.748323, 0.500013), (0.563604, 0.636396)),
14 | ((0.563604, 0.636396), (-0.500013, 0.748323)),
15 | ((-0.500013, 0.748323), (0.255585, 0.831492)),
16 | ((0.923879, 0.382684), (0.980785, 0.195091)),
17 | ((0.831469, 0.555571), (0.923879, 0.382684)),
18 | ((0.707106, 0.707108), (0.831469, 0.555571)),
19 | ((0.555569, 0.831470), (0.707106, 0.707108)),
20 | ((0.382682, 0.923880), (0.555569, 0.831470)),
21 | ((0.195089, 0.980786), (0.382682, 0.923880)),
22 | ((0.000000, 1.000000), (0.195089, 0.980786)),
23 | ((0.255585, 0.831492), (-0.175581, 0.882707)),
24 | ((-0.175581, 0.882707), (-0.000000, 0.900000)),
25 | ((-0.399988, 0.748323), (0.636395, 0.636397)),
26 | ((0.344414, 0.831492), (-0.399988, 0.748323)),
27 | ((-0.124420, 0.882707), (0.344414, 0.831492)),
28 | ((-0.195090, -0.980785), (0.000000, -1.000000)),
29 | ((-0.382683, -0.923880), (-0.195090, -0.980785)),
30 | ((-0.555570, -0.831470), (-0.382683, -0.923880)),
31 | ((-0.707107, -0.707107), (-0.555570, -0.831470)),
32 | ((-0.831470, -0.555570), (-0.707107, -0.707107)),
33 | ((-0.923880, -0.382683), (-0.831470, -0.555570)),
34 | ((-0.980785, -0.195090), (-0.923880, -0.382683)),
35 | ((-1.000000, -0.000000), (-0.980785, -0.195090)),
36 | ((-0.651678, -0.500014), (0.831491, -0.344416)),
37 | ((0.831491, -0.344416), (-0.817293, -0.175582)),
38 | ((-0.817293, -0.175582), (0.900000, -0.000001)),
39 | ((0.800000, -0.000000), (-0.882707, -0.175581)),
40 | ((-0.882707, -0.175581), (0.768508, -0.344415)),
41 | ((0.768508, -0.344415), (-0.748323, -0.500013)),
42 | ((-0.748323, -0.500013), (0.563604, -0.636396)),
43 | ((0.563604, -0.636396), (-0.500013, -0.748323)),
44 | ((-0.500013, -0.748323), (0.255585, -0.831492)),
45 | ((0.980785, -0.195091), (1.000000, -0.000001)),
46 | ((0.923879, -0.382684), (0.980785, -0.195091)),
47 | ((0.831469, -0.555571), (0.923879, -0.382684)),
48 | ((0.707106, -0.707108), (0.831469, -0.555571)),
49 | ((0.555569, -0.831470), (0.707106, -0.707108)),
50 | ((0.382682, -0.923880), (0.555569, -0.831470)),
51 | ((0.195089, -0.980786), (0.382682, -0.923880)),
52 | ((0.000000, -1.000000), (0.195089, -0.980786)),
53 | ((0.255585, -0.831492), (-0.175581, -0.882707)),
54 | ((-0.175581, -0.882707), (-0.000000, -0.900000)),
55 | ((-0.399988, -0.748323), (0.636395, -0.636397)),
56 | ((0.344414, -0.831492), (-0.399988, -0.748323)),
57 | ((-0.124420, -0.882707), (0.344414, -0.831492)),
58 | ((-1.000000, -0.000000), (-0.980785, 0.195090)),
59 | ((-0.000000, 0.900000), (-0.124420, 0.882707)),
60 | ((0.636395, 0.636397), (-0.651678, 0.500014)),
61 | ((-0.817293, 0.175582), (0.900000, -0.000001)),
62 | ((0.800000, -0.000000), (-0.882707, 0.175581)),
63 | ((0.980785, 0.195091), (1.000000, -0.000001)),
64 | ((-0.000000, -0.900000), (-0.124420, -0.882707)),
65 | ((0.636395, -0.636397), (-0.651678, -0.500014)),
66 | )
67 |
--------------------------------------------------------------------------------
/tests/data/test_degenerate_colinear_02.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((0.200000, 0.700000), (0.900000, 0.700000)),
3 | ((0.000000, -1.000000), (0.000000, 0.900000)),
4 | ((0.100000, 0.700000), (0.800000, 0.700000)),
5 | ((0.000000, -0.900000), (0.000000, 1.000000)),
6 | ((0.200000, 0.600000), (0.900000, 0.600000)),
7 | ((0.100000, 0.600000), (0.800000, 0.600000)),
8 | ((0.200000, 0.500000), (0.900000, 0.500000)),
9 | ((0.100000, 0.500000), (0.800000, 0.500000)),
10 | ((0.200000, 0.400000), (0.900000, 0.400000)),
11 | ((0.100000, 0.400000), (0.800000, 0.400000)),
12 | ((0.200000, 0.300000), (0.900000, 0.300000)),
13 | ((0.100000, 0.300000), (0.800000, 0.300000)),
14 | ((0.200000, 0.200000), (0.900000, 0.200000)),
15 | ((0.100000, 0.200000), (0.800000, 0.200000)),
16 | ((0.200000, 0.100000), (0.900000, 0.100000)),
17 | ((0.100000, 0.100000), (0.800000, 0.100000)),
18 | ((0.200000, 0.800000), (0.900000, 0.800000)),
19 | ((0.100000, 0.800000), (0.800000, 0.800000)),
20 | ((0.200000, 0.900000), (0.900000, 0.900000)),
21 | ((0.100000, 0.900000), (0.800000, 0.900000)),
22 | ((-0.900000, -0.300000), (-0.100000, -0.300000)),
23 | ((-1.000000, -0.300000), (-0.200000, -0.300000)),
24 | ((-0.900000, -0.400000), (-0.100000, -0.400000)),
25 | ((-1.000000, -0.400000), (-0.200000, -0.400000)),
26 | ((-0.900000, -0.500000), (-0.100000, -0.500000)),
27 | ((-1.000000, -0.500000), (-0.200000, -0.500000)),
28 | ((-0.900000, -0.600000), (-0.100000, -0.600000)),
29 | ((-1.000000, -0.600000), (-0.200000, -0.600000)),
30 | ((-0.900000, -0.700000), (-0.100000, -0.700000)),
31 | ((-1.000000, -0.700000), (-0.200000, -0.700000)),
32 | ((-0.900000, -0.800000), (-0.100000, -0.800000)),
33 | ((-1.000000, -0.800000), (-0.200000, -0.800000)),
34 | ((-0.900000, -0.900000), (-0.100000, -0.900000)),
35 | ((-1.000000, -0.900000), (-0.200000, -0.900000)),
36 | ((-0.900000, -0.200000), (-0.100000, -0.200000)),
37 | ((-1.000000, -0.200000), (-0.200000, -0.200000)),
38 | ((-0.900000, -0.100000), (-0.100000, -0.100000)),
39 | ((-1.000000, -0.100000), (-0.200000, -0.100000)),
40 | ((-0.700000, 0.200000), (-0.700000, 0.900000)),
41 | ((-0.700000, 0.100000), (-0.700000, 0.800000)),
42 | ((-0.600000, 0.200000), (-0.600000, 0.900000)),
43 | ((-0.600000, 0.100000), (-0.600000, 0.800000)),
44 | ((-0.500000, 0.200000), (-0.500000, 0.900000)),
45 | ((-0.500000, 0.100000), (-0.500000, 0.800000)),
46 | ((-0.400000, 0.200000), (-0.400000, 0.900000)),
47 | ((-0.400000, 0.100000), (-0.400000, 0.800000)),
48 | ((-0.300000, 0.200000), (-0.300000, 0.900000)),
49 | ((-0.300000, 0.100000), (-0.300000, 0.800000)),
50 | ((-0.200000, 0.200000), (-0.200000, 0.900000)),
51 | ((-0.200000, 0.100000), (-0.200000, 0.800000)),
52 | ((-0.100000, 0.200000), (-0.100000, 0.900000)),
53 | ((-0.100000, 0.100000), (-0.100000, 0.800000)),
54 | ((-0.800000, 0.200000), (-0.800000, 0.900000)),
55 | ((-0.800000, 0.100000), (-0.800000, 0.800000)),
56 | ((-0.900000, 0.200000), (-0.900000, 0.900000)),
57 | ((-0.900000, 0.100000), (-0.900000, 0.800000)),
58 | ((0.300000, -0.800000), (0.300000, -0.100000)),
59 | ((0.300000, -0.900000), (0.300000, -0.200000)),
60 | ((0.400000, -0.800000), (0.400000, -0.100000)),
61 | ((0.400000, -0.900000), (0.400000, -0.200000)),
62 | ((0.500000, -0.800000), (0.500000, -0.100000)),
63 | ((0.500000, -0.900000), (0.500000, -0.200000)),
64 | ((0.600000, -0.800000), (0.600000, -0.100000)),
65 | ((0.600000, -0.900000), (0.600000, -0.200000)),
66 | ((0.700000, -0.800000), (0.700000, -0.100000)),
67 | ((0.700000, -0.900000), (0.700000, -0.200000)),
68 | ((0.800000, -0.800000), (0.800000, -0.100000)),
69 | ((0.800000, -0.900000), (0.800000, -0.200000)),
70 | ((0.900000, -0.800000), (0.900000, -0.100000)),
71 | ((0.900000, -0.900000), (0.900000, -0.200000)),
72 | ((0.200000, -0.800000), (0.200000, -0.100000)),
73 | ((0.200000, -0.900000), (0.200000, -0.200000)),
74 | ((0.100000, -0.800000), (0.100000, -0.100000)),
75 | ((0.100000, -0.900000), (0.100000, -0.200000)),
76 | )
77 |
--------------------------------------------------------------------------------
/tests/data/test_isect_crosshatch_01.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-1.000000, 0.900000), (0.900000, -1.000000)),
3 | ((-1.000000, 0.600000), (0.600000, -1.000000)),
4 | ((-1.000000, 0.500000), (0.500000, -1.000000)),
5 | ((-1.000000, 0.400000), (0.400000, -1.000000)),
6 | ((-1.000000, -0.900000), (-0.900000, -1.000000)),
7 | ((-1.000000, -0.600000), (-0.600000, -1.000000)),
8 | ((-1.000000, -0.500000), (-0.500000, -1.000000)),
9 | ((-1.000000, -0.400000), (-0.400000, -1.000000)),
10 | ((-0.100000, -1.000000), (-1.000000, -0.100000)),
11 | ((-1.000000, 0.000000), (0.000000, -1.000000)),
12 | ((-1.000000, 0.100000), (0.100000, -1.000000)),
13 | ((-1.000000, 1.000000), (1.000000, -1.000000)),
14 | ((1.000000, -0.900000), (-0.900000, 1.000000)),
15 | ((1.000000, -0.600000), (-0.600000, 1.000000)),
16 | ((1.000000, -0.500000), (-0.500000, 1.000000)),
17 | ((1.000000, -0.400000), (-0.400000, 1.000000)),
18 | ((1.000000, 0.900000), (0.900000, 1.000000)),
19 | ((1.000000, 0.600000), (0.600000, 1.000000)),
20 | ((1.000000, 0.500000), (0.500000, 1.000000)),
21 | ((1.000000, 0.400000), (0.400000, 1.000000)),
22 | ((0.100000, 1.000000), (1.000000, 0.100000)),
23 | ((1.000000, 0.000000), (0.000000, 1.000000)),
24 | ((1.000000, -0.100000), (-0.100000, 1.000000)),
25 | ((-1.000000, 0.800000), (0.800000, -1.000000)),
26 | ((-1.000000, 0.700000), (0.700000, -1.000000)),
27 | ((-1.000000, 0.300000), (0.300000, -1.000000)),
28 | ((-1.000000, 0.200000), (0.200000, -1.000000)),
29 | ((-1.000000, -0.800000), (-0.800000, -1.000000)),
30 | ((-1.000000, -0.700000), (-0.700000, -1.000000)),
31 | ((-1.000000, -0.300000), (-0.300000, -1.000000)),
32 | ((-1.000000, -0.200000), (-0.200000, -1.000000)),
33 | ((1.000000, -0.800000), (-0.800000, 1.000000)),
34 | ((1.000000, -0.700000), (-0.700000, 1.000000)),
35 | ((1.000000, -0.300000), (-0.300000, 1.000000)),
36 | ((1.000000, -0.200000), (-0.200000, 1.000000)),
37 | ((1.000000, 0.700000), (0.700000, 1.000000)),
38 | ((1.000000, 0.200000), (0.200000, 1.000000)),
39 | ((1.000000, 0.800000), (0.800000, 1.000000)),
40 | ((1.000000, 0.300000), (0.300000, 1.000000)),
41 | ((1.000000, 0.900000), (-0.900000, -1.000000)),
42 | ((1.000000, 0.800000), (-0.800000, -1.000000)),
43 | ((1.000000, 0.700000), (-0.700000, -1.000000)),
44 | ((1.000000, 0.600000), (-0.600000, -1.000000)),
45 | ((1.000000, 0.500000), (-0.500000, -1.000000)),
46 | ((1.000000, 0.400000), (-0.400000, -1.000000)),
47 | ((1.000000, 0.300000), (-0.300000, -1.000000)),
48 | ((1.000000, 0.200000), (-0.200000, -1.000000)),
49 | ((1.000000, -0.900000), (0.900000, -1.000000)),
50 | ((1.000000, -0.800000), (0.800000, -1.000000)),
51 | ((1.000000, -0.700000), (0.700000, -1.000000)),
52 | ((1.000000, -0.600000), (0.600000, -1.000000)),
53 | ((1.000000, -0.500000), (0.500000, -1.000000)),
54 | ((1.000000, -0.400000), (0.400000, -1.000000)),
55 | ((1.000000, -0.300000), (0.300000, -1.000000)),
56 | ((1.000000, -0.200000), (0.200000, -1.000000)),
57 | ((0.100000, -1.000000), (1.000000, -0.100000)),
58 | ((1.000000, 0.000000), (0.000000, -1.000000)),
59 | ((1.000000, 0.100000), (-0.100000, -1.000000)),
60 | ((-1.000000, -0.800000), (0.800000, 1.000000)),
61 | ((-1.000000, -0.700000), (0.700000, 1.000000)),
62 | ((-1.000000, -0.300000), (0.300000, 1.000000)),
63 | ((-1.000000, -0.200000), (0.200000, 1.000000)),
64 | ((-1.000000, 0.700000), (-0.700000, 1.000000)),
65 | ((-1.000000, 0.200000), (-0.200000, 1.000000)),
66 | ((1.000000, 1.000000), (-1.000000, -1.000000)),
67 | ((-1.000000, -0.900000), (0.900000, 1.000000)),
68 | ((-1.000000, -0.600000), (0.600000, 1.000000)),
69 | ((-1.000000, -0.500000), (0.500000, 1.000000)),
70 | ((-1.000000, -0.400000), (0.400000, 1.000000)),
71 | ((-1.000000, 0.900000), (-0.900000, 1.000000)),
72 | ((-1.000000, 0.800000), (-0.800000, 1.000000)),
73 | ((-1.000000, 0.600000), (-0.600000, 1.000000)),
74 | ((-1.000000, 0.500000), (-0.500000, 1.000000)),
75 | ((-1.000000, 0.400000), (-0.400000, 1.000000)),
76 | ((-1.000000, 0.300000), (-0.300000, 1.000000)),
77 | ((-0.100000, 1.000000), (-1.000000, 0.100000)),
78 | ((-1.000000, 0.000000), (0.000000, 1.000000)),
79 | ((-1.000000, -0.100000), (0.100000, 1.000000)),
80 | )
81 |
--------------------------------------------------------------------------------
/tests/data_svg/test_none_circle_2x.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/data_svg/test_none_circle_zigzag.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/readme.rst:
--------------------------------------------------------------------------------
1 |
2 | ************************
3 | Poly Point Intersections
4 | ************************
5 |
6 | This is a single-file, Python3 implementation of the Bentley-Ottmann sweep-line algorithm
7 | for listing all intersections in a set of line segments.
8 |
9 | This aims to be portable & self-contained, (move to other lower languages such as C & C++).
10 |
11 | .. figure:: https://cloud.githubusercontent.com/assets/1869379/10564349/753dd564-75fc-11e5-8e99-08530e6f6ef0.png
12 |
13 | Test-case with showing all 73,002 intersections from 14,880 segments.
14 |
15 |
16 | Motivation
17 | ==========
18 |
19 | At the time of writing, all the open-source implementation of Bentley-Ottmann's sweep-line
20 | I couldn't find a good reference implementation which performed well
21 | and could be reused or ported to different environments.
22 |
23 | So this is my attempt to write a reference implementation with comprehensive tests.
24 |
25 |
26 | Existing Implementations
27 | ------------------------
28 |
29 | - `CompGeom `__ (Java).
30 | - CGAL `SweepLine `__ (C++).
31 |
32 | Not Bentley-Ottmann strictly speaking, but the method is very similar.
33 | - The `geomalgorithms.com `__,
34 | while a great introduction, and frequently linked to as a reference,
35 | it only detects weather the polygon is self-intersecting or not.
36 |
37 |
38 | Goals
39 | -----
40 |
41 | - Keep the library small, robust & reusable.
42 | - Use mainly language-agnostic features.
43 |
44 | *(Even though classes are used, theres no problem moving this to a language without OO).*
45 |
46 |
47 | Usage
48 | =====
49 |
50 | ``poly_point_isect`` is a single Python module, exposing 2 functions.
51 |
52 | ``isect_polygon(points, validate=True)``
53 | Where ``points`` are a sequence of number pairs.
54 | ``isect_segments(segments, validate=True)``
55 | Where ``segments`` is list of point-pairs.
56 |
57 | Both return a list of intersections.
58 |
59 | The ``validate`` argument ensures duplicate or zero length segments are ignored.
60 |
61 | Example:
62 |
63 | .. code-block:: python
64 |
65 | # Show the result of a simple bow-tie quad
66 | import poly_point_isect
67 | poly = (
68 | (1.0, 0.0),
69 | (0.0, 1.0),
70 | (0.0, 0.0),
71 | (1.0, 1.0),
72 | )
73 | isect = poly_point_isect.isect_polygon(poly)
74 | print(isect)
75 | # [(0.5, 0.5)]
76 |
77 |
78 | There are also: ``isect_polygon_include_segments(points)`` and ``isect_segments_include_segments(segments)``,
79 | versions of the functions described above which return a tuple for each intersection: ``(point, list_of_segments)``
80 | so you can find which segments belong to an intersection.
81 |
82 |
83 | Details
84 | =======
85 |
86 | - Permissive MIT license.
87 |
88 | Note that both bintrees and CompGeom are MIT Licensed too.
89 | - Written in Python3 and runs in PyPy as well.
90 | - Runs in vanilla Python without any dependencies.
91 | - Uses `bintrees `__ Python module,
92 | with modifications to support a custom comparator function.
93 | Also removed some unused code.
94 |
95 | .. note::
96 |
97 | Using another binary-tree library shouldn't be a problem as long as you can override its comparison.
98 | Ideally allow passing a custom argument too (as is done here),
99 | to avoid using globals to access the sweep-line.
100 |
101 | - Includes tests for:
102 |
103 | - Intersecting segments.
104 | - Non intersecting segments.
105 | - Degenerate segments (overlapping & zero length)
106 |
107 | Test output can be optionally written to SVG files,
108 | see: ``tests/data_svg/`` directory.
109 |
110 |
111 | Known Limitations
112 | =================
113 |
114 | For the purpose of this section, errors in detecting intersections are defined by any discrepancy
115 | with the result compared to testing every segment against every other segment.
116 |
117 |
118 | Sweep Line Step-Size
119 | --------------------
120 |
121 | Very small step sizes over *near-vertical* lines can cause errors
122 | *(note that _exactly_ vertical lines are supported but have to be handled separately)*.
123 |
124 | So far I didn't find a good general solution to this, though there are some ways to work-around the problem.
125 |
126 | One way to resolve the problem is to use higher precision calculation for the sweep-line then the input data.
127 |
128 | In my own tests I found for double precision floating point,
129 | ensuring at least ``4e-06`` between steps gives stable results \*
130 | (rounding the input segments X axis to 5 decimal places).
131 |
132 | \* Checked with the included test-set at ``3.6e-06`` degree rotation increments from the initial rotation.
133 |
134 |
135 | Further Work
136 | ============
137 |
138 | - More tests.
139 | - More test variations *(different scales, rotations)*.
140 |
--------------------------------------------------------------------------------
/tests/data/test_isect_crosshatch_03.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-0.696000, -0.492000), (0.494000, 0.698000)),
3 | ((0.160000, 0.800000), (0.160000, -0.800000)),
4 | ((0.240000, 0.800000), (0.240000, -0.800000)),
5 | ((0.560000, 0.800000), (0.560000, -0.800000)),
6 | ((-0.696000, -0.562000), (0.564000, 0.698000)),
7 | ((0.704000, 0.068000), (-0.066000, -0.702000)),
8 | ((0.704000, -0.002000), (0.004000, -0.702000)),
9 | ((0.074000, -0.702000), (0.704000, -0.072000)),
10 | ((0.704000, -0.142000), (0.144000, -0.702000)),
11 | ((0.704000, -0.212000), (0.214000, -0.702000)),
12 | ((0.704000, -0.282000), (0.284000, -0.702000)),
13 | ((0.704000, -0.352000), (0.354000, -0.702000)),
14 | ((0.704000, -0.422000), (0.424000, -0.702000)),
15 | ((0.704000, -0.492000), (0.494000, -0.702000)),
16 | ((0.704000, -0.562000), (0.564000, -0.702000)),
17 | ((-0.604000, 0.541000), (0.536000, -0.599000)),
18 | ((-0.604000, 0.361000), (0.356000, -0.599000)),
19 | ((-0.604000, 0.301000), (0.296000, -0.599000)),
20 | ((-0.604000, 0.241000), (0.236000, -0.599000)),
21 | ((-0.604000, -0.539000), (-0.544000, -0.599000)),
22 | ((-0.604000, -0.359000), (-0.364000, -0.599000)),
23 | ((-0.604000, -0.299000), (-0.304000, -0.599000)),
24 | ((-0.604000, -0.239000), (-0.244000, -0.599000)),
25 | ((-0.064000, -0.599000), (-0.604000, -0.059000)),
26 | ((-0.604000, 0.001000), (-0.004000, -0.599000)),
27 | ((-0.604000, 0.061000), (0.056000, -0.599000)),
28 | ((0.640000, 0.800000), (0.640000, -0.800000)),
29 | ((-0.640000, 0.800000), (-0.640000, -0.800000)),
30 | ((-0.560000, 0.800000), (-0.560000, -0.800000)),
31 | ((-0.240000, 0.800000), (-0.240000, -0.800000)),
32 | ((-0.160000, 0.800000), (-0.160000, -0.800000)),
33 | ((0.800000, 0.800000), (0.800000, -0.800000)),
34 | ((-0.800000, 0.800000), (-0.800000, -0.800000)),
35 | ((0.080000, 0.800000), (0.080000, -0.800000)),
36 | ((0.320000, 0.800000), (0.320000, -0.800000)),
37 | ((0.400000, 0.800000), (0.400000, -0.800000)),
38 | ((0.480000, 0.800000), (0.480000, -0.800000)),
39 | ((0.720000, 0.800000), (0.720000, -0.800000)),
40 | ((-0.720000, 0.800000), (-0.720000, -0.800000)),
41 | ((-0.480000, 0.800000), (-0.480000, -0.800000)),
42 | ((-0.400000, 0.800000), (-0.400000, -0.800000)),
43 | ((-0.320000, 0.800000), (-0.320000, -0.800000)),
44 | ((-0.080000, 0.800000), (-0.080000, -0.800000)),
45 | ((0.000000, 0.800000), (0.000000, -0.800000)),
46 | ((0.704000, -0.632000), (0.634000, -0.702000)),
47 | ((-0.604000, 0.601000), (0.596000, -0.599000)),
48 | ((0.596000, -0.539000), (-0.544000, 0.601000)),
49 | ((0.596000, -0.359000), (-0.364000, 0.601000)),
50 | ((0.596000, -0.299000), (-0.304000, 0.601000)),
51 | ((0.596000, -0.239000), (-0.244000, 0.601000)),
52 | ((0.596000, 0.541000), (0.536000, 0.601000)),
53 | ((0.596000, 0.361000), (0.356000, 0.601000)),
54 | ((0.596000, 0.301000), (0.296000, 0.601000)),
55 | ((0.596000, 0.241000), (0.236000, 0.601000)),
56 | ((0.056000, 0.601000), (0.596000, 0.061000)),
57 | ((0.596000, 0.001000), (-0.004000, 0.601000)),
58 | ((0.596000, -0.059000), (-0.064000, 0.601000)),
59 | ((-0.604000, 0.481000), (0.476000, -0.599000)),
60 | ((-0.604000, 0.421000), (0.416000, -0.599000)),
61 | ((-0.604000, 0.181000), (0.176000, -0.599000)),
62 | ((-0.604000, 0.121000), (0.116000, -0.599000)),
63 | ((-0.604000, -0.479000), (-0.484000, -0.599000)),
64 | ((-0.604000, -0.419000), (-0.424000, -0.599000)),
65 | ((-0.604000, -0.179000), (-0.184000, -0.599000)),
66 | ((-0.604000, -0.119000), (-0.124000, -0.599000)),
67 | ((0.596000, -0.479000), (-0.484000, 0.601000)),
68 | ((0.596000, -0.419000), (-0.424000, 0.601000)),
69 | ((0.596000, -0.179000), (-0.184000, 0.601000)),
70 | ((0.596000, -0.119000), (-0.124000, 0.601000)),
71 | ((0.596000, 0.421000), (0.416000, 0.601000)),
72 | ((0.596000, 0.121000), (0.116000, 0.601000)),
73 | ((0.704000, 0.138000), (-0.136000, -0.702000)),
74 | ((0.704000, 0.208000), (-0.206000, -0.702000)),
75 | ((0.704000, 0.278000), (-0.276000, -0.702000)),
76 | ((0.704000, 0.348000), (-0.346000, -0.702000)),
77 | ((0.704000, 0.418000), (-0.416000, -0.702000)),
78 | ((0.704000, 0.488000), (-0.486000, -0.702000)),
79 | ((0.704000, 0.558000), (-0.556000, -0.702000)),
80 | ((0.704000, 0.628000), (-0.626000, -0.702000)),
81 | ((0.596000, 0.481000), (0.476000, 0.601000)),
82 | ((0.596000, 0.181000), (0.176000, 0.601000)),
83 | ((0.900000, 0.270000), (-0.900000, 0.270000)),
84 | ((0.900000, 0.720000), (-0.900000, 0.720000)),
85 | ((0.900000, 0.900000), (-0.900000, 0.900000)),
86 | ((0.900000, 0.000000), (-0.900000, 0.000000)),
87 | ((0.900000, 0.090000), (-0.900000, 0.090000)),
88 | ((0.900000, 0.180000), (-0.900000, 0.180000)),
89 | ((0.900000, 0.360000), (-0.900000, 0.360000)),
90 | ((0.900000, 0.450000), (-0.900000, 0.450000)),
91 | ((0.900000, 0.540000), (-0.900000, 0.540000)),
92 | ((0.900000, 0.630000), (-0.900000, 0.630000)),
93 | ((0.900000, 0.810000), (-0.900000, 0.810000)),
94 | ((0.900000, -0.900000), (-0.900000, -0.900000)),
95 | ((0.900000, -0.810000), (-0.900000, -0.810000)),
96 | ((0.900000, -0.720000), (-0.900000, -0.720000)),
97 | ((0.900000, -0.630000), (-0.900000, -0.630000)),
98 | ((0.900000, -0.540000), (-0.900000, -0.540000)),
99 | ((0.900000, -0.450000), (-0.900000, -0.450000)),
100 | ((0.900000, -0.360000), (-0.900000, -0.360000)),
101 | ((0.900000, -0.270000), (-0.900000, -0.270000)),
102 | ((0.900000, -0.180000), (-0.900000, -0.180000)),
103 | ((0.900000, -0.090000), (-0.900000, -0.090000)),
104 | ((-0.696000, -0.212000), (0.214000, 0.698000)),
105 | ((-0.696000, -0.142000), (0.144000, 0.698000)),
106 | ((-0.696000, 0.488000), (-0.486000, 0.698000)),
107 | ((-0.696000, 0.138000), (-0.136000, 0.698000)),
108 | ((0.704000, 0.698000), (-0.696000, -0.702000)),
109 | ((-0.696000, -0.632000), (0.634000, 0.698000)),
110 | ((-0.696000, -0.422000), (0.424000, 0.698000)),
111 | ((-0.696000, -0.352000), (0.354000, 0.698000)),
112 | ((-0.696000, -0.282000), (0.284000, 0.698000)),
113 | ((-0.696000, 0.628000), (-0.626000, 0.698000)),
114 | ((-0.696000, 0.558000), (-0.556000, 0.698000)),
115 | ((-0.696000, 0.418000), (-0.416000, 0.698000)),
116 | ((-0.696000, 0.348000), (-0.346000, 0.698000)),
117 | ((-0.696000, 0.278000), (-0.276000, 0.698000)),
118 | ((-0.696000, 0.208000), (-0.206000, 0.698000)),
119 | ((-0.066000, 0.698000), (-0.696000, 0.068000)),
120 | ((-0.696000, -0.002000), (0.004000, 0.698000)),
121 | ((-0.696000, -0.072000), (0.074000, 0.698000)),
122 | )
123 |
--------------------------------------------------------------------------------
/tests/data/test_isect_crosshatch_04.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((-0.023219, 0.781679), (-0.666210, 0.410447)),
3 | ((-0.385441, 0.878736), (-0.569153, 0.772670)),
4 | ((0.049225, 0.762267), (-0.685622, 0.338003)),
5 | ((-0.312997, 0.859324), (-0.588564, 0.700225)),
6 | ((0.339003, 0.684621), (-0.763267, 0.048225)),
7 | ((0.411448, 0.665210), (-0.782679, -0.024219)),
8 | ((0.701225, 0.587564), (-0.860324, -0.313997)),
9 | ((0.773670, 0.568153), (-0.879736, -0.386441)),
10 | ((-0.049225, -0.764267), (0.685621, -0.340003)),
11 | ((0.023219, -0.783679), (0.666210, -0.412448)),
12 | ((0.312997, -0.861324), (0.588564, -0.702226)),
13 | ((0.385441, -0.880736), (0.569153, -0.774670)),
14 | ((-0.339003, -0.686621), (0.763267, -0.050226)),
15 | ((-0.411448, -0.667210), (0.782679, 0.022219)),
16 | ((-0.701225, -0.589564), (0.860324, 0.311997)),
17 | ((-0.773670, -0.570153), (0.879736, 0.384441)),
18 | ((0.266559, 0.704033), (-0.743856, 0.120670)),
19 | ((0.194114, 0.723444), (-0.724444, 0.193114)),
20 | ((-0.705033, 0.265559), (0.121670, 0.742856)),
21 | ((-0.095663, 0.801090), (-0.646799, 0.482892)),
22 | ((-0.168108, 0.820502), (-0.627387, 0.555337)),
23 | ((-0.240552, 0.839913), (-0.607976, 0.627781)),
24 | ((-0.457886, 0.898147), (-0.549741, 0.845114)),
25 | ((0.483892, 0.645799), (-0.802090, -0.096663)),
26 | ((0.556337, 0.626387), (-0.821502, -0.169108)),
27 | ((0.628781, 0.606976), (-0.840913, -0.241552)),
28 | ((0.846114, 0.548741), (-0.899147, -0.458886)),
29 | ((-0.918559, -0.531330), (0.918559, 0.529330)),
30 | ((-0.266559, -0.706033), (0.743856, -0.122670)),
31 | ((-0.194114, -0.725444), (0.724444, -0.195114)),
32 | ((0.705033, -0.267559), (-0.121670, -0.744856)),
33 | ((0.095663, -0.803090), (0.646799, -0.484892)),
34 | ((0.168108, -0.822502), (0.627387, -0.557337)),
35 | ((0.240552, -0.841913), (0.607976, -0.629781)),
36 | ((0.457886, -0.900147), (0.549741, -0.847114)),
37 | ((-0.483892, -0.647799), (0.802090, 0.094663)),
38 | ((-0.556337, -0.628387), (0.821502, 0.167108)),
39 | ((-0.628781, -0.608976), (0.840913, 0.239552)),
40 | ((-0.846114, -0.550741), (0.899147, 0.456886)),
41 | ((-0.225000, 0.750000), (-0.225000, -0.750000)),
42 | ((-0.600000, 0.750000), (-0.600000, -0.750000)),
43 | ((-0.750000, 0.750000), (-0.750000, -0.750000)),
44 | ((0.000000, 0.750000), (-0.000000, -0.750000)),
45 | ((-0.075000, 0.750000), (-0.075000, -0.750000)),
46 | ((-0.150000, 0.750000), (-0.150000, -0.750000)),
47 | ((-0.300000, 0.750000), (-0.300000, -0.750000)),
48 | ((-0.375000, 0.750000), (-0.375000, -0.750000)),
49 | ((-0.450000, 0.750000), (-0.450000, -0.750000)),
50 | ((-0.525000, 0.750000), (-0.525000, -0.750000)),
51 | ((-0.675000, 0.750000), (-0.675000, -0.750000)),
52 | ((0.750000, 0.750000), (0.750000, -0.750000)),
53 | ((0.675000, 0.750000), (0.675000, -0.750000)),
54 | ((0.600000, 0.750000), (0.600000, -0.750000)),
55 | ((0.525000, 0.750000), (0.525000, -0.750000)),
56 | ((0.450000, 0.750000), (0.450000, -0.750000)),
57 | ((0.375000, 0.750000), (0.375000, -0.750000)),
58 | ((0.300000, 0.750000), (0.300000, -0.750000)),
59 | ((0.225000, 0.750000), (0.225000, -0.750000)),
60 | ((0.150000, 0.750000), (0.150000, -0.750000)),
61 | ((0.075000, 0.750000), (0.075000, -0.750000)),
62 | ((-0.747146, 0.066367), (0.747146, -0.064367)),
63 | ((-0.753683, -0.008348), (0.740609, -0.139081)),
64 | ((-0.773293, -0.232492), (0.720999, -0.363225)),
65 | ((-0.779829, -0.307206), (0.714463, -0.437940)),
66 | ((-0.786366, -0.381921), (0.707926, -0.512654)),
67 | ((-0.805976, -0.606065), (0.688316, -0.736798)),
68 | ((-0.688316, 0.738798), (0.805976, 0.608065)),
69 | ((-0.707926, 0.514654), (0.786366, 0.383921)),
70 | ((-0.714463, 0.439940), (0.779829, 0.309206)),
71 | ((-0.720999, 0.365225), (0.773293, 0.234492)),
72 | ((-0.740609, 0.141081), (0.753683, 0.010348)),
73 | ((-0.812513, -0.680779), (0.681779, -0.811513)),
74 | ((-0.681779, 0.813513), (0.812513, 0.682779)),
75 | ((-0.760219, -0.083063), (0.734073, -0.213796)),
76 | ((-0.766756, -0.157777), (0.727536, -0.288511)),
77 | ((-0.792903, -0.456636), (0.701389, -0.587369)),
78 | ((-0.799440, -0.531350), (0.694852, -0.662084)),
79 | ((-0.694852, 0.664083), (0.799439, 0.533350)),
80 | ((-0.701389, 0.589369), (0.792903, 0.458635)),
81 | ((-0.727536, 0.290510), (0.766756, 0.159777)),
82 | ((-0.734073, 0.215796), (0.760219, 0.085062)),
83 | ((-0.534509, 0.855818), (0.621393, -0.794981)),
84 | ((-0.460648, 0.842795), (0.634417, -0.721121)),
85 | ((-0.386788, 0.829771), (0.647440, -0.647260)),
86 | ((-0.312927, 0.816747), (0.660464, -0.573400)),
87 | ((-0.239067, 0.803724), (0.673488, -0.499539)),
88 | ((-0.165206, 0.790700), (0.686511, -0.425679)),
89 | ((-0.091346, 0.777677), (0.699535, -0.351818)),
90 | ((-0.017485, 0.764653), (0.712559, -0.277958)),
91 | ((0.794981, 0.621393), (0.855818, 0.534509)),
92 | ((0.721121, 0.634417), (0.842795, 0.460648)),
93 | ((0.647260, 0.647440), (0.829771, 0.386788)),
94 | ((0.573400, 0.660464), (0.816747, 0.312927)),
95 | ((0.499539, 0.673488), (0.803724, 0.239067)),
96 | ((0.425679, 0.686511), (0.790700, 0.165206)),
97 | ((0.351818, 0.699535), (0.777677, 0.091345)),
98 | ((0.277957, 0.712559), (0.764653, 0.017485)),
99 | ((0.751629, -0.056376), (0.204097, 0.725582)),
100 | ((0.130236, 0.738606), (0.738606, -0.130236)),
101 | ((0.056376, 0.751629), (0.725582, -0.204097)),
102 | ((0.460648, -0.842795), (-0.634417, 0.721121)),
103 | ((0.386788, -0.829771), (-0.647441, 0.647260)),
104 | ((0.091346, -0.777677), (-0.699535, 0.351818)),
105 | ((0.017485, -0.764653), (-0.712559, 0.277957)),
106 | ((-0.647260, -0.647440), (-0.829771, -0.386788)),
107 | ((-0.277957, -0.712559), (-0.764653, -0.017485)),
108 | ((-0.608370, 0.868842), (0.608370, -0.868842)),
109 | ((0.534509, -0.855818), (-0.621393, 0.794981)),
110 | ((0.312927, -0.816747), (-0.660464, 0.573400)),
111 | ((0.239067, -0.803724), (-0.673488, 0.499539)),
112 | ((0.165206, -0.790700), (-0.686511, 0.425679)),
113 | ((-0.794981, -0.621393), (-0.855818, -0.534509)),
114 | ((-0.721121, -0.634417), (-0.842795, -0.460649)),
115 | ((-0.573400, -0.660464), (-0.816747, -0.312927)),
116 | ((-0.499539, -0.673488), (-0.803724, -0.239067)),
117 | ((-0.425679, -0.686511), (-0.790700, -0.165206)),
118 | ((-0.351818, -0.699535), (-0.777677, -0.091346)),
119 | ((-0.751629, 0.056376), (-0.204097, -0.725582)),
120 | ((-0.130236, -0.738606), (-0.738606, 0.130236)),
121 | ((-0.056376, -0.751629), (-0.725582, 0.204097)),
122 | )
123 |
--------------------------------------------------------------------------------
/tests/tests.py:
--------------------------------------------------------------------------------
1 |
2 | """
3 | Example of watching a single test:
4 | watch -n2 "USE_SVG=1 nice -n 20 pypy3 -m unittest tests.IsectTest.test_suzzane"
5 | """
6 |
7 | import sys
8 | import os
9 | import unittest
10 |
11 | # Export results to SVG?
12 | USE_SVG = os.environ.get("USE_SVG")
13 | # USE_SVG = True
14 |
15 | # Slow (so disable by default)
16 | USE_ROTATION = os.environ.get("USE_ROTATION")
17 | # number of rotations to check
18 | ROTATION_DIV = 20
19 |
20 | POLY_ISECT_MODULE_PATH = os.path.join(os.path.dirname(__file__), "..")
21 | TEST_DATA_PATH = os.path.join(os.path.dirname(__file__), "data")
22 |
23 | sys.path.append(POLY_ISECT_MODULE_PATH)
24 | sys.path.append(TEST_DATA_PATH)
25 |
26 | import poly_point_isect
27 |
28 | # ----------------------------------------------------------------------------
29 | # SVG Support
30 |
31 | def export_svg(name, s, ix):
32 | # write svg's to tests dir for now
33 | dirname = os.path.join(TEST_DATA_PATH, "..", "data_svg")
34 | os.makedirs(dirname, exist_ok=True)
35 | fp = os.path.join(dirname, name + ".svg")
36 | scale = 512.0
37 | margin = 1.1
38 | with open(fp, 'w', encoding="utf-8") as f:
39 | fw = f.write
40 | fw('\n')
41 | fw('\n')
42 | fw('')
71 |
72 |
73 | def segments_rotate(s, angle):
74 | from math import sin, cos
75 | si = sin(angle)
76 | co = cos(angle)
77 |
78 | def point_rotate(x, y):
79 | return (x * co - y * si,
80 | x * si + y * co)
81 |
82 | s = [(point_rotate(*p0), point_rotate(*p1)) for (p0, p1) in s]
83 |
84 | return s
85 |
86 |
87 |
88 | def isect_segments(s):
89 | ret = poly_point_isect.isect_segments(s)
90 | return tuple(sorted(set(ret)))
91 |
92 |
93 | def isect_segments__naive(s):
94 | ret = poly_point_isect.isect_segments__naive(s)
95 | return tuple(sorted(set(ret)))
96 |
97 |
98 | def isect_segments_compare(s):
99 | if USE_ROTATION:
100 | from math import radians
101 | for i in range(1, ROTATION_DIV):
102 | fac = (i / ROTATION_DIV) / 100000
103 | angle_deg = 44.999995 + fac
104 | if angle_deg not in {44.9999955, 45}:
105 | continue
106 | # print(angle_deg)
107 | # angle_deg = (360 / ROTATION_DIV) * i
108 | angle_rad = radians(angle_deg)
109 | s_rotate = segments_rotate(s, angle_rad)
110 | yield (s_rotate, isect_segments(s_rotate), isect_segments__naive(s_rotate), ".%.2f" % angle_deg)
111 | return
112 | if 1:
113 | yield (s, isect_segments(s), isect_segments__naive(s), "")
114 | else:
115 | from math import radians
116 | angle_deg = 45.0
117 | angle_rad = radians(angle_deg)
118 | s_rotate = segments_rotate(s, angle_rad)
119 | yield (s_rotate, isect_segments(s_rotate), isect_segments__naive(s_rotate), "")
120 |
121 |
122 |
123 | def test_data_load(name):
124 | return __import__(name).data
125 |
126 |
127 | class TestDataFile_Helper:
128 |
129 | def assertTestData(self, name):
130 | s = test_data_load(name)
131 | for s_alt, ix_final, ix_naive, ix_id in isect_segments_compare(s):
132 | if USE_SVG:
133 | ## incase we want to compare:
134 | export_svg(name + ix_id + ".naive", s_alt, ix_naive)
135 | export_svg(name + ix_id, s_alt, ix_final)
136 | # print(name + ix_id)
137 |
138 | if ix_final == ix_naive:
139 | continue
140 |
141 | if 0:
142 | # simple but we can get more useful output
143 | self.assertEqual(ix_final, ix_naive)
144 | else:
145 | # prints intersect points where differ,
146 | # more useful for debugging.
147 | ix_final_only = tuple(sorted(set(ix_final) - set(ix_naive)))
148 | ix_naive_only = tuple(sorted(set(ix_naive) - set(ix_final)))
149 | self.assertEqual((len(ix_final), ix_final_only, ix_naive_only), (len(ix_naive), (), ()))
150 |
151 |
152 | class NoIsectTest(unittest.TestCase, TestDataFile_Helper):
153 | """
154 | Tests that don't have any intersections
155 | (ensure we have no false positives).
156 | """
157 |
158 | def test_line(self):
159 | self.assertTestData("test_none_line")
160 |
161 | def test_square(self):
162 | self.assertTestData("test_none_square")
163 |
164 | def test_circle_2x(self):
165 | self.assertTestData("test_none_circle_2x")
166 |
167 | def test_circle(self):
168 | self.assertTestData("test_none_circle")
169 |
170 | def test_circle_zigzag(self):
171 | self.assertTestData("test_none_circle_zigzag")
172 |
173 | def test_maze(self):
174 | self.assertTestData("test_none_maze")
175 |
176 |
177 | class IsectDegenerate(unittest.TestCase, TestDataFile_Helper):
178 | """
179 | Tests that are degenerate (no intersections in this case).
180 | """
181 |
182 | # def test_colinear_01(self):
183 | # self.assertTestData("test_degenerate_colinear_01")
184 |
185 | # def test_colinear_02(self):
186 | # self.assertTestData("test_degenerate_colinear_02")
187 |
188 | def test_zero_length_01(self):
189 | self.assertTestData("test_degenerate_zero_length_01")
190 |
191 | def test_zero_length_02(self):
192 | self.assertTestData("test_degenerate_zero_length_02")
193 |
194 | # See bug #24.
195 | def test_duplicates_01(self):
196 | self.assertTestData("test_degenerate_duplicates_01")
197 |
198 |
199 | class IsectTest(unittest.TestCase, TestDataFile_Helper):
200 | """
201 | Tests that self-intersect.
202 | """
203 |
204 | def test_bowtie(self):
205 | self.assertTestData("test_isect_bowtie_01")
206 |
207 | def test_cross(self):
208 | self.assertTestData("test_isect_cross_01")
209 |
210 | def test_crosshatch_01(self):
211 | self.assertTestData("test_isect_crosshatch_01")
212 |
213 | def test_crosshatch_02(self):
214 | self.assertTestData("test_isect_crosshatch_02")
215 |
216 | def test_crosshatch_03(self):
217 | self.assertTestData("test_isect_crosshatch_03")
218 |
219 | def test_bowtie_circle(self):
220 | self.assertTestData("test_isect_bowtie_circle_01")
221 |
222 | def test_suzzane(self):
223 | self.assertTestData("test_isect_suzzane")
224 |
225 | def test_scribble(self):
226 | self.assertTestData("test_isect_scribble_01")
227 |
228 | def test_scatter(self):
229 | self.assertTestData("test_isect_scatter_01")
230 |
231 | def test_spiro(self):
232 | self.assertTestData("test_isect_spiro_01")
233 |
234 |
235 | if __name__ == '__main__':
236 | unittest.main()
237 |
238 | # little sanity check to see if we miss checking any data
239 | test_data_real = set([
240 | f for f in os.listdir(TEST_DATA_PATH)
241 | if f.endswith(".py")])
242 | test_data_used = set([
243 | os.path.basename(m.__file__) for m in sys.modules.values()
244 | if m.__file__.startswith(TEST_DATA_PATH)])
245 |
246 | test_data_unused = test_data_real - test_data_used
247 | if test_data_unused:
248 | print("Untested modules:")
249 | for f in sorted(test_data_unused):
250 | print(" ", f)
251 |
--------------------------------------------------------------------------------
/tests/data/test_isect_spiro_01.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((0.938634, -0.000000), (0.471942, -0.365860)),
3 | ((0.471942, -0.365860), (0.179666, 0.184030)),
4 | ((0.179666, 0.184030), (0.753041, 0.390577)),
5 | ((0.753041, 0.390577), (0.826533, -0.190125)),
6 | ((0.826533, -0.190125), (0.219630, -0.132563)),
7 | ((0.219630, -0.132563), (0.365937, 0.472519)),
8 | ((0.365937, 0.472519), (0.909169, 0.234143)),
9 | ((0.909169, 0.234143), (0.548143, -0.236175)),
10 | ((0.548143, -0.236175), (0.127849, 0.223647)),
11 | ((0.127849, 0.223647), (0.632134, 0.566312)),
12 | ((0.632134, 0.566312), (0.847869, 0.022178)),
13 | ((0.847869, 0.022178), (0.245369, -0.072969)),
14 | ((0.245369, -0.072969), (0.236902, 0.549720)),
15 | ((0.236902, 0.549720), (0.822130, 0.453896)),
16 | ((0.822130, 0.453896), (0.589461, -0.091592)),
17 | ((0.589461, -0.091592), (0.068243, 0.249380)),
18 | ((0.068243, 0.249380), (0.471264, 0.706832)),
19 | ((0.471264, 0.706832), (0.815357, 0.233466)),
20 | ((0.815357, 0.233466), (0.255868, -0.008634)),
21 | ((0.255868, -0.008634), (0.092627, 0.592384)),
22 | ((0.092627, 0.592384), (0.683274, 0.644868)),
23 | ((0.683274, 0.644868), (0.593525, 0.058747)),
24 | ((0.593525, 0.058747), (0.003895, 0.259538)),
25 | ((0.003895, 0.259538), (0.280591, 0.802656)),
26 | ((0.280591, 0.802656), (0.731704, 0.429517)),
27 | ((0.731704, 0.429517), (0.249772, 0.056039)),
28 | ((0.249772, 0.056039), (-0.057744, 0.597463)),
29 | ((-0.057744, 0.597463), (0.501068, 0.795207)),
30 | ((0.501068, 0.795207), (0.560335, 0.205701)),
31 | ((0.560335, 0.205701), (-0.060792, 0.253105)),
32 | ((-0.060792, 0.253105), (0.071968, 0.848029)),
33 | ((0.071968, 0.848029), (0.601654, 0.598818)),
34 | ((0.601654, 0.598818), (0.227758, 0.117326)),
35 | ((0.227758, 0.117326), (-0.204728, 0.565296)),
36 | ((-0.204728, 0.565296), (0.287365, 0.895772)),
37 | ((0.287365, 0.895772), (0.491246, 0.339110)),
38 | ((0.491246, 0.339110), (-0.122092, 0.231096)),
39 | ((-0.122092, 0.231096), (-0.141396, 0.840241)),
40 | ((-0.141396, 0.840241), (0.433672, 0.730534)),
41 | ((0.433672, 0.730534), (0.191520, 0.171163)),
42 | ((0.191520, 0.171163), (-0.339182, 0.497576)),
43 | ((-0.339182, 0.497576), (0.055373, 0.940129)),
44 | ((0.055373, 0.940129), (0.391337, 0.451526)),
45 | ((0.391337, 0.451526), (-0.175941, 0.194188)),
46 | ((-0.175941, 0.194188), (-0.345955, 0.779631)),
47 | ((-0.345955, 0.779631), (0.238257, 0.816539)),
48 | ((0.238257, 0.816539), (0.142751, 0.214504)),
49 | ((0.142751, 0.214504), (-0.452299, 0.398704)),
50 | ((-0.452299, 0.398704), (-0.180344, 0.925230)),
51 | ((-0.180344, 0.925230), (0.266705, 0.535838)),
52 | ((0.266705, 0.535838), (-0.218614, 0.145430)),
53 | ((-0.218614, 0.145430), (-0.529177, 0.669924)),
54 | ((-0.529177, 0.669924), (0.027602, 0.850738)),
55 | ((0.027602, 0.850738), (0.084838, 0.243963)),
56 | ((0.084838, 0.243963), (-0.537306, 0.274437)),
57 | ((-0.537306, 0.274437), (-0.404884, 0.852431)),
58 | ((-0.404884, 0.852431), (0.124801, 0.585951)),
59 | ((0.124801, 0.585951), (-0.248078, 0.087529)),
60 | ((-0.248078, 0.087529), (-0.679549, 0.518230)),
61 | ((-0.679549, 0.518230), (-0.185085, 0.831776)),
62 | ((-0.185085, 0.831776), (0.021167, 0.258184)),
63 | ((0.021167, 0.258184), (-0.589123, 0.133240)),
64 | ((-0.589123, 0.133240), (-0.604363, 0.725794)),
65 | ((-0.604363, 0.725794), (-0.024893, 0.599495)),
66 | ((-0.024893, 0.599495), (-0.262303, 0.023871)),
67 | ((-0.262303, 0.023871), (-0.787247, 0.334031)),
68 | ((-0.787247, 0.334031), (-0.386596, 0.760670)),
69 | ((-0.386596, 0.760670), (-0.043858, 0.256491)),
70 | ((-0.043858, 0.256491), (-0.603686, -0.016422)),
71 | ((-0.603686, -0.016422), (-0.766249, 0.553784)),
72 | ((-0.766249, 0.553784), (-0.173570, 0.575454)),
73 | ((-0.173570, 0.575454), (-0.259932, -0.041140)),
74 | ((-0.259932, -0.041140), (-0.845499, 0.128838)),
75 | ((-0.845499, 0.128838), (-0.563722, 0.641482)),
76 | ((-0.563722, 0.641482), (-0.106174, 0.238545)),
77 | ((-0.106174, 0.238545), (-0.580656, -0.165069)),
78 | ((-0.580656, -0.165069), (-0.880043, 0.346898)),
79 | ((-0.880043, 0.346898), (-0.311410, 0.515183)),
80 | ((-0.311410, 0.515183), (-0.241644, -0.103443)),
81 | ((-0.241644, -0.103443), (-0.851256, -0.084481)),
82 | ((-0.851256, -0.084481), (-0.705626, 0.482339)),
83 | ((-0.705626, 0.482339), (-0.162394, 0.205362)),
84 | ((-0.162394, 0.205362), (-0.521727, -0.303218)),
85 | ((-0.521727, -0.303218), (-0.938634, 0.118003)),
86 | ((-0.938634, 0.118003), (-0.429946, 0.422406)),
87 | ((-0.429946, 0.422406), (-0.208454, -0.159651)),
88 | ((-0.208454, -0.159651), (-0.803503, -0.292722)),
89 | ((-0.803503, -0.292722), (-0.803503, 0.292721)),
90 | ((-0.803503, 0.292721), (-0.208454, 0.159651)),
91 | ((-0.208454, 0.159651), (-0.429946, -0.422406)),
92 | ((-0.429946, -0.422406), (-0.938634, -0.118003)),
93 | ((-0.938634, -0.118003), (-0.521727, 0.303218)),
94 | ((-0.521727, 0.303218), (-0.162394, -0.205362)),
95 | ((-0.162394, -0.205362), (-0.705626, -0.482339)),
96 | ((-0.705626, -0.482339), (-0.851256, 0.084481)),
97 | ((-0.851256, 0.084481), (-0.241644, 0.103443)),
98 | ((-0.241644, 0.103443), (-0.311410, -0.515183)),
99 | ((-0.311410, -0.515183), (-0.880043, -0.346898)),
100 | ((-0.880043, -0.346898), (-0.580656, 0.165068)),
101 | ((-0.580656, 0.165068), (-0.106174, -0.238545)),
102 | ((-0.106174, -0.238545), (-0.563722, -0.641482)),
103 | ((-0.563722, -0.641482), (-0.845499, -0.128838)),
104 | ((-0.845499, -0.128838), (-0.259932, 0.041140)),
105 | ((-0.259932, 0.041140), (-0.173570, -0.575454)),
106 | ((-0.173570, -0.575454), (-0.766249, -0.553784)),
107 | ((-0.766249, -0.553784), (-0.603686, 0.016422)),
108 | ((-0.603686, 0.016422), (-0.043858, -0.256491)),
109 | ((-0.043858, -0.256491), (-0.386596, -0.760670)),
110 | ((-0.386596, -0.760670), (-0.787247, -0.334031)),
111 | ((-0.787247, -0.334031), (-0.262303, -0.023871)),
112 | ((-0.262303, -0.023871), (-0.024893, -0.599495)),
113 | ((-0.024893, -0.599495), (-0.604363, -0.725794)),
114 | ((-0.604363, -0.725794), (-0.589123, -0.133240)),
115 | ((-0.589123, -0.133240), (0.021167, -0.258184)),
116 | ((0.021167, -0.258184), (-0.185085, -0.831776)),
117 | ((-0.185085, -0.831776), (-0.679549, -0.518231)),
118 | ((-0.679549, -0.518231), (-0.248078, -0.087529)),
119 | ((-0.248078, -0.087529), (0.124801, -0.585951)),
120 | ((0.124801, -0.585951), (-0.404884, -0.852431)),
121 | ((-0.404884, -0.852431), (-0.537306, -0.274437)),
122 | ((-0.537306, -0.274437), (0.084838, -0.243963)),
123 | ((0.084838, -0.243963), (0.027602, -0.850738)),
124 | ((0.027602, -0.850738), (-0.529177, -0.669924)),
125 | ((-0.529177, -0.669924), (-0.218614, -0.145430)),
126 | ((-0.218614, -0.145430), (0.266705, -0.535838)),
127 | ((0.266705, -0.535838), (-0.180344, -0.925230)),
128 | ((-0.180344, -0.925230), (-0.452299, -0.398704)),
129 | ((-0.452299, -0.398704), (0.142751, -0.214504)),
130 | ((0.142751, -0.214504), (0.238257, -0.816539)),
131 | ((0.238257, -0.816539), (-0.345955, -0.779631)),
132 | ((-0.345955, -0.779631), (-0.175941, -0.194188)),
133 | ((-0.175941, -0.194188), (0.391337, -0.451526)),
134 | ((0.391337, -0.451526), (0.055373, -0.940129)),
135 | ((0.055373, -0.940129), (-0.339182, -0.497576)),
136 | ((-0.339182, -0.497576), (0.191520, -0.171163)),
137 | ((0.191520, -0.171163), (0.433672, -0.730534)),
138 | ((0.433672, -0.730534), (-0.141396, -0.840241)),
139 | ((-0.141396, -0.840241), (-0.122092, -0.231096)),
140 | ((-0.122092, -0.231096), (0.491246, -0.339110)),
141 | ((0.491246, -0.339110), (0.287365, -0.895772)),
142 | ((0.287365, -0.895772), (-0.204728, -0.565296)),
143 | ((-0.204728, -0.565296), (0.227758, -0.117326)),
144 | ((0.227758, -0.117326), (0.601654, -0.598818)),
145 | ((0.601654, -0.598818), (0.071968, -0.848029)),
146 | ((0.071968, -0.848029), (-0.060792, -0.253105)),
147 | ((-0.060792, -0.253105), (0.560335, -0.205701)),
148 | ((0.560335, -0.205701), (0.501068, -0.795207)),
149 | ((0.501068, -0.795207), (-0.057744, -0.597463)),
150 | ((-0.057744, -0.597463), (0.249772, -0.056039)),
151 | ((0.249772, -0.056039), (0.731704, -0.429517)),
152 | ((0.731704, -0.429517), (0.280591, -0.802656)),
153 | ((0.280591, -0.802656), (0.003895, -0.259539)),
154 | ((0.003895, -0.259539), (0.593525, -0.058748)),
155 | ((0.593525, -0.058748), (0.683274, -0.644868)),
156 | ((0.683274, -0.644868), (0.092627, -0.592384)),
157 | ((0.092627, -0.592384), (0.255868, 0.008634)),
158 | ((0.255868, 0.008634), (0.815357, -0.233466)),
159 | ((0.815357, -0.233466), (0.471264, -0.706832)),
160 | ((0.471264, -0.706832), (0.068243, -0.249381)),
161 | ((0.068243, -0.249381), (0.589461, 0.091592)),
162 | ((0.589461, 0.091592), (0.822130, -0.453896)),
163 | ((0.822130, -0.453896), (0.236902, -0.549720)),
164 | ((0.236902, -0.549720), (0.245369, 0.072969)),
165 | ((0.245369, 0.072969), (0.847869, -0.022178)),
166 | ((0.847869, -0.022178), (0.632134, -0.566312)),
167 | ((0.632134, -0.566312), (0.127849, -0.223647)),
168 | ((0.127849, -0.223647), (0.548143, 0.236175)),
169 | ((0.548143, 0.236175), (0.909169, -0.234143)),
170 | ((0.909169, -0.234143), (0.365937, -0.472519)),
171 | ((0.365937, -0.472519), (0.219630, 0.132563)),
172 | ((0.219630, 0.132563), (0.826533, 0.190125)),
173 | ((0.826533, 0.190125), (0.753041, -0.390578)),
174 | ((0.753041, -0.390578), (0.179666, -0.184030)),
175 | ((0.179666, -0.184030), (0.471942, 0.365859)),
176 | ((0.239612, -0.218906), (0.626377, 0.438659)),
177 | ((0.626377, 0.438659), (0.715787, -0.268342)),
178 | ((0.715787, -0.268342), (0.177634, 0.272405)),
179 | ((0.286349, -0.151524), (0.497342, 0.581549)),
180 | ((0.497342, 0.581549), (0.759814, -0.081095)),
181 | ((0.759814, -0.081095), (0.104142, 0.308974)),
182 | ((0.314797, -0.074662), (0.337150, 0.687870)),
183 | ((0.337150, 0.687870), (0.756089, 0.111569)),
184 | ((0.756089, 0.111569), (0.023876, 0.325904)),
185 | ((0.323603, 0.006941), (0.155282, 0.751189)),
186 | ((0.155282, 0.751189), (0.704610, 0.296785)),
187 | ((0.704610, 0.296785), (-0.058083, 0.322518)),
188 | ((0.311410, 0.088206), (-0.036746, 0.767103)),
189 | ((-0.036746, 0.767103), (0.608427, 0.463377)),
190 | ((0.608427, 0.463377), (-0.136655, 0.298816)),
191 | ((0.279575, 0.163714), (-0.226403, 0.734597)),
192 | ((-0.226403, 0.734597), (0.473974, 0.601188)),
193 | ((0.473974, 0.601188), (-0.206760, 0.256491)),
194 | ((0.230129, 0.229064), (-0.402175, 0.656380)),
195 | ((-0.402175, 0.656380), (0.309378, 0.701076)),
196 | ((0.309378, 0.701076), (-0.264335, 0.197913)),
197 | ((0.165781, 0.279855), (-0.552885, 0.536515)),
198 | ((-0.552885, 0.536515), (0.125140, 0.756945)),
199 | ((0.125140, 0.756945), (-0.305314, 0.126806)),
200 | ((0.090595, 0.313376), (-0.669050, 0.383128)),
201 | ((-0.669050, 0.383128), (-0.067227, 0.765071)),
202 | ((-0.067227, 0.765071), (-0.327328, 0.047912)),
203 | ((0.009652, 0.326920), (-0.743558, 0.205701)),
204 | ((-0.743558, 0.205701), (-0.255529, 0.725116)),
205 | ((-0.255529, 0.725116), (-0.329360, -0.034030)),
206 | ((-0.071968, 0.319810), (-0.771668, 0.015406)),
207 | ((-0.771668, 0.015406), (-0.427914, 0.639789)),
208 | ((-0.427914, 0.639789), (-0.310394, -0.113940)),
209 | ((-0.149524, 0.293060), (-0.751347, -0.175904)),
210 | ((-0.751347, -0.175904), (-0.573882, 0.514167)),
211 | ((-0.573882, 0.514167), (-0.272463, -0.186400)),
212 | ((-0.217598, 0.247687), (-0.683951, -0.356379)),
213 | ((-0.683951, -0.356379), (-0.683951, 0.356379)),
214 | ((-0.683951, 0.356379), (-0.217598, -0.247688)),
215 | ((-0.272463, 0.186400), (-0.573882, -0.514167)),
216 | ((-0.573882, -0.514167), (-0.751347, 0.175904)),
217 | ((-0.751347, 0.175904), (-0.149524, -0.293060)),
218 | ((-0.310394, 0.113940), (-0.427914, -0.639789)),
219 | ((-0.427914, -0.639789), (-0.771668, -0.015406)),
220 | ((-0.771668, -0.015406), (-0.071968, -0.319810)),
221 | ((-0.329360, 0.034029), (-0.255529, -0.725116)),
222 | ((-0.255529, -0.725116), (-0.743558, -0.205701)),
223 | ((-0.743558, -0.205701), (0.009652, -0.326920)),
224 | ((-0.327328, -0.047912), (-0.067227, -0.765071)),
225 | ((-0.067227, -0.765071), (-0.669050, -0.383128)),
226 | ((-0.669050, -0.383128), (0.090595, -0.313376)),
227 | ((-0.305314, -0.126807), (0.125140, -0.756945)),
228 | ((0.125140, -0.756945), (-0.552885, -0.536515)),
229 | ((-0.552885, -0.536515), (0.165781, -0.279855)),
230 | ((-0.264335, -0.197913), (0.309378, -0.701076)),
231 | ((0.309378, -0.701076), (-0.402175, -0.656380)),
232 | ((-0.402175, -0.656380), (0.230129, -0.229064)),
233 | ((-0.206760, -0.256491), (0.473974, -0.601188)),
234 | ((0.473974, -0.601188), (-0.226403, -0.734597)),
235 | ((-0.226403, -0.734597), (0.279575, -0.163714)),
236 | ((-0.136655, -0.298816), (0.608427, -0.463377)),
237 | ((0.608427, -0.463377), (-0.036746, -0.767103)),
238 | ((-0.036746, -0.767103), (0.311410, -0.088206)),
239 | ((-0.058083, -0.322518), (0.704610, -0.296785)),
240 | ((0.704610, -0.296785), (0.155282, -0.751189)),
241 | ((0.155282, -0.751189), (0.323603, -0.006941)),
242 | ((0.023876, -0.325904), (0.756089, -0.111569)),
243 | ((0.756089, -0.111569), (0.337150, -0.687870)),
244 | ((0.337150, -0.687870), (0.314797, 0.074662)),
245 | ((0.104142, -0.308974), (0.759814, 0.081095)),
246 | ((0.759814, 0.081095), (0.497342, -0.581549)),
247 | ((0.497342, -0.581549), (0.286349, 0.151524)),
248 | ((0.177634, -0.272405), (0.715787, 0.268342)),
249 | ((0.715787, 0.268342), (0.626377, -0.438659)),
250 | ((0.626377, -0.438659), (0.239612, 0.218906)),
251 | ((0.319877, 0.368230), (0.401498, -0.276130)),
252 | ((0.218275, 0.437305), (0.457379, -0.166762)),
253 | ((0.102449, 0.478614), (0.484473, -0.046896)),
254 | ((-0.019812, 0.489788), (0.480747, 0.076016)),
255 | ((-0.141396, 0.470488), (0.446541, 0.193850)),
256 | ((-0.254175, 0.421390), (0.384225, 0.299832)),
257 | ((-0.351035, 0.345882), (0.297525, 0.386853)),
258 | ((-0.426221, 0.248703), (0.191859, 0.449494)),
259 | ((-0.474990, 0.135949), (0.073662, 0.484032)),
260 | ((-0.493955, 0.014729), (-0.048938, 0.488095)),
261 | ((-0.482102, -0.107845), (-0.169167, 0.461684)),
262 | ((-0.440445, -0.223308), (-0.278559, 0.405815)),
263 | ((-0.371017, -0.324889), (-0.371017, 0.324889)),
264 | ((-0.278559, -0.405815), (-0.440445, 0.223308)),
265 | ((-0.169167, -0.461684), (-0.482102, 0.107845)),
266 | ((-0.048938, -0.488095), (-0.493955, -0.014729)),
267 | ((0.073662, -0.484032), (-0.474990, -0.135949)),
268 | ((0.191859, -0.449494), (-0.426221, -0.248703)),
269 | ((0.297525, -0.386853), (-0.351035, -0.345882)),
270 | ((0.384225, -0.299832), (-0.254175, -0.421390)),
271 | ((0.446541, -0.193850), (-0.141396, -0.470488)),
272 | ((0.480747, -0.076016), (-0.019812, -0.489788)),
273 | ((0.484473, 0.046896), (0.102449, -0.478614)),
274 | ((0.457379, 0.166761), (0.218275, -0.437305)),
275 | ((0.401498, 0.276130), (0.319877, -0.368230)),
276 | ((0.938634, -0.000000), (0.239612, -0.218906)),
277 | ((0.177634, 0.272405), (0.909169, 0.234143)),
278 | ((0.909169, 0.234143), (0.286349, -0.151524)),
279 | ((0.104142, 0.308974), (0.822130, 0.453896)),
280 | ((0.822130, 0.453896), (0.314797, -0.074662)),
281 | ((0.023876, 0.325904), (0.683274, 0.644868)),
282 | ((0.683274, 0.644868), (0.323603, 0.006941)),
283 | ((-0.058083, 0.322518), (0.501068, 0.795207)),
284 | ((0.501068, 0.795207), (0.311410, 0.088206)),
285 | ((-0.136655, 0.298816), (0.287365, 0.895772)),
286 | ((0.287365, 0.895772), (0.279575, 0.163714)),
287 | ((-0.206760, 0.256491), (0.055373, 0.940129)),
288 | ((0.055373, 0.940129), (0.230129, 0.229064)),
289 | ((-0.264335, 0.197913), (-0.180344, 0.925230)),
290 | ((-0.180344, 0.925230), (0.165781, 0.279855)),
291 | ((-0.305314, 0.126806), (-0.404884, 0.852431)),
292 | ((-0.404884, 0.852431), (0.090595, 0.313376)),
293 | ((-0.327328, 0.047912), (-0.604363, 0.725794)),
294 | ((-0.604363, 0.725794), (0.009652, 0.326920)),
295 | ((-0.329360, -0.034030), (-0.766249, 0.553784)),
296 | ((-0.766249, 0.553784), (-0.071968, 0.319810)),
297 | ((-0.310394, -0.113940), (-0.880043, 0.346898)),
298 | ((-0.880043, 0.346898), (-0.149524, 0.293060)),
299 | ((-0.272463, -0.186400), (-0.938634, 0.118003)),
300 | ((-0.938634, 0.118003), (-0.217598, 0.247687)),
301 | ((-0.217598, -0.247688), (-0.938634, -0.118003)),
302 | ((-0.938634, -0.118003), (-0.272463, 0.186400)),
303 | ((-0.149524, -0.293060), (-0.880043, -0.346898)),
304 | ((-0.880043, -0.346898), (-0.310394, 0.113940)),
305 | ((-0.071968, -0.319810), (-0.766249, -0.553784)),
306 | ((-0.766249, -0.553784), (-0.329360, 0.034029)),
307 | ((0.009652, -0.326920), (-0.604363, -0.725794)),
308 | ((-0.604363, -0.725794), (-0.327328, -0.047912)),
309 | ((0.090595, -0.313376), (-0.404884, -0.852431)),
310 | ((-0.404884, -0.852431), (-0.305314, -0.126807)),
311 | ((0.165781, -0.279855), (-0.180344, -0.925230)),
312 | ((-0.180344, -0.925230), (-0.264335, -0.197913)),
313 | ((0.230129, -0.229064), (0.055373, -0.940129)),
314 | ((0.055373, -0.940129), (-0.206760, -0.256491)),
315 | ((0.279575, -0.163714), (0.287365, -0.895772)),
316 | ((0.287365, -0.895772), (-0.136655, -0.298816)),
317 | ((0.311410, -0.088206), (0.501068, -0.795207)),
318 | ((0.501068, -0.795207), (-0.058083, -0.322518)),
319 | ((0.323603, -0.006941), (0.683274, -0.644868)),
320 | ((0.683274, -0.644868), (0.023876, -0.325904)),
321 | ((0.314797, 0.074662), (0.822130, -0.453896)),
322 | ((0.822130, -0.453896), (0.104142, -0.308974)),
323 | ((0.286349, 0.151524), (0.909169, -0.234143)),
324 | ((0.909169, -0.234143), (0.177634, -0.272405)),
325 | ((0.938634, -0.000000), (0.319877, 0.368230)),
326 | ((0.401498, -0.276130), (0.909169, 0.234143)),
327 | ((0.909169, 0.234143), (0.218275, 0.437305)),
328 | ((0.457379, -0.166762), (0.822130, 0.453896)),
329 | ((0.822130, 0.453896), (0.102449, 0.478614)),
330 | ((0.484473, -0.046896), (0.683274, 0.644868)),
331 | ((0.683274, 0.644868), (-0.019812, 0.489788)),
332 | ((0.480747, 0.076016), (0.501068, 0.795207)),
333 | ((0.501068, 0.795207), (-0.141396, 0.470488)),
334 | ((0.446541, 0.193850), (0.287365, 0.895772)),
335 | ((0.287365, 0.895772), (-0.254175, 0.421390)),
336 | ((0.384225, 0.299832), (0.055373, 0.940129)),
337 | ((0.055373, 0.940129), (-0.351035, 0.345882)),
338 | ((0.297525, 0.386853), (-0.180344, 0.925230)),
339 | ((-0.180344, 0.925230), (-0.426221, 0.248703)),
340 | ((0.191859, 0.449494), (-0.404884, 0.852431)),
341 | ((-0.404884, 0.852431), (-0.474990, 0.135949)),
342 | ((0.073662, 0.484032), (-0.604363, 0.725794)),
343 | ((-0.604363, 0.725794), (-0.493955, 0.014729)),
344 | ((-0.048938, 0.488095), (-0.766249, 0.553784)),
345 | ((-0.766249, 0.553784), (-0.482102, -0.107845)),
346 | ((-0.169167, 0.461684), (-0.880043, 0.346898)),
347 | ((-0.880043, 0.346898), (-0.440445, -0.223308)),
348 | ((-0.278559, 0.405815), (-0.938634, 0.118003)),
349 | ((-0.938634, 0.118003), (-0.371017, -0.324889)),
350 | ((-0.371017, 0.324889), (-0.938634, -0.118003)),
351 | ((-0.938634, -0.118003), (-0.278559, -0.405815)),
352 | ((-0.440445, 0.223308), (-0.880043, -0.346898)),
353 | ((-0.880043, -0.346898), (-0.169167, -0.461684)),
354 | ((-0.482102, 0.107845), (-0.766249, -0.553784)),
355 | ((-0.766249, -0.553784), (-0.048938, -0.488095)),
356 | ((-0.493955, -0.014729), (-0.604363, -0.725794)),
357 | ((-0.604363, -0.725794), (0.073662, -0.484032)),
358 | ((-0.474990, -0.135949), (-0.404884, -0.852431)),
359 | ((-0.404884, -0.852431), (0.191859, -0.449494)),
360 | ((-0.426221, -0.248703), (-0.180344, -0.925230)),
361 | ((-0.180344, -0.925230), (0.297525, -0.386853)),
362 | ((-0.351035, -0.345882), (0.055373, -0.940129)),
363 | ((0.055373, -0.940129), (0.384225, -0.299832)),
364 | ((-0.254175, -0.421390), (0.287365, -0.895772)),
365 | ((0.287365, -0.895772), (0.446541, -0.193850)),
366 | ((-0.141396, -0.470488), (0.501068, -0.795207)),
367 | ((0.501068, -0.795207), (0.480747, -0.076016)),
368 | ((-0.019812, -0.489788), (0.683274, -0.644868)),
369 | ((0.683274, -0.644868), (0.484473, 0.046896)),
370 | ((0.102449, -0.478614), (0.822130, -0.453896)),
371 | ((0.822130, -0.453896), (0.457379, 0.166761)),
372 | ((0.218275, -0.437305), (0.909169, -0.234143)),
373 | ((0.909169, -0.234143), (0.401498, 0.276130)),
374 | ((0.471942, 0.365859), (0.938634, -0.000000)),
375 | ((0.239612, 0.218906), (0.938634, -0.000000)),
376 | ((0.319877, -0.368230), (0.938634, -0.000000)),
377 | )
378 |
--------------------------------------------------------------------------------
/tests/data_svg/test_isect_crosshatch_02.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/data/test_isect_bowtie_circle_01.py:
--------------------------------------------------------------------------------
1 | data = (
2 | ((0.000000, 0.900000), (0.146998, 0.882707)),
3 | ((0.274250, 0.831492), (0.364257, 0.748323)),
4 | ((0.364257, 0.748323), (0.403806, 0.636397)),
5 | ((0.403806, 0.636397), (0.385588, 0.500014)),
6 | ((0.385588, 0.500014), (0.309238, 0.344416)),
7 | ((0.309238, 0.344416), (0.181693, 0.175582)),
8 | ((0.181693, 0.175582), (0.016817, 0.000001)),
9 | ((0.016817, 0.000001), (-0.165673, -0.175581)),
10 | ((-0.165673, -0.175581), (-0.341921, -0.344414)),
11 | ((-0.341921, -0.344414), (-0.486104, -0.500013)),
12 | ((-0.486104, -0.500013), (-0.572905, -0.636396)),
13 | ((-0.572905, -0.636396), (-0.580046, -0.748322)),
14 | ((-0.580046, -0.748322), (-0.490680, -0.831491)),
15 | ((-0.490680, -0.831491), (-0.295532, -0.882707)),
16 | ((-0.295532, -0.882707), (0.000000, -0.900000)),
17 | ((0.000000, -0.900000), (0.295533, -0.882707)),
18 | ((0.295533, -0.882707), (0.490680, -0.831492)),
19 | ((0.490680, -0.831492), (0.580047, -0.748323)),
20 | ((0.580047, -0.748323), (0.572906, -0.636396)),
21 | ((0.572906, -0.636396), (0.486105, -0.500013)),
22 | ((0.486105, -0.500013), (0.341922, -0.344415)),
23 | ((0.341922, -0.344415), (0.165674, -0.175581)),
24 | ((0.165674, -0.175581), (-0.016817, 0.000000)),
25 | ((-0.016817, 0.000000), (-0.181692, 0.175581)),
26 | ((-0.181692, 0.175581), (-0.309237, 0.344415)),
27 | ((-0.309237, 0.344415), (-0.385588, 0.500013)),
28 | ((-0.385588, 0.500013), (-0.403806, 0.636396)),
29 | ((-0.403806, 0.636396), (-0.364257, 0.748323)),
30 | ((-0.364257, 0.748323), (-0.274251, 0.831492)),
31 | ((-0.274251, 0.831492), (-0.146999, 0.882707)),
32 | ((-0.146999, 0.882707), (0.000000, 0.900000)),
33 | ((0.146998, 0.882707), (0.274250, 0.831492)),
34 | ((-0.192457, 0.980785), (0.000000, 1.000000)),
35 | ((-0.360982, 0.923880), (-0.192457, 0.980785)),
36 | ((-0.484309, 0.831470), (-0.360982, 0.923880)),
37 | ((-0.546254, 0.707107), (-0.484309, 0.831470)),
38 | ((-0.537632, 0.555570), (-0.546254, 0.707107)),
39 | ((-0.457507, 0.382683), (-0.537632, 0.555570)),
40 | ((-0.313624, 0.195090), (-0.457507, 0.382683)),
41 | ((-0.121995, 0.000000), (-0.313624, 0.195090)),
42 | ((0.094366, -0.195090), (-0.121995, 0.000000)),
43 | ((0.307430, -0.382683), (0.094366, -0.195090)),
44 | ((0.486710, -0.555570), (0.307430, -0.382683)),
45 | ((0.602162, -0.707107), (0.486710, -0.555570)),
46 | ((0.627167, -0.831470), (0.602162, -0.707107)),
47 | ((0.541323, -0.923880), (0.627167, -0.831470)),
48 | ((0.332796, -0.980785), (0.541323, -0.923880)),
49 | ((0.000000, -1.000000), (0.332796, -0.980785)),
50 | ((-0.332796, -0.980785), (0.000000, -1.000000)),
51 | ((-0.541322, -0.923879), (-0.332796, -0.980785)),
52 | ((-0.627166, -0.831469), (-0.541322, -0.923879)),
53 | ((-0.602161, -0.707106), (-0.627166, -0.831469)),
54 | ((-0.486709, -0.555570), (-0.602161, -0.707106)),
55 | ((-0.307429, -0.382683), (-0.486709, -0.555570)),
56 | ((-0.094366, -0.195089), (-0.307429, -0.382683)),
57 | ((0.121996, 0.000001), (-0.094366, -0.195089)),
58 | ((0.313625, 0.195091), (0.121996, 0.000001)),
59 | ((0.457507, 0.382684), (0.313625, 0.195091)),
60 | ((0.537633, 0.555571), (0.457507, 0.382684)),
61 | ((0.546254, 0.707108), (0.537633, 0.555571)),
62 | ((0.484309, 0.831470), (0.546254, 0.707108)),
63 | ((0.360981, 0.923880), (0.484309, 0.831470)),
64 | ((0.192456, 0.980786), (0.360981, 0.923880)),
65 | ((0.000000, 1.000000), (0.192456, 0.980786)),
66 | ((0.000000, 0.810000), (0.111078, 0.794436)),
67 | ((0.205902, 0.748343), (0.270113, 0.673491)),
68 | ((0.270113, 0.673491), (0.292966, 0.572757)),
69 | ((0.292966, 0.572757), (0.268686, 0.450013)),
70 | ((0.268686, 0.450013), (0.197343, 0.309974)),
71 | ((0.197343, 0.309974), (0.085138, 0.158024)),
72 | ((0.085138, 0.158024), (-0.055924, 0.000001)),
73 | ((-0.055924, 0.000001), (-0.208966, -0.158022)),
74 | ((-0.208966, -0.158022), (-0.353696, -0.309973)),
75 | ((-0.353696, -0.309973), (-0.468274, -0.450011)),
76 | ((-0.468274, -0.450011), (-0.531420, -0.572756)),
77 | ((-0.531420, -0.572756), (-0.524604, -0.673490)),
78 | ((-0.524604, -0.673490), (-0.434244, -0.748342)),
79 | ((-0.434244, -0.748342), (-0.254567, -0.794436)),
80 | ((-0.254567, -0.794436), (0.000000, -0.810000)),
81 | ((0.000000, -0.810000), (0.254568, -0.794436)),
82 | ((0.254568, -0.794436), (0.434245, -0.748343)),
83 | ((0.434245, -0.748343), (0.524605, -0.673490)),
84 | ((0.524605, -0.673490), (0.531420, -0.572757)),
85 | ((0.531420, -0.572757), (0.468275, -0.450012)),
86 | ((0.468275, -0.450012), (0.353697, -0.309973)),
87 | ((0.353697, -0.309973), (0.208967, -0.158023)),
88 | ((0.208967, -0.158023), (0.055925, 0.000000)),
89 | ((0.055925, 0.000000), (-0.085137, 0.158023)),
90 | ((-0.085137, 0.158023), (-0.197342, 0.309974)),
91 | ((-0.197342, 0.309974), (-0.268685, 0.450012)),
92 | ((-0.268685, 0.450012), (-0.292966, 0.572757)),
93 | ((-0.292966, 0.572757), (-0.270113, 0.673490)),
94 | ((-0.270113, 0.673490), (-0.205903, 0.748342)),
95 | ((-0.205903, 0.748342), (-0.111079, 0.794436)),
96 | ((-0.111079, 0.794436), (0.000000, 0.810000)),
97 | ((0.111078, 0.794436), (0.205902, 0.748343)),
98 | ((0.000000, 0.729000), (0.082792, 0.714993)),
99 | ((0.152240, 0.673509), (0.196600, 0.606142)),
100 | ((0.196600, 0.606142), (0.207166, 0.515482)),
101 | ((0.207166, 0.515482), (0.179421, 0.405011)),
102 | ((0.179421, 0.405011), (0.113756, 0.278977)),
103 | ((0.113756, 0.278977), (0.015704, 0.142222)),
104 | ((0.015704, 0.142222), (-0.104347, 0.000001)),
105 | ((-0.104347, 0.000001), (-0.231965, -0.142220)),
106 | ((-0.231965, -0.142220), (-0.349918, -0.278976)),
107 | ((-0.349918, -0.278976), (-0.439784, -0.405010)),
108 | ((-0.439784, -0.405010), (-0.483775, -0.515481)),
109 | ((-0.483775, -0.515481), (-0.466701, -0.606141)),
110 | ((-0.466701, -0.606141), (-0.378187, -0.673508)),
111 | ((-0.378187, -0.673508), (-0.216469, -0.714992)),
112 | ((-0.216469, -0.714992), (0.000000, -0.729000)),
113 | ((0.000000, -0.729000), (0.216470, -0.714993)),
114 | ((0.216470, -0.714993), (0.378188, -0.673508)),
115 | ((0.378188, -0.673508), (0.466702, -0.606141)),
116 | ((0.466702, -0.606141), (0.483776, -0.515481)),
117 | ((0.483776, -0.515481), (0.439785, -0.405011)),
118 | ((0.439785, -0.405011), (0.349919, -0.278976)),
119 | ((0.349919, -0.278976), (0.231966, -0.142221)),
120 | ((0.231966, -0.142221), (0.104348, 0.000000)),
121 | ((0.104348, 0.000000), (-0.015703, 0.142221)),
122 | ((-0.015703, 0.142221), (-0.113755, 0.278976)),
123 | ((-0.113755, 0.278976), (-0.179421, 0.405011)),
124 | ((-0.179421, 0.405011), (-0.207166, 0.515481)),
125 | ((-0.207166, 0.515481), (-0.196599, 0.606141)),
126 | ((-0.196599, 0.606141), (-0.152240, 0.673508)),
127 | ((-0.152240, 0.673508), (-0.082792, 0.714993)),
128 | ((-0.082792, 0.714993), (0.000000, 0.729000)),
129 | ((0.082792, 0.714993), (0.152240, 0.673509)),
130 | ((0.000000, 0.656100), (0.060606, 0.643493)),
131 | ((0.110291, 0.606158), (0.139481, 0.545528)),
132 | ((0.139481, 0.545528), (0.141157, 0.463933)),
133 | ((0.141157, 0.463933), (0.111822, 0.364510)),
134 | ((0.111822, 0.364510), (0.052097, 0.251079)),
135 | ((0.052097, 0.251079), (-0.033089, 0.127999)),
136 | ((-0.033089, 0.127999), (-0.134761, 0.000001)),
137 | ((-0.134761, 0.000001), (-0.240594, -0.127998)),
138 | ((-0.240594, -0.127998), (-0.335997, -0.251078)),
139 | ((-0.335997, -0.251078), (-0.405497, -0.364509)),
140 | ((-0.405497, -0.364509), (-0.434355, -0.463933)),
141 | ((-0.434355, -0.463933), (-0.410377, -0.545527)),
142 | ((-0.410377, -0.545527), (-0.326195, -0.606157)),
143 | ((-0.326195, -0.606157), (-0.183247, -0.643493)),
144 | ((-0.183247, -0.643493), (0.000000, -0.656100)),
145 | ((0.000000, -0.656100), (0.183248, -0.643493)),
146 | ((0.183248, -0.643493), (0.326196, -0.606158)),
147 | ((0.326196, -0.606158), (0.410378, -0.545527)),
148 | ((0.410378, -0.545527), (0.434356, -0.463933)),
149 | ((0.434356, -0.463933), (0.405498, -0.364510)),
150 | ((0.405498, -0.364510), (0.335998, -0.251079)),
151 | ((0.335998, -0.251079), (0.240595, -0.127999)),
152 | ((0.240595, -0.127999), (0.134762, 0.000000)),
153 | ((0.134762, 0.000000), (0.033090, 0.127999)),
154 | ((0.033090, 0.127999), (-0.052096, 0.251079)),
155 | ((-0.052096, 0.251079), (-0.111822, 0.364510)),
156 | ((-0.111822, 0.364510), (-0.141157, 0.463933)),
157 | ((-0.141157, 0.463933), (-0.139480, 0.545527)),
158 | ((-0.139480, 0.545527), (-0.110291, 0.606157)),
159 | ((-0.110291, 0.606157), (-0.060606, 0.643493)),
160 | ((-0.060606, 0.643493), (0.000000, 0.656100)),
161 | ((0.060606, 0.643493), (0.110291, 0.606158)),
162 | ((0.000000, 0.590490), (0.043288, 0.579144)),
163 | ((0.077667, 0.545542), (0.095363, 0.490975)),
164 | ((0.095363, 0.490975), (0.090747, 0.417540)),
165 | ((0.090747, 0.417540), (0.061145, 0.328059)),
166 | ((0.061145, 0.328059), (0.007337, 0.225971)),
167 | ((0.007337, 0.225971), (-0.066300, 0.115200)),
168 | ((-0.066300, 0.115200), (-0.152025, 0.000001)),
169 | ((-0.152025, 0.000001), (-0.239339, -0.115198)),
170 | ((-0.239339, -0.115198), (-0.315926, -0.225970)),
171 | ((-0.315926, -0.225970), (-0.368868, -0.328058)),
172 | ((-0.368868, -0.328058), (-0.386086, -0.417539)),
173 | ((-0.386086, -0.417539), (-0.358023, -0.490974)),
174 | ((-0.358023, -0.490974), (-0.279853, -0.545542)),
175 | ((-0.279853, -0.545542), (-0.154975, -0.579144)),
176 | ((-0.154975, -0.579144), (0.000001, -0.590490)),
177 | ((0.000001, -0.590490), (0.154976, -0.579144)),
178 | ((0.154976, -0.579144), (0.279854, -0.545542)),
179 | ((0.279854, -0.545542), (0.358024, -0.490975)),
180 | ((0.358024, -0.490975), (0.386087, -0.417540)),
181 | ((0.386087, -0.417540), (0.368869, -0.328059)),
182 | ((0.368869, -0.328059), (0.315927, -0.225971)),
183 | ((0.315927, -0.225971), (0.239340, -0.115199)),
184 | ((0.239340, -0.115199), (0.152026, 0.000000)),
185 | ((0.152026, 0.000000), (0.066301, 0.115199)),
186 | ((0.066301, 0.115199), (-0.007336, 0.225971)),
187 | ((-0.007336, 0.225971), (-0.061145, 0.328059)),
188 | ((-0.061145, 0.328059), (-0.090746, 0.417540)),
189 | ((-0.090746, 0.417540), (-0.095362, 0.490975)),
190 | ((-0.095362, 0.490975), (-0.077667, 0.545542)),
191 | ((-0.077667, 0.545542), (-0.043288, 0.579144)),
192 | ((-0.043288, 0.579144), (0.000000, 0.590490)),
193 | ((0.043288, 0.579144), (0.077667, 0.545542)),
194 | ((0.000000, 0.531441), (0.029846, 0.521230)),
195 | ((0.052452, 0.490988), (0.061530, 0.441878)),
196 | ((0.061530, 0.441878), (0.052594, 0.375786)),
197 | ((0.052594, 0.375786), (0.023632, 0.295253)),
198 | ((0.023632, 0.295253), (-0.024478, 0.203374)),
199 | ((-0.024478, 0.203374), (-0.087861, 0.103680)),
200 | ((-0.087861, 0.103680), (-0.159854, 0.000000)),
201 | ((-0.159854, 0.000000), (-0.231540, -0.103679)),
202 | ((-0.231540, -0.103679), (-0.292572, -0.203373)),
203 | ((-0.292572, -0.203373), (-0.332235, -0.295253)),
204 | ((-0.332235, -0.295253), (-0.340744, -0.375785)),
205 | ((-0.340744, -0.375785), (-0.310779, -0.441877)),
206 | ((-0.310779, -0.441877), (-0.239479, -0.490987)),
207 | ((-0.239479, -0.490987), (-0.131150, -0.521230)),
208 | ((-0.131150, -0.521230), (0.000001, -0.531441)),
209 | ((0.000001, -0.531441), (0.131151, -0.521230)),
210 | ((0.131151, -0.521230), (0.239480, -0.490988)),
211 | ((0.239480, -0.490988), (0.310780, -0.441877)),
212 | ((0.310780, -0.441877), (0.340745, -0.375786)),
213 | ((0.340745, -0.375786), (0.332236, -0.295253)),
214 | ((0.332236, -0.295253), (0.292573, -0.203374)),
215 | ((0.292573, -0.203374), (0.231541, -0.103679)),
216 | ((0.231541, -0.103679), (0.159855, 0.000000)),
217 | ((0.159855, 0.000000), (0.087861, 0.103679)),
218 | ((0.087861, 0.103679), (0.024478, 0.203374)),
219 | ((0.024478, 0.203374), (-0.023632, 0.295253)),
220 | ((-0.023632, 0.295253), (-0.052593, 0.375786)),
221 | ((-0.052593, 0.375786), (-0.061529, 0.441877)),
222 | ((-0.061529, 0.441877), (-0.052452, 0.490988)),
223 | ((-0.052452, 0.490988), (-0.029845, 0.521230)),
224 | ((-0.029845, 0.521230), (0.000000, 0.531441)),
225 | ((0.029846, 0.521230), (0.052452, 0.490988)),
226 | ((0.000000, 0.478297), (0.019484, 0.469107)),
227 | ((0.033108, 0.441889), (0.035811, 0.397690)),
228 | ((0.035811, 0.397690), (0.024041, 0.338208)),
229 | ((0.024041, 0.338208), (-0.003685, 0.265728)),
230 | ((-0.003685, 0.265728), (-0.046439, 0.183037)),
231 | ((-0.046439, 0.183037), (-0.100801, 0.093312)),
232 | ((-0.100801, 0.093312), (-0.161054, 0.000000)),
233 | ((-0.161054, 0.000000), (-0.219649, -0.093311)),
234 | ((-0.219649, -0.093311), (-0.267933, -0.183036)),
235 | ((-0.267933, -0.183036), (-0.297083, -0.265727)),
236 | ((-0.297083, -0.265727), (-0.299258, -0.338207)),
237 | ((-0.299258, -0.338207), (-0.268969, -0.397689)),
238 | ((-0.268969, -0.397689), (-0.204759, -0.441889)),
239 | ((-0.204759, -0.441889), (-0.111151, -0.469107)),
240 | ((-0.111151, -0.469107), (0.000001, -0.478297)),
241 | ((0.000001, -0.478297), (0.111152, -0.469107)),
242 | ((0.111152, -0.469107), (0.204760, -0.441889)),
243 | ((0.204760, -0.441889), (0.268971, -0.397689)),
244 | ((0.268971, -0.397689), (0.299259, -0.338207)),
245 | ((0.299259, -0.338207), (0.297084, -0.265728)),
246 | ((0.297084, -0.265728), (0.267934, -0.183036)),
247 | ((0.267934, -0.183036), (0.219650, -0.093311)),
248 | ((0.219650, -0.093311), (0.161055, 0.000000)),
249 | ((0.161055, 0.000000), (0.100802, 0.093311)),
250 | ((0.100802, 0.093311), (0.046440, 0.183036)),
251 | ((0.046440, 0.183036), (0.003685, 0.265728)),
252 | ((0.003685, 0.265728), (-0.024041, 0.338207)),
253 | ((-0.024041, 0.338207), (-0.035811, 0.397689)),
254 | ((-0.035811, 0.397689), (-0.033108, 0.441889)),
255 | ((-0.033108, 0.441889), (-0.019483, 0.469107)),
256 | ((-0.019483, 0.469107), (0.000000, 0.478297)),
257 | ((0.019484, 0.469107), (0.033108, 0.441889)),
258 | ((0.000000, 0.430467), (0.011563, 0.422196)),
259 | ((0.018406, 0.397700), (0.016475, 0.357921)),
260 | ((0.016475, 0.357921), (0.002979, 0.304387)),
261 | ((0.002979, 0.304387), (-0.023146, 0.239155)),
262 | ((-0.023146, 0.239155), (-0.060957, 0.164733)),
263 | ((-0.060957, 0.164733), (-0.107448, 0.083980)),
264 | ((-0.107448, 0.083980), (-0.157726, 0.000000)),
265 | ((-0.157726, 0.000000), (-0.205427, -0.083980)),
266 | ((-0.205427, -0.083980), (-0.243347, -0.164732)),
267 | ((-0.243347, -0.164732), (-0.264272, -0.239155)),
268 | ((-0.264272, -0.239155), (-0.261983, -0.304386)),
269 | ((-0.261983, -0.304386), (-0.232438, -0.357920)),
270 | ((-0.232438, -0.357920), (-0.175122, -0.397700)),
271 | ((-0.175122, -0.397700), (-0.094385, -0.422196)),
272 | ((-0.094385, -0.422196), (0.000001, -0.430467)),
273 | ((0.000001, -0.430467), (0.094386, -0.422196)),
274 | ((0.094386, -0.422196), (0.175123, -0.397700)),
275 | ((0.175123, -0.397700), (0.232439, -0.357921)),
276 | ((0.232439, -0.357921), (0.261984, -0.304386)),
277 | ((0.261984, -0.304386), (0.264273, -0.239155)),
278 | ((0.264273, -0.239155), (0.243348, -0.164733)),
279 | ((0.243348, -0.164733), (0.205428, -0.083980)),
280 | ((0.205428, -0.083980), (0.157727, 0.000000)),
281 | ((0.157727, 0.000000), (0.107449, 0.083980)),
282 | ((0.107449, 0.083980), (0.060958, 0.164733)),
283 | ((0.060958, 0.164733), (0.023147, 0.239155)),
284 | ((0.023147, 0.239155), (-0.002978, 0.304386)),
285 | ((-0.002978, 0.304386), (-0.016474, 0.357920)),
286 | ((-0.016474, 0.357920), (-0.018406, 0.397700)),
287 | ((-0.018406, 0.397700), (-0.011563, 0.422196)),
288 | ((-0.011563, 0.422196), (0.000000, 0.430467)),
289 | ((0.011563, 0.422196), (0.018406, 0.397700)),
290 | ((0.000000, 0.387421), (0.005573, 0.379977)),
291 | ((0.007361, 0.357930), (0.002140, 0.322129)),
292 | ((0.002140, 0.322129), (-0.012265, 0.273948)),
293 | ((-0.012265, 0.273948), (-0.036589, 0.215240)),
294 | ((-0.036589, 0.215240), (-0.069902, 0.148260)),
295 | ((-0.069902, 0.148260), (-0.109571, 0.075582)),
296 | ((-0.109571, 0.075582), (-0.151423, 0.000000)),
297 | ((-0.151423, 0.000000), (-0.190111, -0.075582)),
298 | ((-0.190111, -0.075582), (-0.219669, -0.148259)),
299 | ((-0.219669, -0.148259), (-0.234233, -0.215239)),
300 | ((-0.234233, -0.215239), (-0.228912, -0.273948)),
301 | ((-0.228912, -0.273948), (-0.200781, -0.322128)),
302 | ((-0.200781, -0.322128), (-0.149925, -0.357930)),
303 | ((-0.149925, -0.357930), (-0.080327, -0.379976)),
304 | ((-0.080327, -0.379976), (0.000001, -0.387421)),
305 | ((0.000001, -0.387421), (0.080328, -0.379977)),
306 | ((0.080328, -0.379977), (0.149926, -0.357930)),
307 | ((0.149926, -0.357930), (0.200782, -0.322129)),
308 | ((0.200782, -0.322129), (0.228913, -0.273948)),
309 | ((0.228913, -0.273948), (0.234234, -0.215239)),
310 | ((0.234234, -0.215239), (0.219670, -0.148259)),
311 | ((0.219670, -0.148259), (0.190112, -0.075582)),
312 | ((0.190112, -0.075582), (0.151424, 0.000000)),
313 | ((0.151424, 0.000000), (0.109572, 0.075582)),
314 | ((0.109572, 0.075582), (0.069903, 0.148259)),
315 | ((0.069903, 0.148259), (0.036590, 0.215239)),
316 | ((0.036590, 0.215239), (0.012266, 0.273948)),
317 | ((0.012266, 0.273948), (-0.002139, 0.322129)),
318 | ((-0.002139, 0.322129), (-0.007361, 0.357930)),
319 | ((-0.007361, 0.357930), (-0.005572, 0.379976)),
320 | ((-0.005572, 0.379976), (0.000000, 0.387421)),
321 | ((0.005573, 0.379977), (0.007361, 0.357930)),
322 | ((0.000000, 0.348679), (0.001102, 0.341979)),
323 | ((-0.000812, 0.322137), (-0.008292, 0.289916)),
324 | ((-0.008292, 0.289916), (-0.023013, 0.246553)),
325 | ((-0.023013, 0.246553), (-0.045455, 0.193716)),
326 | ((-0.045455, 0.193716), (-0.074721, 0.133434)),
327 | ((-0.074721, 0.133434), (-0.108512, 0.068024)),
328 | ((-0.108512, 0.068024), (-0.143281, 0.000000)),
329 | ((-0.143281, 0.000000), (-0.174552, -0.068024)),
330 | ((-0.174552, -0.068024), (-0.197406, -0.133433)),
331 | ((-0.197406, -0.133433), (-0.207103, -0.193715)),
332 | ((-0.207103, -0.193715), (-0.199826, -0.246553)),
333 | ((-0.199826, -0.246553), (-0.173491, -0.289916)),
334 | ((-0.173491, -0.289916), (-0.128545, -0.322137)),
335 | ((-0.128545, -0.322137), (-0.068526, -0.341979)),
336 | ((-0.068526, -0.341979), (0.000001, -0.348679)),
337 | ((0.000001, -0.348679), (0.068527, -0.341979)),
338 | ((0.068527, -0.341979), (0.128546, -0.322137)),
339 | ((0.128546, -0.322137), (0.173492, -0.289916)),
340 | ((0.173492, -0.289916), (0.199827, -0.246553)),
341 | ((0.199827, -0.246553), (0.207104, -0.193715)),
342 | ((0.207104, -0.193715), (0.197406, -0.133433)),
343 | ((0.197406, -0.133433), (0.174553, -0.068024)),
344 | ((0.174553, -0.068024), (0.143282, 0.000000)),
345 | ((0.143282, 0.000000), (0.108513, 0.068024)),
346 | ((0.108513, 0.068024), (0.074722, 0.133433)),
347 | ((0.074722, 0.133433), (0.045456, 0.193715)),
348 | ((0.045456, 0.193715), (0.023014, 0.246553)),
349 | ((0.023014, 0.246553), (0.008293, 0.289916)),
350 | ((0.008293, 0.289916), (0.000812, 0.322137)),
351 | ((0.000812, 0.322137), (-0.001101, 0.341979)),
352 | ((-0.001101, 0.341979), (0.000000, 0.348679)),
353 | ((0.001102, 0.341979), (-0.000812, 0.322137)),
354 | ((0.000000, 0.313811), (-0.002176, 0.307781)),
355 | ((-0.006740, 0.289923), (-0.015693, 0.260924)),
356 | ((-0.015693, 0.260924), (-0.030307, 0.221898)),
357 | ((-0.030307, 0.221898), (-0.050868, 0.174344)),
358 | ((-0.050868, 0.174344), (-0.076523, 0.120090)),
359 | ((-0.076523, 0.120090), (-0.105274, 0.061222)),
360 | ((-0.105274, 0.061222), (-0.134115, 0.000000)),
361 | ((-0.134115, 0.000000), (-0.159311, -0.061221)),
362 | ((-0.159311, -0.061221), (-0.176822, -0.120090)),
363 | ((-0.176822, -0.120090), (-0.182837, -0.174344)),
364 | ((-0.182837, -0.174344), (-0.174395, -0.221898)),
365 | ((-0.174395, -0.221898), (-0.150039, -0.260924)),
366 | ((-0.150039, -0.260924), (-0.110412, -0.289923)),
367 | ((-0.110412, -0.289923), (-0.058606, -0.307781)),
368 | ((-0.058606, -0.307781), (0.000001, -0.313811)),
369 | ((0.000001, -0.313811), (0.058607, -0.307781)),
370 | ((0.058607, -0.307781), (0.110413, -0.289923)),
371 | ((0.110413, -0.289923), (0.150040, -0.260924)),
372 | ((0.150040, -0.260924), (0.174396, -0.221898)),
373 | ((0.174396, -0.221898), (0.182838, -0.174344)),
374 | ((0.182838, -0.174344), (0.176823, -0.120090)),
375 | ((0.176823, -0.120090), (0.159312, -0.061221)),
376 | ((0.159312, -0.061221), (0.134116, 0.000000)),
377 | ((0.134116, 0.000000), (0.105275, 0.061221)),
378 | ((0.105275, 0.061221), (0.076524, 0.120090)),
379 | ((0.076524, 0.120090), (0.050869, 0.174344)),
380 | ((0.050869, 0.174344), (0.030308, 0.221898)),
381 | ((0.030308, 0.221898), (0.015694, 0.260924)),
382 | ((0.015694, 0.260924), (0.006741, 0.289923)),
383 | ((0.006741, 0.289923), (0.002177, 0.307781)),
384 | ((0.002177, 0.307781), (0.000000, 0.313811)),
385 | ((-0.002176, 0.307781), (-0.006740, 0.289923)),
386 | ((0.000000, 0.282430), (-0.004523, 0.277003)),
387 | ((-0.010923, 0.260931), (-0.020753, 0.234832)),
388 | ((-0.020753, 0.234832), (-0.034967, 0.199708)),
389 | ((-0.034967, 0.199708), (-0.053702, 0.156910)),
390 | ((-0.053702, 0.156910), (-0.076158, 0.108081)),
391 | ((-0.076158, 0.108081), (-0.100606, 0.055100)),
392 | ((-0.100606, 0.055100), (-0.124502, 0.000000)),
393 | ((-0.124502, 0.000000), (-0.144742, -0.055099)),
394 | ((-0.144742, -0.055099), (-0.158020, -0.108081)),
395 | ((-0.158020, -0.108081), (-0.161283, -0.156909)),
396 | ((-0.161283, -0.156909), (-0.152248, -0.199708)),
397 | ((-0.152248, -0.199708), (-0.129919, -0.234832)),
398 | ((-0.129919, -0.234832), (-0.095030, -0.260931)),
399 | ((-0.095030, -0.260931), (-0.050251, -0.277003)),
400 | ((-0.050251, -0.277003), (0.000001, -0.282430)),
401 | ((0.000001, -0.282430), (0.050252, -0.277003)),
402 | ((0.050252, -0.277003), (0.095031, -0.260931)),
403 | ((0.095031, -0.260931), (0.129920, -0.234832)),
404 | ((0.129920, -0.234832), (0.152249, -0.199708)),
405 | ((0.152249, -0.199708), (0.161284, -0.156909)),
406 | ((0.161284, -0.156909), (0.158021, -0.108081)),
407 | ((0.158021, -0.108081), (0.144743, -0.055099)),
408 | ((0.144743, -0.055099), (0.124503, 0.000000)),
409 | ((0.124503, 0.000000), (0.100607, 0.055099)),
410 | ((0.100607, 0.055099), (0.076159, 0.108081)),
411 | ((0.076159, 0.108081), (0.053703, 0.156909)),
412 | ((0.053703, 0.156909), (0.034968, 0.199708)),
413 | ((0.034968, 0.199708), (0.020754, 0.234832)),
414 | ((0.020754, 0.234832), (0.010924, 0.260931)),
415 | ((0.010924, 0.260931), (0.004524, 0.277003)),
416 | ((0.004524, 0.277003), (0.000000, 0.282430)),
417 | ((-0.004523, 0.277003), (-0.010923, 0.260931)),
418 | )
419 |
--------------------------------------------------------------------------------
/tests/data_svg/test_isect_crosshatch_01.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/data_svg/test_isect_bowtie_circle_01.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------