Problem
Angle2D (and Arc2D / SmallestArc2D, which wrap it) only sends its origin through Projection2D. The start and end angles (points[i].angle() in Arc2D.svelte) are world angles and are used as given, while the vectors themselves are drawn along their projected on-screen directions. Under a non-uniform Canvas2D scale (scaleX !== scaleY) the arc ends therefore do not land on the drawn vectors.
SmallestArc2D's label position is the world-space bisector times distance, and Latex2D projects it. The arc radius (distance) is a screen-space size that is not projected, so the label drifts off the arc whenever the scale is not 1, even when it is uniform.
Expected
- The arc starts and ends on the on-screen direction of each vector.
- The label sits on the drawn arc.
- Output at scale 1 is unchanged.
Suggested approach
- Add a world angle → screen angle mapping to
Projection2D (atan2(sy·sinθ, sx·cosθ), lifted so winding is kept for negative and multi-turn angles), with unit tests.
- Use it in
Angle2D for the start and end angles and the arrowhead rotation. Keep distance, width and headLength as screen-space sizes, as documented in Angle2D now.
- Compute
SmallestArc2D's label position in screen space and pass it back through projection.toWorld.
Context
Found in the review of #515 (the Projection2D seam, #491) and deferred from that PR.
Problem
Angle2D(andArc2D/SmallestArc2D, which wrap it) only sends its origin throughProjection2D. The start and end angles (points[i].angle()inArc2D.svelte) are world angles and are used as given, while the vectors themselves are drawn along their projected on-screen directions. Under a non-uniformCanvas2Dscale (scaleX !== scaleY) the arc ends therefore do not land on the drawn vectors.SmallestArc2D's label position is the world-space bisector timesdistance, andLatex2Dprojects it. The arc radius (distance) is a screen-space size that is not projected, so the label drifts off the arc whenever the scale is not 1, even when it is uniform.Expected
Suggested approach
Projection2D(atan2(sy·sinθ, sx·cosθ), lifted so winding is kept for negative and multi-turn angles), with unit tests.Angle2Dfor the start and end angles and the arrowhead rotation. Keepdistance,widthandheadLengthas screen-space sizes, as documented inAngle2Dnow.SmallestArc2D's label position in screen space and pass it back throughprojection.toWorld.Context
Found in the review of #515 (the
Projection2Dseam, #491) and deferred from that PR.