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:
Jan 2016-08-31 10:05:47 +02:00 committed by GitHub
parent 6e7fe67a8d
commit f160e74936

View file

@ -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;