FlorisSteenkamp/MAT

Invalid mat/sat information for a character

Closed this issue · 6 comments

I am getting invalid sat structure for following svg path.
M130.26 0C130.26 0 142.26 0 142.26 0C142.26 0 145.69-3.43 145.69-3.43C145.69-3.43 145.69-12 145.69-12C145.69-12 144.83-12.86 144.83-12.86C144.83-12.86 145.68-13.71 145.68-13.71C145.68-13.71 145.69-13.71 145.69-13.71C145.69-13.71 145.69-20.57 145.69-20.57C145.69-20.57 142.26-24 142.26-24C142.26-24 130.26-24 130.26-24C130.26-24 128.55-22.28 128.55-22.28C128.55-22.28 128.55-17.14 128.55-17.14C128.55-17.14 133.69-17.14 133.69-17.14C133.69-17.14 133.69-18 133.69-18C133.69-18 134.55-18.86 134.55-18.86C134.55-18.86 138.83-18.86 138.83-18.86C138.83-18.86 140.55-17.14 140.55-17.14C140.55-17.14 138.83-15.43 138.83-15.43C138.83-15.43 135.40-15.43 135.40-15.43C135.40-15.43 135.40-10.28 135.40-10.28C135.40-10.28 138.83-10.28 138.83-10.28C138.83-10.28 140.55-8.57 140.55-8.57C140.55-8.57 140.55-6.86 140.55-6.86C140.55-6.86 138.83-5.14 138.83-5.14C138.83-5.14 134.55-5.14 134.55-5.14C134.55-5.14 133.69-6 133.69-6C133.69-6 133.69-6.86 133.69-6.86C133.69-6.86 128.55-6.86 128.55-6.86C128.55-6.86 128.55-1.71 128.55-1.71C128.55-1.71 130.26 0 130.26 0Z
The path seems to be valid shape.
image

reason behind the issue seems unusually large disk that was in the mat structure.
image

Hi. Thanks for the bug report. It shouldn't fail for any shape, especially a really mild one like this but you're right, it does seem to fail. I'm currently on holiday till Tuesday but will have a look at it and certainly a fix a day or two later.

Looking at the SVG, one obvious thing that is likely to remedy the situation in the meantime is to convert all those cubics to straight lines as a temporary solution.

Hi @FlorisSteenkamp Thanks for response found another issue for similar shape this time its not even generating mats.

Path for shape M22.28 0C22.28 0 27.42 0 27.42 0C27.42 0 27.42-0.86 27.42-0.86C27.42-0.86 28.28 0 28.28 0C28.28 0 35.99 0 35.99 0C35.99 0 39.42-3.43 39.42-3.43C39.42-3.43 39.42-12 39.42-12C39.42-12 35.99-15.43 35.99-15.43C35.99-15.43 29.14-15.43 29.14-15.43C29.14-15.43 27.42-17.14 27.42-17.14C27.42-17.14 29.14-18.86 29.14-18.86C29.14-18.86 33.42-18.86 33.42-18.86C33.42-18.86 34.28-18 34.28-18C34.28-18 34.28-17.14 34.28-17.14C34.28-17.14 39.42-17.14 39.42-17.14C39.42-17.14 39.42-24 39.42-24C39.42-24 34.28-24 34.28-24C34.28-24 34.28-23.14 34.28-23.14C34.28-23.14 33.42-24 33.42-24C33.42-24 25.71-24 25.71-24C25.71-24 22.28-20.57 22.28-20.57C22.28-20.57 22.28-13.71 22.28-13.71C22.28-13.71 25.71-10.28 25.71-10.28C25.71-10.28 32.57-10.28 32.57-10.28C32.57-10.28 34.28-8.57 34.28-8.57C34.28-8.57 34.28-6.86 34.28-6.86C34.28-6.86 32.57-5.14 32.57-5.14C32.57-5.14 28.28-5.14 28.28-5.14C28.28-5.14 27.42-6 27.42-6C27.42-6 27.42-6.86 27.42-6.86C27.42-6.86 22.28-6.86 22.28-6.86C22.28-6.86 22.28 0 22.28 0Z
image

getting error " Cannot read properties of undefined (reading 'circle')"
this time its failing at getting all the Three prongs, didn't looked much further but maybe the root cause is same.
image

Yeah, I think it's the same root cause and it's got something to do with the fact that straight lines are represented as cubics.

Ok, it's fixed now.

It was a discrete bug indeed related to the fact that straight lines are represented as cubics in your SVG. The path is pre-processed and cubics masquerading as lines are converted to lines (otherwise infinities can occur in the math) but this was done wrong in edge cases due to a comparison test that first had to take the absolute value which it didn't.

Please let me know if this fixes it for you.

Thanks!
Will check and let you know.