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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mitigate issue where outline thicknesses less than 0.5 fail out generate solid shapes not outlines #324

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

tocsoft
Copy link
Member

@tocsoft tocsoft commented Mar 8, 2024

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 馃懏.
  • I have provided test coverage for my change (where applicable)

Description

If the outline thickness is going to trigger the noop behaviour of the clipper then scale the inputs and outputs to not trigger that behaviour.

I tried just removing the test in PolygonOffsetter.cs but for some reason that causes very small outlines to take significantly longer to generate than scaling up and down. (not investigated why).

This causes everything to generally render now, what it renders at particularly small sizes might not be the best (not investigated) but at least we generally render something better than the solid shape.

resolves #323

if the outline thickness is going to trigger the noop behaviour of the clipper then scale the inout and output to no trigger that behaviour.
IEnumerable<ISimplePath> paths = path.Flatten();
width = CalculateScalingMatrix(width, out Matrix3x2 scaleUpMartrix, out Matrix3x2 scaleDownMartrix);

IEnumerable<ISimplePath> paths = path.Transform(scaleUpMartrix).Flatten();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we only do this if the path is < .5f? It seems like we're adding overhead to all outline generation now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transform(...) is a no op (returning the original IPath) for Matrix3x2.Identity which will be return for sizes >= 0.5.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah... Missed that. Looks good.

I'm hoping that once I get the new path stoker wired up this issue will go away.

Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely. Thanks!!

@JimBobSquarePants JimBobSquarePants merged commit 6b62e73 into main Mar 11, 2024
8 checks passed
@JimBobSquarePants JimBobSquarePants deleted the issue323 branch March 11, 2024 12:01
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

Successfully merging this pull request may close these issues.

DrawPolygon with a thickness of less that 0.5 fills produces a filled polygon instead of a outline
2 participants