1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-31 07:44:22 +03:00

Path intersection was not checking paths with circles. (#1229)

As an optimization the path intersection was checking the paths had three or more elements, caliming that otherwise there was nothing to fill. However a semi circle would actually contain 2 points.

Fixes #1048.

This adds a simplified test case for the 2 offending files reported in the issue.
This commit is contained in:
Sebastian Kreft
2021-02-17 17:50:08 -03:00
committed by GitHub
parent 814863bcd2
commit c9a3aea858
3 changed files with 39 additions and 2 deletions

View File

@ -0,0 +1,19 @@
<svg xmlns="http://www.w3.org/2000/svg" width="499.25" height="732.44">
<g fill="#ffe900" fill-rule="evenodd" stroke="#1b1918">
<g stroke-width="2.52">
<path d="M373.27 534.98c-8.092-54.74-4.391-98.636 56.127-90.287 77.894 55.595-9.147 98.206-5.311 151.74 21.027 45.08 17.096 66.495-7.512 68.302-17.258 10.998-32.537 13.238-46.236 8.48-.246-1.867-.69-3.845-1.368-5.94l-19.752-40.751c44.709 19.982 82.483-.171 51.564-24.28zm32.16-40.207c-5.449-9.977 3.342-14.397 8.048-3.55 12.4 31.857 6.043 40.206-16.136 72.254l-1.911-2.463c11.558-13.292 20.249-27.75 21.334-39.194.899-9.481-5.973-16.736-11.335-27.048z"/>
<path d="M407.72 580.04c40.745 49.516-3.991 92.385-40.977 82.64"/>
</g>
</g>
</svg>
@@@
<svg xmlns="http://www.w3.org/2000/svg" width="499.25" height="732.44">
<g fill="#ffe900" fill-rule="evenodd" stroke="#1b1918">
<g stroke-width="2.52">
<path d="M373.27 534.98c-8.092-54.74-4.391-98.636 56.127-90.287 77.894 55.595-9.147 98.206-5.311 151.74 21.027 45.08 17.096 66.495-7.512 68.302-17.258 10.998-32.537 13.238-46.236 8.48-.246-1.867-.69-3.845-1.368-5.94l-19.752-40.751c44.709 19.982 82.483-.171 51.564-24.28zm32.16-40.207c-5.449-9.977 3.342-14.397 8.048-3.55 12.4 31.857 6.043 40.206-16.136 72.254l-1.911-2.463c11.558-13.292 20.249-27.75 21.334-39.194.899-9.481-5.973-16.736-11.335-27.048z"/>
<path d="M407.72 580.04c40.745 49.516-3.991 92.385-40.977 82.64"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1221.3" height="1297.3" viewBox="0 0 1145 1216.2">
<g stroke="gray" stroke-width="1.46">
<path d="M2236.1 787.25c6.625.191 11.52.01 11.828-2.044-8.189-9.2 8.854-46.86-11.828-48.722-17.83 3.99-6.438 26.66-11.828 48.722-.133 2.352 7.537 2.028 11.828 2.044z" transform="matrix(-.02646 -1.4538 -1.2888 .02985 1465.1 3284.4)"/>
<path d="M2243.9 787.13c-7.561-19.76 6.33-43.05-7.817-50.642" transform="matrix(-.02646 -1.4538 -1.2888 .02985 1465.1 3284.4)"/>
<path d="M2238.8 787.31c-4.873-19.48 2.772-37.1-2.667-50.82" transform="matrix(-.02646 -1.4538 -1.2888 .02985 1465.1 3284.4)"/>
<path d="M2228.3 787.13c4.104-21.9-3.13-44.68 7.817-50.642" transform="matrix(-.02646 -1.4538 -1.2888 .02985 1465.1 3284.4)"/>
<path d="M2233.4 787.31c-.692-5.383-1.098-39.17 2.667-50.82" transform="matrix(-.02646 -1.4538 -1.2888 .02985 1465.1 3284.4)"/>
</g>
</svg>
@@@
<svg xmlns="http://www.w3.org/2000/svg" width="1221.3" height="1297.3" viewBox="0 0 1145 1216.2">
<g stroke="gray" stroke-width="1.46">
<path d="M2236.1 787.25c6.625.191 11.52.01 11.828-2.044-8.189-9.2 8.854-46.86-11.828-48.722-17.83 3.99-6.438 26.66-11.828 48.722-.133 2.352 7.537 2.028 11.828 2.044z" transform="matrix(-.02646 -1.4538 -1.2888 .02985 1465.1 3284.4)"/>
<path d="M2243.9 787.13c-7.561-19.76 6.33-43.05-7.817-50.642" transform="matrix(-.02646 -1.4538 -1.2888 .02985 1465.1 3284.4)"/>
<path d="M2238.8 787.31c-4.873-19.48 2.772-37.1-2.667-50.82M2228.3 787.13c4.104-21.9-3.13-44.68 7.817-50.642" transform="matrix(-.02646 -1.4538 -1.2888 .02985 1465.1 3284.4)"/>
<path d="M2233.4 787.31c-.692-5.383-1.098-39.17 2.667-50.82" transform="matrix(-.02646 -1.4538 -1.2888 .02985 1465.1 3284.4)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB