-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Implement proper fill rendering for vector meshes #3474
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
Implement proper fill rendering for vector meshes #3474
Conversation
|
!build |
|
|
||
| # Optional workspace dependencies | ||
| serde = { workspace = true, optional = true } | ||
| fixedbitset = "0.5.7" |
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.
Not sure what the process is for adding dependencies -- I saw fixedbitset is a dependency of petgraph so I thought it would probably be OK to bring in; I can easily swap it out for a Vec:: or similar
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.
@TrueDoctor can you give your thoughts on this please?
|
|
Update -- looks like some fills still aren't working; probably going to take a lot of debug logging to figure out. Will take another look tomorrow |
| let tangent = deriv.eval(t); | ||
| DVec2 { x: tangent.x, y: tangent.y } |
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.
If the handle is placed on top of the anchor then this will be zero.
For reference, here is my impl of the tangent at start which attempts to avoid reporting zero length tangents:
Graphite/node-graph/libraries/vector-types/src/vector/algorithms/bezpath_algorithms.rs
Lines 704 to 724 in 06749ec
| /// Compute the tangent at t=0 for the path segment | |
| pub fn tangent_at_start(segment: kurbo::PathSeg) -> kurbo::Vec2 { | |
| let tangent = match segment { | |
| kurbo::PathSeg::Line(line) => (line.p1 - line.p0).normalize(), | |
| kurbo::PathSeg::Quad(quad_bez) => { | |
| let first = (quad_bez.p1 - quad_bez.p0).normalize(); | |
| if first.is_finite() { first } else { (quad_bez.p2 - quad_bez.p0).normalize() } | |
| } | |
| kurbo::PathSeg::Cubic(cubic_bez) => { | |
| let first = (cubic_bez.p1 - cubic_bez.p0).normalize(); | |
| if first.is_finite() { | |
| first | |
| } else { | |
| let second = (cubic_bez.p2 - cubic_bez.p0).normalize(); | |
| if second.is_finite() { second } else { (cubic_bez.p3 - cubic_bez.p0).normalize() } | |
| } | |
| } | |
| }; | |
| debug_assert!(tangent.is_finite(), "cannot round corner with NaN tangent {segment:?}"); | |
| tangent | |
| } |
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.
Yep -- I special-cased tangent_at_start and tangent_at_end for each type of segment but then didn't actually call into them on the match case.
I didn't think of the "find the first non-overlapping control point" strategy though; that's a good call that I addressed on revision.
|
!build |
|
Closes #3378
Didn't want to have to deal with working off of @iamthenoname repo so I made a new set of commits.
@0HyperCube Thanks for all the feedback!