thelonious / kld-intersections

A library of intersection algorithms covering all SVG shape types
BSD 3-Clause "New" or "Revised" License
343 stars 55 forks source link

Another Case of no intersections for intersectBezier3Bezier3 Edge Case #35

Closed Shkyrockett closed 5 years ago

Shkyrockett commented 5 years ago

Hi, I ran across another weird intersection edge case for intersectBezier3Bezier3 that I thought you might be interested in.

Edge case

Here are the curves:

<path d="M150,150 C183.33333333333331,216.66666666666663 233.33333333333337,216.66666666666663 300,150"/>
<path d="M100,200 C166.66666666666663,133.33333333333337 233.33333333333337,133.33333333333337 300,200"/>
thelonious commented 5 years ago

Thanks for the heads up! It's interesting how multiples of 1/3 cause issues.

thelonious commented 5 years ago

Looks like I've already resolved this exact case:

https://github.com/thelonious/kld-intersections/blob/master/test/cubic-cubic-fail.js

When I run that example, I get the following SVG image:

image

And that has these intersections:

<circle cx="155.388" cy="159.951" r="2" stroke="red" fill="none"/>
<circle cx="271.264" cy="175.393" r="2" stroke="red" fill="none"/>

Maybe you're running an older version of the library? I tested with 0.4.3.