diff --git a/src/display/Plot/VectorField.tsx b/src/display/Plot/VectorField.tsx index c62ad3b4..c539b0be 100644 --- a/src/display/Plot/VectorField.tsx +++ b/src/display/Plot/VectorField.tsx @@ -37,6 +37,10 @@ export function VectorField({ const tail: vec.Vector2 = [x, y] const trueOffset = xy([x, y]) const trueMag = vec.mag(trueOffset) + + // Avoid rendering zero-length vectors + if (trueMag === 0) continue + const scaledOffset = vec.scale(vec.normalize(trueOffset), Math.min(trueMag, step * 0.75)) const tip = vec.add(tail, scaledOffset)