-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
textToPoints() to allow 2D Array of points within paths for separating letters #4086
Comments
A couple of questions:
|
1 – At the moment, each piece of a letter/glyph is simply handled as its own path in the first dimension of array, followed by their collection of points in the 2nd dimension. This is how it's handled in Geomerative (Processing library, where there's an example called 2 – Yup, it's using the exact same point extraction, so both of those options work smoothly. 3 – That was my question.. of course it's probably not ideal to have a different type of return... so I wondered if there was another function in the library that does so for documentation style guiding. At first I thought of having another function, but it would be 99% copy + paste code to then maintain... OR it's another function that passes a request to the |
Hope there's another function with multiple returns, as that might be smoothest implementation IMHO. Then having two additional options to |
@dhowe Yup, it's working fine with all special characters, since it's the same Here's an example for testing it out: |
Right - I guess I was thinking about how to do filled paths... but this is still not possible given the data returned (part 3 of your example). I suppose another option in terms of the API would be to keep the 1D array but separate each path by some constant value, maybe Number.NEGATIVE_INFINITY. This would allow a user to realize your example sketch, but not change the return type for the function (and not introduce a new function to the API). |
Yeah filled paths are tricky.. Just added a function to export glyphs too and learned that of course this works great for letters like Here's an example with a custom build for exporting glyphs too: I'd propose to have the two options:
Regarding the idea of sending a special flag whenever the path changes, might be smooth for just outlining the paths, though would still require special |
|
Here's a demo sketch: The demo hopefully shows how one more flexible per level of separation. Tried to simulate end of path 'flags' (faked it with For type experiments, this separation is really helpful... maybe want to only distort in 2nd path of a glyph.. or fade out letters per path in a glyph/string? Regarding the from:
to:
|
@lmccart could we get your insight for this How best to implement the return of points isolated within paths + glyphs for more precise typo experiments (request came from students):
Idea 1Extend the optional inputs:
So many semantic options... happy for better suggestions:
Idea 2Add 2 new functions that simply call the original function with additional options:
Concern is this might produce repeated documentation (since options are the same and require same description as the normal Personally I'm for option 1. Curious if there are other ideas? |
Hi all, interesting discussion here. We're focused on the priorities for the 1.0 release right now so I don't think I'll have the bandwidth to weigh in on this until after that's done. |
After a few recent messages asking about the status, here's an example, where the linked With 1.0 released 🎉– I'd like to bring this up again. To keep it a really modest modification, I'd suggest option 1 above, simply adding optional params to the existing function based on the level of detail/separation one wants from the type. Basic (current):
Options (current):
Separate Paths Option (proposed):
Separate Glyphs Option (proposed):
Examples would be given in the docs for each optional usage. |
Hi, I'm moving some discussion here from another issue! As someone who uses Typescript bindings, option 2 would have the benefit of being more easily typed (there are type overloads that one can use, but it means typing of the options argument would be required.) That said, TS support shouldn't be the priority, so I'll defer to someone else for picking between the two. @ffd8 thanks for writing your implementation, it works great! The one other thing I'd want to bring up is that, in 2D mode, if you want to fill the shapes, you'd have to rely on the even-odd fill rule in order to fill shapes with holes correctly. |
Nature of issue?
Most appropriate sub-area of p5.js?
Which platform were you using when you encountered this?
Feature enhancement details:
Preparing my first p5.js pull request, so making an issue first.
This will extend
textToPoints()
to allow the return of a 2D Array,[paths][points]
, since as a single array of points, there will always be a line drawn between the letters if placed within abegin/endShape()
.Figured the smoothest way to implement this, is adding it as an option when calling the function, and imagined that option to be
separatePaths : true
.Code is already done.. just have to read up on Docs for contributing and happy for feedback on PR.
The text was updated successfully, but these errors were encountered: