Fix broken geometry of tailed i/l under heavy oblique quasi-proportional (#2274)

* Fix broken geometry of tailed `i`/`l` under heavy oblique quasi-proportional.

* Fix remaining broken geometries
This commit is contained in:
Belleve 2024-04-02 06:34:16 -10:00 committed by GitHub
parent a0c8c9be0b
commit 6923d74c0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 31 additions and 13 deletions

View file

@ -187,14 +187,27 @@ export class RoundCapCurve {
const r = mix(this.r0, this.r1, t);
const theta = mix(this.theta0, this.theta1, t);
return {
x: centerX + r * Math.cos(theta) * this.contrast,
y: centerY + r * Math.sin(theta),
};
return new Vec2(
centerX + r * Math.cos(theta) * this.contrast,
centerY + r * Math.sin(theta),
);
}
derivative(t) {
// TODO: calculate an exact form instead of using finite difference
return derivativeFromFiniteDifference(this, t);
const theta = mix(this.theta0, this.theta1, t);
const r = mix(this.r0, this.r1, t);
const dx =
this.center1.x -
this.center0.x +
this.contrast *
((this.r1 - this.r0) * Math.cos(theta) -
(this.theta1 - this.theta0) * r * Math.sin(theta));
const dy =
this.center1.y -
this.center0.y +
((this.r1 - this.r0) * Math.sin(theta) +
(this.theta1 - this.theta0) * r * Math.cos(theta));
return new Vec2(dx, dy);
}
}