Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlapping/excessive triangles #23

Closed
evilfunnybird opened this issue Apr 2, 2022 · 15 comments
Closed

Overlapping/excessive triangles #23

evilfunnybird opened this issue Apr 2, 2022 · 15 comments

Comments

@evilfunnybird
Copy link

So, whenever I try to triangulate an image, there is a problem with some random triangles that are drawn above the necessary ones. Sometimes they are a something like a line, and sometimes they are gigantic. I tried to change value of all of the parameters/flags but no luck.
In the attached files is the source and generated images with flags: -pts 5000 -blur 1.

173
173
img31
img31

@esimov
Copy link
Owner

esimov commented Apr 3, 2022

I might try to resolve it but it can be a tricky one.

@evilfunnybird
Copy link
Author

The thing is, wierd triangles are actually overlapping (there are "normal" triangles underneath) and they are not in the end af the generated file (if they were, I could've just not include them, but figuring out excessive triangles sounds like a resourse-intensive task)

@esimov
Copy link
Owner

esimov commented Apr 4, 2022

I assume you analyzed the svg version.

@evilfunnybird
Copy link
Author

A little bit, yeah, since I parse it to get triangles for a thing I'm making

@pjebs
Copy link

pjebs commented Apr 6, 2022

facemask

I have the same issue. I don't use any svg features.

@esimov
Copy link
Owner

esimov commented Apr 6, 2022

I was asking because you mentioned that the there are normal triangles underneath the artifacts. Meantime I have checked also myself and that's correct. I don't know yet why, but I will try to debug to understand why this is happening.

@pjebs
Copy link

pjebs commented Apr 6, 2022

facemask

Here's an extreme example.

@pjebs
Copy link

pjebs commented Apr 6, 2022

I'm going to assume there was a regression in a recent update to the code. Perhaps in the last year. Because I think you would have seen this effect when you first wrote the package.

@esimov
Copy link
Owner

esimov commented Apr 6, 2022

I restored back to a few commit points to see if these artifacts are still present in the previous versions. Unfortunately this issue is present on the earliest versions too, but they are showing only occasionally.

@evilfunnybird
Copy link
Author

So, by any chance, do you have an idea, what might cause this issue? For testing purposes I additionally ran this in single and multi thread and with different options, still no luck.

esimov added a commit that referenced this issue Apr 16, 2022
@esimov
Copy link
Owner

esimov commented Apr 16, 2022

I'm sorry for the late response, it was a tricky bug to capture, because it happened only occasionally. The reason was due to wrong type conversion. Because in almost any part of the code base the conversion was from float to int, it happened that in the renamed polygon.go file I used integers instead of floats and this affected the end results. During the debugging session I realized that the API does not stand up from the architecture point of view so I have refactored completely the code and also extended with additional features in order to be even more customizable, which results in a more appealing visual output. But this in the next release, which is coming soon.

@esimov
Copy link
Owner

esimov commented Apr 16, 2022

Here is an example of using the old method and the new one.

triangle_old
triangle_new

@esimov
Copy link
Owner

esimov commented Apr 19, 2022

I have published a new v1.3.0 release, which as I mentioned now has a completely rewritten API, new logic for a better visual output, extended CLI options for a more advanced customization etc. If you don't have any objections I will close this issue.

@evilfunnybird
Copy link
Author

So, indeed, the new version resolved this issue, thank you

@evilfunnybird
Copy link
Author

One more bonus to 1.3.0 - svg files are more compact now (for me it's like 20-30%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants