mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Use correct value for y 45 degree tangent
I got the pythagoras wrong when I wrote this. The length of the tangent vector is 1, therefore the y component is sqrt(0.5) for 45°. This will not make any difference, but still we should use the correct value.
This commit is contained in:
parent
6e7fe67a8d
commit
f160e74936
1 changed files with 4 additions and 2 deletions
|
@ -610,8 +610,10 @@ PathItem.inject(new function() {
|
|||
pt = curve.getPointAtTime(t),
|
||||
// Determine the direction in which to check the winding
|
||||
// from the point (horizontal or vertical), based on the
|
||||
// curve's direction at that point.
|
||||
dir = abs(curve.getTangentAtTime(t).normalize().y) < 0.5
|
||||
// curve's direction at that point. If the tangent is less
|
||||
// than 45° (y of tangent < sqrt(0.5)), cast the ray
|
||||
// vertically, otherwise horizontally.
|
||||
dir = abs(curve.getTangentAtTime(t).normalize().y) < 0.7071
|
||||
? 1 : 0;
|
||||
if (parent instanceof CompoundPath)
|
||||
path = parent;
|
||||
|
|
Loading…
Reference in a new issue