Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add arc/unclosed shape options to circle node #2434

Open
superlou opened this issue Mar 14, 2025 · 8 comments · May be fixed by #2470
Open

Add arc/unclosed shape options to circle node #2434

superlou opened this issue Mar 14, 2025 · 8 comments · May be fixed by #2470
Labels
Good First Issue Good for newcomers

Comments

@superlou
Copy link

I'm trying to use Graphite to generate sprite sheets for a circular progress indicator. Inkscape has the ability to specify a start and end angle for the stroke, creating an unclosed cirlce:

Image

Having node editor properties to set these in Graphite would allow using nodes to generate the different images, with the arc filling up to close the circle as the progress indicator gets to 100%.

@Keavon Keavon added the Good First Issue Good for newcomers label Mar 14, 2025
@github-project-automation github-project-automation bot moved this to Short-Term in Task Board Mar 14, 2025
@Keavon
Copy link
Member

Keavon commented Mar 14, 2025

Good idea! I'll need to think slightly about the design, and in particular how to distinguish between an empty and full circle which would both be represented by equal starting and ending angles (relevant if being animated). This should also probably have a choice between being an open path or a closed pie slice.

@superlou
Copy link
Author

Thanks for the consideration! Inkscape seems to have 3 ways of treating incomplete circles/ellipses:

Image

@Forchapeatl
Copy link

I would love to take this on. Please assign it to me

@Keavon
Copy link
Member

Keavon commented Mar 15, 2025

@Forchapeatl Go for it! Feel free to suggest ideas for the solution to the problem I mentioned in my previous comment for telling the difference between an empty and full circle, but you could begin working on it while we experiment with ideas. Regarding @superlou's previous post, I think we can skip the "chord" option because that is redundant compared to just applying a "Close Path" node, which we don't have yet but you could also add. We don't do issue assignments until a PR is ready to land, but feel free to comment here with your PR number once you have it opened to communicate to others that you have a work in progress PR for the task. Looking forward to your PR!

@Keavon
Copy link
Member

Keavon commented Mar 16, 2025

I think this solution will work for the angle question: instead of "start angle" and "stop angle", it can be "start angle" and "angular distance" which can be a positive or negative value that tells it how far from the start angle to go. A full circle would be a full 360°.

@Forchapeatl
Copy link

Forchapeatl commented Mar 17, 2025

Hi @Keavon , can we make modifications to these modifications

fn circle(_: impl Ctx, _primary: (), #[default(50.)] radius: f64, #[default(0.)] start_angle: f64, #[default(360.)] angular_distance: f64) -> VectorDataTable {
    let arc_path = Subpath::new_arc(DVec2::splat(-radius), DVec2::splat(radius), start_angle, start_angle + angular_distance);
    VectorDataTable::new(VectorData::from_subpath(arc_path))
}

to

fn circle(_: impl Ctx, _primary: (), #[default(50.)] radius: f64) -> VectorDataTable {
VectorDataTable::new(VectorData::from_subpath(Subpath::new_ellipse(DVec2::splat(-radius), DVec2::splat(radius))))
}

? so that graphite Creates an arc based on the start angle and angular distance.

The documentation talks about the npm frontend build . With my little rust knowledge , I haven't found much information about building and testing the Rust backend . Please help me.

@optozorax
Copy link

Revelant info from the discord: You can't create any shape which is not bezier curves. This is why circle is an approximated using bezier curves with link to some very large article. Also, even if I want to hack this, it's still impossible, since you can't create segment without a bezier handles. So in order to do this task one need to implement it using bezier curves

Algorithm for a bezier arc is here: https://github.com/GraphiteEditor/Graphite/blob/master/editor/src/messages/portfolio/document/overlays/utility_types.rs#L275

@Keavon
Copy link
Member

Keavon commented Mar 18, 2025

@Forchapeatl did you read and follow all the instructions in the contributor guide that you linked? It should cover all your questions about setting up the project. If you need more help, please first attempt to research your troubles and if that doesn't solve it, reach out on our Discord for further assistance (issues aren't a good format for troubleshooting).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Good First Issue Good for newcomers
Projects
Status: Short-Term
Development

Successfully merging a pull request may close this issue.

4 participants