Closed MacTuitui closed 4 years ago
From mactuitui:
ok I’ve got the best example possible:
let pts = [Vector2 { x: 515.85266, y: -452.88187 }, Vector2 { x: 521.897, y: -435.09717 }, Vector2 { x: 515.93286, y: -452.64264 }, Vector2 { x: 515.85266, y: -452.88187 }]; draw.polygon().points(pts.iter().map(|p| *p*0.6)).color(WHITE);
it crashes nannou directly on my machine
Ok progress here! (I really end up on this bug a lot when dealing with shrinking shapes!!!)
I think that in src/draw/primitive/polygon.rs
at line 120, when lyon does the tessellation, you check if you get an error, but here, for my specific example, lyon gives the following:
Ok(Count { vertices: 2, indices: 0 })
instead of Ok(Count { vertices: 3, indices: 3 })
when I change the points to something that is meaningfull to draw.
Since you then use this information to extend
the mesh, it looks like since the vertices count does not match the indices count at the end, it provokes the no color for vertex
error as the lengths do not match.
Would it make sense to maybe ignore the tessellation result when the vertices count does not match the indices count? I'll also look into lyon to see if that's the expected answer.
Lyon on 0.15.6 does produce a nice tessellation result for the same shape, so maybe an update to 0.15 might be the better solution!
Just tested locally now that we've updated to lyon 0.15 and it seems to be working nicely:
Going to close this now, but feel free to re-open if you run into the same issue again!
Closed via #484
I have what I think might be a bug in either kow lyon handles weird shapes and how nannou handles lyon's failures.
When you draw the
polyline
it works as expected, but changing it topolygon
fails with:The same code works when you change the
scale
tolet scale = ((frac_i*TAU).sin()).powf(3.0);
and it looks like what I think is the correct answer.