Skip to content

Commit c9019c7

Browse files
committed
change(/wiki/introduction): omit square-cube law
- S.C.-Law is now a footnote. - Changed heading to a formula. - Make math voxels only one byte. - Fix all the math. - Fix grammar.
1 parent 08e95ea commit c9019c7

File tree

2 files changed

+17
-22
lines changed

2 files changed

+17
-22
lines changed

content/wiki/introduction/index.md

+15-20
Original file line numberDiff line numberDiff line change
@@ -172,44 +172,35 @@ Let me repeat: <b style="color:red">Don't do this.</b>
172172

173173

174174

175-
But you know what isn't complicated, but **extremely important** to know?
176175

177-
## The Square-Cube Law
176+
## Volume = Distance ³
178177

179-
{% figure(class="float", caption="Relationship between Length, Area & Volume.", author="[Cmglee](https://commons.wikimedia.org/wiki/User:Cmglee)", license="[CC-BY-SA-4.0](https://commons.wikimedia.org/wiki/File:Relationship_between_length_and_area_and_volume.svg)") %}https://upload.wikimedia.org/wikipedia/commons/a/ae/Relationship_between_length_and_area_and_volume.svg{% end %}
180-
181-
When dealing with voxels/bloxels and their various algorithms,
182-
you'll quite often be up against the **Square&#8209;Cube&nbsp;Law**:
183-
184-
{% quote(author="[Wikipedia](https://en.wikipedia.org/wiki/Square%E2%80%93cube_law)") %}
185-
When an object undergoes a proportional *increase in size*, its new **surface area** is proportional to the *square* of the multiplier and its new **volume** is proportional to the *cube* of the multiplier.
186-
{% end %}
187-
188-
<div style="clear:both"></div>
178+
A fundamental reality of many voxel algorithms
179+
is that the data they deal with **cubically**[^squarecube].
180+
What does that mean, in practice?
189181

190182
Let's do a tiny bit of math (<small>feel free to grab a calculator</small>):
191183

192184
1. Think of how far into the distance you want to 'see', in meters/voxels.
193185
2. Using that distance, calculate `(D*2)³` to get the visible volume.
194-
3. Assume a voxel takes 64 bits, i.e. 8 bytes of space...
195-
4. ...so multiply the volume by 8 bytes.
196-
5. Divide by `1024` to get it as kilobytes.
197-
6. Divide by `1024`, again, for megabytes.
186+
3. Assume a voxel takes just a single byte of space...
187+
4. Divide by `1024` to get it as kilobytes.
188+
5. Divide by `1024`, again, for megabytes.
198189
- Divide again to get gigabytes, if needed.
199-
7. Look at the amount of memory used.
200-
8. Change the distance and repeat a few times.
190+
6. Look at the amount of memory used.
191+
7. Change the distance and repeat a few times.
201192

202193
{{ volume_memory_calc(id="calculator") }}
203194

204195
{% info_notice(summary="Fun Fact: Planet-sized Volumes") %}
205-
If you solve for the size of the earth (a radius of 6371km), you will get a fun number of roughly **16550 exabyte**... which is more than half of the *entire* contents of the world-wide-web (in ~2024) at about **27000 exabyte**!
196+
If you solve the volume for the size of the earth (a radius of 6371km), you will get a fun number of roughly **2068 exabyte**... which is roughly seven percent of the world-wide-webs *entire* contents (in ~2024), at about **27000 exabyte**!
206197

207198
Luckily, most of any planets volume is unreachable, hidden under the surface,
208199
so it can be treated as if it didn't exist, vastly reducing the needed volume.
209200
{% end %}
210201

211202
While computers these days are pretty darn powerful, **they still have limits**,
212-
and working with voxels can push things there *very* quickly...
203+
and working with voxels can push them there *very* quickly...
213204

214205
- Your RAM may be large (many gigabytes, usually ~4-8 GB),<br/>
215206
but the bits'n'bytes still need to go to/fro the CPU and back.
@@ -251,3 +242,7 @@ Perhaps [share](/wiki/community) your creation?
251242
## Next
252243

253244
Choosing a programming language!
245+
246+
---
247+
248+
[^squarecube]: <https://en.wikipedia.org/wiki/Square%E2%80%93cube_law>

templates/shortcodes/volume_memory_calc.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div id='{{id}}' class='notice info' style='display:none'>
33
<div style="text-align:center">Interactive <b>Distance ⇒ Memory</b> Calculator</div>
44
<div style="display:flex;justify-content:center;align-items:center;padding:0.5rem">
5-
<div>(<input type=number required min=16 max=65536 step=16 value=16 style='width:5em;text-align:end;border-radius:5px;border:1px solid grey;font-family:monofont' title='View Distance'>&hairsp;m * 2)³ * 8</div>
5+
<div>(<input type=number required min=16 max=65536 step=16 value=16 style='width:5em;text-align:end;border-radius:5px;border:1px solid grey;font-family:monofont' title='View Distance'>&hairsp; * 2)³</div>
66
<div>&nbsp;=&nbsp;</div>
77
<code style='font-weight:bold;text-align:end;min-width:7em;background:#0000007a' title='Memory Usage'>0 kB</code>
88
</div>
@@ -26,7 +26,7 @@
2626
}
2727
function put(b, u) {calc_output.innerHTML = b.toFixed(2) + '&hairsp;' + u}
2828
var V = Math.pow(D*2, 3), K = 1024;
29-
var bytes = V * 8, kilobytes = bytes / K, megabytes = kilobytes / K, gigabytes = megabytes / K, terabytes = gigabytes / K;
29+
var bytes = V, kilobytes = bytes / K, megabytes = kilobytes / K, gigabytes = megabytes / K, terabytes = gigabytes / K;
3030
if(terabytes >= K) {return put(terabytes / K, 'PiB')}
3131
if(gigabytes >= K) {return put(terabytes, 'TiB')}
3232
if(megabytes >= K) {return put(gigabytes, 'GiB')}

0 commit comments

Comments
 (0)