Skip to content

Bezier-rs: Add joins and caps to offsets and outlines - #1083

Merged
hannahli2010 merged 11 commits into
masterfrom
bezier-rs-join-caps
Mar 27, 2023
Merged

hannahli2010 merged 11 commits into
masterfrom
bezier-rs-join-caps

Conversation

@hannahli2010

Copy link
Copy Markdown
Contributor
  • Add the following caps: Butt, Round, and Square

  • Add the following joins: Bevel, Miter, Round

  • Handle bad offset cases where the object being offset was essentially a single point

  • Fix issue with attempting to normalize a zero vector

  • Change reduced_curves_and_t_values to return pairs of t values

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 18, 2023

Copy link
Copy Markdown

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 14ec93e
Status: ✅  Deploy successful!
Preview URL: https://a625e87e.graphite.pages.dev
Branch Preview URL: https://bezier-rs-join-caps.graphite.pages.dev

View logs

@Androxium

Copy link
Copy Markdown
Contributor

It looks really good! A really small nit I found was with the inner outline generated, at certain distances, it doesn't look like they connect at a point, looks like they overlap just barely. This screenshot was taken at 250% zoom so the misalignment is exaggerated. I think the current level of precision is fine, I just wanted to point this out.

Screenshot from 2023-03-19 17-37-58

@RobNadal RobNadal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for all the effort you put into this feature @hannahli2010, looks amazing!

Comment thread libraries/bezier-rs/src/subpath/solvers.rs Outdated
Comment thread libraries/bezier-rs/src/subpath/solvers.rs
Comment thread libraries/bezier-rs/src/subpath/solvers.rs
Comment thread libraries/bezier-rs/src/subpath/solvers.rs Outdated
Comment thread libraries/bezier-rs/src/subpath/solvers.rs Outdated
Comment thread libraries/bezier-rs/src/subpath/transform.rs Outdated
Comment thread libraries/bezier-rs/src/subpath/transform.rs Outdated
Comment thread libraries/bezier-rs/src/subpath/transform.rs Outdated
Comment thread libraries/bezier-rs/src/utils.rs
Comment thread libraries/bezier-rs/src/bezier/transform.rs Outdated
Comment thread libraries/bezier-rs/src/bezier/core.rs Outdated
Comment thread libraries/bezier-rs/src/subpath/transform.rs Outdated
@hannahli2010
hannahli2010 marked this pull request as ready for review March 25, 2023 19:10
@hannahli2010
hannahli2010 requested a review from Keavon March 25, 2023 19:10
@Keavon Keavon mentioned this pull request Mar 26, 2023

@Keavon Keavon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please resolve the comments and merge conflicts, then you're good to merge. Nice work!

Comment thread libraries/bezier-rs/src/bezier/core.rs Outdated
Comment thread website/other/bezier-rs-demos/src/features/subpath-features.ts Outdated
Comment thread libraries/bezier-rs/src/bezier/transform.rs
let normalized_in_tangent = in_tangent.normalize();
let normalized_out_tangent = out_tangent.normalize();

// The tangents must not be parallel for the miter join

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you also implement https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit please? We need this in Graphite.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm planning to implement this in a different PR so that we can merge this one first.

I'm thinking of adding this feature via an additional optional param on offset and outline - does that sound alright to you @Keavon ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good, and that is probably the best way to add it to the API.

@hannahli2010
hannahli2010 merged commit 93821f3 into master Mar 27, 2023
@hannahli2010
hannahli2010 deleted the bezier-rs-join-caps branch March 27, 2023 20:25
Keavon pushed a commit that referenced this pull request Jul 30, 2023
* Intial work

* Improve miter and add round join

* Get arcs to go opposite direction

* Add cap and other refactors

* Rename joint to join, fix some bugs

* Fix single point issue

* Clean up

* Fix iframe sizes and update UI

* Address comments and handle single point outline

* Rename variables, fix branches in outline

* Address comments
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.

4 participants