about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-10-17 09:39:34 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-10-17 09:39:34 -0700
commit50d6c374de23adebc7a3a2742c6c20dfd87010fb (patch)
treebd68bc621e1183c18b200fca373c9f39bc18000f /apps
parent799390e1eac98fcf40636dace69729063a004840 (diff)
downloadmu-50d6c374de23adebc7a3a2742c6c20dfd87010fb.tar.gz
fix other mandelbrot variants main
Diffstat (limited to 'apps')
-rw-r--r--apps/mandelbrot-fixed.mu5
-rw-r--r--apps/mandelbrot-silhouette.mu4
2 files changed, 4 insertions, 5 deletions
diff --git a/apps/mandelbrot-fixed.mu b/apps/mandelbrot-fixed.mu
index fc33aae1..186350aa 100644
--- a/apps/mandelbrot-fixed.mu
+++ b/apps/mandelbrot-fixed.mu
@@ -213,8 +213,8 @@ fn mandelbrot-y x-f: int, y-f: int, imaginary-f: int -> _/ebx: int {
 }
 
 # Scale (x, y) pixel coordinates to a complex plane where the viewport width
-# ranges from -2 to +2. Viewport height just follows the viewport's aspect
-# ratio.
+# ranges from (scene-cx - scene-width/2) to (scene-cx + scene-width/2).
+# Viewport height just follows the viewport's aspect ratio.
 
 fn viewport-to-real-f x: int, width: int, scene-cx-f: int, scene-width-f: int -> _/edx: int {
   # 0 in the viewport       goes to scene-cx - scene-width/2 
@@ -239,7 +239,6 @@ fn viewport-to-imaginary-f y: int, width: int, height: int, scene-cy-f: int, sce
   # height in the viewport  goes to scene-cy + scene-width/2*height/width
   # Therefore:
   # y in the viewport       goes to (scene-cy - scene-width/2*height/width) + y*scene-width/width
-  #  scene-cy - scene-width/width * (height/2 + y)
   # At most two numbers being multiplied before a divide, so no risk of overflow.
   var result-f/eax: int <- int-to-fixed y
   result-f <- multiply-fixed result-f, scene-width-f
diff --git a/apps/mandelbrot-silhouette.mu b/apps/mandelbrot-silhouette.mu
index 0d9a137c..14c6e397 100644
--- a/apps/mandelbrot-silhouette.mu
+++ b/apps/mandelbrot-silhouette.mu
@@ -113,8 +113,8 @@ fn mandelbrot-y x: float, y: float, imaginary: float -> _/xmm3: float {
 }
 
 # Scale (x, y) pixel coordinates to a complex plane where the viewport width
-# ranges from -2 to +2. Viewport height just follows the viewport's aspect
-# ratio.
+# ranges from (scene-cx - scene-width/2) to (scene-cx + scene-width/2).
+# Viewport height just follows the viewport's aspect ratio.
 
 fn viewport-to-real x: int, width: int -> _/xmm0: float {
   # (x - width/2)*4/width