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

Offset needs to be scaled? #15

Open
diegogangl opened this issue Feb 9, 2018 · 2 comments
Open

Offset needs to be scaled? #15

diegogangl opened this issue Feb 9, 2018 · 2 comments

Comments

@diegogangl
Copy link

It seems that when trying to execute an offset, you need to scale the value according to the scale of the coordinates (the original, before calling scale_to_clipper())

I have a set of coordinates that look like this:

(0.02196335606276989, 0.025453664362430573), 
(0.021962668746709824, 0.02545437589287758), 
(0.021961797028779984, 0.025455275550484657)

Passing -7.0 to PyclipperOffset as the docs suggest doesn't affect the path at all. I have to use a rather large number instead:

solution = pco.Execute(1500.0 ** 2)

Not sure whether this is a bug or a detail that may have escaped me, but I couldn't find anything about scaling the offset on the docs. It seems the offset depends on the path size too? For larger paths (300 meters in scale) I had to use 5000 ** 3 before seeing any change.

@diegogangl
Copy link
Author

I found out that the offset's value has to be multiplied by the scale's default parameter (2**31). And since I was trying to get sizes in mm with a coordinate system in meters, I also have to multiply it by 0.001 first. Feel free to close this if it's not a bug.

@ktrussell
Copy link

I see this same issue. If I do not use scale_to_clipper and scale_from_clipper, then the offset amount is applied as it should be to the polygon. If I scale the polygon, I have to scale the offset.

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

2 participants