# Stroke Curve System #99784

Open
opened 2022-07-17 01:59:43 +02:00 by Joseph Eagar · 2 comments
Collaborator

We need a better system for building stroke curves. In the long term we need a better system if we want to support stroke interpolation and the like. A more immediate problem is scene spacing mode, which is quite broken.

Ideally the paint code would build a spline which it would sample uniformly to create the stroke. This spline should be arc length parameterized (look up tables work great for this). We might also want to look at using polynomial clothoids (similar to Inkscape's spiros), as those are somewhat better at representing human drawing curves. For that reason we should use an abstract interface. This will also make the code cleaner.

Here's an example of an abstract spline segment class:

``````template<vec> SplineSegment {
float length();

/* s is arc length along curve segment. */
vec evaluate(float s);

vec derivative(float s);
vec derivative2(float s);
vec normal(float s);

vec closest_point(vec p, float &r_dist);
};
``````
``````
``````
We need a better system for building stroke curves. In the long term we need a better system if we want to support stroke interpolation and the like. A more immediate problem is scene spacing mode, which is quite broken. Ideally the paint code would build a spline which it would sample uniformly to create the stroke. This spline should be arc length parameterized (look up tables work great for this). We might also want to look at using polynomial clothoids (similar to Inkscape's spiros), as those are somewhat better at representing human drawing curves. For that reason we should use an abstract interface. This will also make the code cleaner. Here's an example of an abstract spline segment class: ``` template<vec> SplineSegment { float length(); /* s is arc length along curve segment. */ vec evaluate(float s); vec derivative(float s); vec derivative2(float s); vec normal(float s); vec closest_point(vec p, float &r_dist); }; ``` ``` ```
Poster
Collaborator

added this to the Sculpt, Paint & Texture project 2023-02-08 10:20:48 +01:00
removed the label 2023-02-10 09:11:14 +01:00
removed the label 2023-08-24 17:37:35 +02:00
No Label
No Milestone
No project
No Assignees
2 Participants