Skip to content

Instantly share code, notes, and snippets.

@tkurtbond
Last active June 7, 2021 04:48
Show Gist options
  • Save tkurtbond/8ec106748c60fe4e72db7f0759f11627 to your computer and use it in GitHub Desktop.
Save tkurtbond/8ec106748c60fe4e72db7f0759f11627 to your computer and use it in GitHub Desktop.
How much does your giant weigh?
(defun height-mass (start-height start-mass end-height build-ratio)
"How much does your giant weigh?
Calculate from START-HEIGHT, START-MASS, and END-HEIGHT multiplied by
BUILD-RATIO the END-MASS. BUILD-RATIO is a factor to express the difference
in build between different creatures. (The factor for a dwarf might be 2.25,
225% heavier than normal.)
Formula: end-mass = start-mass * (end-height / start-height)^3
See:
https://en.wikipedia.org/wiki/Square%E2%80%93cube_law
https://www.enworld.org/threads/how-much-does-my-giant-weight.106631/post-1846443"
(interactive "nStarting Height? \nnStarting Mass? \nnEnd Height? \nnBuild Ratio? ")
(let* ((start-height (* 1.0 start-height)) ; make measurements floats.
(start-mass (* 1.0 start-mass))
(end-height (* 1.0 end-height))
(ratio (expt (/ end-height start-height) 3))
(end-mass (* start-mass ratio)))
(message "Start Height: %g; Start Mass: %g; End Height: %g; Build Ratio: %g
Ratio: %g; End Mass: %g; * Build Ratio: %g"
start-height start-mass end-height build-ratio
ratio end-mass (* build-ratio end-mass))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment