Skip to content

Path support - #536

Merged
laurmaedje merged 5 commits into
typst:mainfrom
SekoiaTree:paths
Apr 6, 2023
Merged

laurmaedje merged 5 commits into
typst:mainfrom
SekoiaTree:paths

Conversation

@SekoiaTree

Copy link
Copy Markdown
Contributor

Supersedes #333

Related to #260

This PR adds support for path, a function much like polygon. The main difference is that it is not always closed, and that there is curvature support.

Every vertex can be written in one of three ways:

  • (10pt, 10pt) or ((10pt, 10pt)) makes a point who's control points are on itself
  • ((10pt, 10pt), (10pt, 0pt)) makes a point who's arriving control point (when the line goes towards this point) is 20pt, 10pt and who's leaving control point is 0pt, 10pt (the same point mirrored through the vertex itself)
  • ((10pt, 10pt), (10pt, 0pt), (20pt, 0pt)) makes a point who's arriving control point is 20pt, 10pt and who's leaving control point is 30pt, 10pt

This is not an incredible API, but it's consistent and users can create (or it can be part of the standard library) better methods over it, such as more svg-like controls (with curveto, moveto, and such).

@SekoiaTree SekoiaTree mentioned this pull request Apr 2, 2023
@Enivex Enivex mentioned this pull request Apr 4, 2023

@laurmaedje laurmaedje 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.

just some minor nits and a remark about the default stroke. also: could you run cargo fmt and wrap doc comments at column 80? (I know, I should check this in CI if I want it ...)

Comment thread library/src/visualize/path.rs Resolved
Comment thread library/src/visualize/path.rs Resolved
Comment thread library/src/visualize/path.rs Resolved
Comment thread library/src/visualize/path.rs Resolved
Comment thread library/src/visualize/path.rs Resolved
Comment thread library/src/visualize/path.rs Resolved
Comment thread library/src/visualize/path.rs Resolved
@SekoiaTree

Copy link
Copy Markdown
Contributor Author

Sure, I'll do all that. Can't do that today though, I'll do it tomorrow

@laurmaedje
laurmaedje merged commit 52b92a9 into typst:main Apr 6, 2023
@birktj birktj mentioned this pull request Apr 7, 2023
@SekoiaTree
SekoiaTree deleted the paths branch August 7, 2023 19:48
Dikluwe pushed a commit to Dikluwe/typst-crystalline that referenced this pull request Sep 12, 2026
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.

2 participants