fix four conditional operands sexc emitted without parentheses, and mark every Sex workaround with a TODO
A conditional as an operand loses its parentheses (sex#59): box-blur allocated a quarter of its buffer, deep water got the shallow colour, and verify's delta histogram wrote out of bounds into the height classes. Plan.org quoted the corrupted count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
;;; The C# folds these at compile time; written as divisions here they
|
||||
;;; would be unparenthesized macros and round differently in context.
|
||||
;; TODO sex#55: write the divisions, e.g. (/ -1.0 6.0), once define
|
||||
;; bodies are translated and parenthesized.
|
||||
(define STRETCH-2D -0.211324865405187)
|
||||
(define SQUISH-2D 0.366025403784439)
|
||||
(define STRETCH-3D -0.16666666666666666)
|
||||
@@ -248,6 +250,8 @@
|
||||
|
||||
;;; NormalizedSimplexNoise. Octave i samples at frequencies[i] and is
|
||||
;;; weighted so the sum stays in a known range before tanh.
|
||||
;; TODO sex#50: write MAX-OCTAVES once constants in array types are
|
||||
;; kebab-converted.
|
||||
(pub record simplex-noise
|
||||
((count int) (frequencies [double MAX_OCTAVES]) (amplitudes [double MAX_OCTAVES])
|
||||
(scaled-2d [double MAX_OCTAVES]) (scaled-3d [double MAX_OCTAVES])
|
||||
@@ -276,6 +280,8 @@
|
||||
;; PERSISTENCE^i.
|
||||
(pub fn octaves ((count int) (base-frequency double) (persistence double) (seed i64))
|
||||
(* simplex-noise)
|
||||
;; TODO sex#50: write MAX-OCTAVES once constants in array types are
|
||||
;; kebab-converted.
|
||||
(var frequencies [double MAX_OCTAVES])
|
||||
(var amplitudes [double MAX_OCTAVES])
|
||||
(for (var i int 0) (< i count) (++ i)
|
||||
@@ -301,6 +307,8 @@
|
||||
|
||||
;;; SimplexNoise: plain octave sums, no normalising and no tanh. The
|
||||
;;; rock strata thickness maps and the strata distortion use it.
|
||||
;; TODO sex#50: write MAX-OCTAVES once constants in array types are
|
||||
;; kebab-converted.
|
||||
(pub record simplex-sum
|
||||
((count int) (frequencies [double MAX_OCTAVES]) (amplitudes [double MAX_OCTAVES])
|
||||
(octaves [simplex-octave MAX_OCTAVES])))
|
||||
|
||||
Reference in New Issue
Block a user