-
Notifications
You must be signed in to change notification settings - Fork 145
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
#35 Implement miter_limit_join #192
Conversation
Hey @nical , feel free to tell me if:
Thaks a lot :D |
ea09287
to
c96c44f
Compare
|
I guess I'm almost there, still need to handle a weird glitch on the top left corner: In all screenshots I build the following example path :
BTW I'd love to add some tests to it, but I dont' really know If it's relevant, and how to proceed ^^' |
tessellation/src/path_stroke.rs
Outdated
advancement: self.length, | ||
side: front_side, | ||
} | ||
); |
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.
nit: let's use block indentation here, like this:
let v = add_vertex!(
self,
Vertex {
position: self.current,
normal: normal,
advancement: self.length,
side: front_side,
}
);
tessellation/src/path_stroke.rs
Outdated
back_vertex: VertexId, | ||
normal: Vec2, | ||
) -> (VertexId, VertexId) { | ||
if self.miter_limit_is_exceeded(normal) { |
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.
nit: really a minor thing but I tend to prefer when the complex code is out of the nested blocks, for example:
if condition {
// complicated stuff
return ...
}
return simple_stuff()
could be implemented like:
if !condition {
return simple_stuff()
}
// complicated stuff
return ...
It helps with keeping the cyclomatic complexity low (what a scary word!) and and in my experience the code looks a tad less intimidating that way.
Yeah, I have put a lot of focus on the fill tessellator so the latter has a pretty great test coverage but it would be good to start thinking about what kind of testing would be useful for the stroke tessellator. |
I have to do an other pass checking for unused variables + silly stuff that could be optimized away, but I feel like it should work fine :) |
There might still be something wrong though, since I don't really understand the "neg_if_right" part of the bevel implementation, so I did not use it (and I might mix up start_vertex and end_vertex i guess?) |
ac8ff9f
to
7e28611
Compare
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.
Looks good!
(v, v) | ||
self.tessellate_miter_join( | ||
front_side, | ||
normal |
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.
Oops actually there was a bug here: this should be front_normal instead of normal, I'll land a quick fix.
This is Working on a function signature, before miter_limit_join_implementation (and tests).
I guess I should remove the magic number 4, to use an enum or something instead.
This should handle #35 some day x)