mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
wg_engine: fix cubic generation artifacts (GradientStroke example)
[GradientStroke](https://github.com/thorvg/thorvg/issues/2435) example More accurate coefitient computation
This commit is contained in:
parent
8d150a17b4
commit
e16dcdcb6d
1 changed files with 1 additions and 3 deletions
|
@ -93,9 +93,7 @@ void WgPolyline::appendCubic(WgPoint p1, WgPoint p2, WgPoint p3, size_t nsegs)
|
|||
WgPoint p0 = pts.count > 0 ? pts.last() : WgPoint(0.0f, 0.0f);
|
||||
nsegs = nsegs == 0 ? 1 : nsegs;
|
||||
float dt = 1.0f / (float)nsegs;
|
||||
float t = 0.0f;
|
||||
for (size_t i = 1; i <= nsegs; i++) {
|
||||
t += dt;
|
||||
for (auto t = 0.0f; t <= 1.0f; t += dt) {
|
||||
// get cubic spline interpolation coefficients
|
||||
float t0 = 1.0f * (1.0f - t) * (1.0f - t) * (1.0f - t);
|
||||
float t1 = 3.0f * (1.0f - t) * (1.0f - t) * t;
|
||||
|
|
Loading…
Add table
Reference in a new issue