-
Notifications
You must be signed in to change notification settings - Fork 275
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
One-sided offset with EndType::ButtLeft #905
Conversation
Hi @AngusJohnson,
The additional logic in OffsetPoint solves this problem: To my knowledge this is not solvable by a FillRule so i went with calculation the intersection point. |
const bool intersect = | ||
end_type_ == EndType::ButtLeft // one-sided offset | ||
&& cos_a < 0 // < 90 degre | ||
&& !path_out.empty() // safety check, can this never happen? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think path_out can never by empty at this point, but i'm not 100% sure.
end_type_ == EndType::ButtLeft // one-sided offset | ||
&& cos_a < 0 // < 90 degre | ||
&& !path_out.empty() // safety check, can this never happen? | ||
&& l < path.size(); // safety check, can this never happen? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basicely j must never be the last or first point, depending on direction given by the relation between k and j.
It seems given to me, but again i'm not 100% sure.
@@ -398,16 +429,23 @@ void ClipperOffset::OffsetOpenPath(Group& group, const Path64& path) | |||
case EndType::Round: | |||
DoRound(path, 0, 0, PI); | |||
break; | |||
case EndType::ButtLeft: | |||
left_end = Point64(GetPerpendicD(path[0], norms[0], -abs_group_delta)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this can be done more elegant later.
I discovered further major challenges, closing for now. |
Implement a one-sided offset by extending the EndType with ButtLeft.