diff --git a/chapters/operatorsandexpressions.tex b/chapters/operatorsandexpressions.tex index 304ca1a62..4b2353f19 100644 --- a/chapters/operatorsandexpressions.tex +++ b/chapters/operatorsandexpressions.tex @@ -857,27 +857,33 @@ \subsubsection{spatialDistribution}\label{spatialdistribution} * also known as "short-circuit evaluation of x and y". */ if positiveVelocity then - out1 := interpolate(points, values, 1-(x-x0)); + out1 := interpolate(points, values, 1 - (x - x0)); out0 := values[1]; // similar to in0 but avoiding algebraic loop else - out0 := interpolate(points, values, 0-(x-x0)); + out0 := interpolate(points, values, 0 - (x - x0)); out1 := values[end]; // similar to in1 but avoiding algebraic loop end if; when then - if x>x0 then + if x > x0 then m := size(points, 1); while m > 0 points[m] + (x - x0) >= 1 loop - m := m-1; + m := m - 1; end while; - values := cat(1, {in0}, values[1:m], {interpolate(points, values,1-(x-x0))}); + values := cat(1, + {in0}, + values[1:m], + {interpolate(points, values, 1 - (x - x0))}); points := cat(1, {0}, points[1:m] .+ (x-x0), {1}); - elseif x points[m] + (x - x0) <= 0 loop - m := m+1; + m := m + 1; end while; - values := cat(1, {interpolate(points, values, 0 - (x - x0))}, values[m:end], {in1}); - points := cat(1, {0}, points[m:end] .+ (x-x0), {1}); + values := cat(1, + {interpolate(points, values, 0 - (x - x0))}, + values[m:end], + {in1}); + points := cat(1, {0}, points[m:end] .+ (x - x0), {1}); end if; x0 := x; end when;