Skip to content

Instantly share code, notes, and snippets.

@tkurtbond

tkurtbond/height-mass.el

Last active Nov 15, 2020
Embed
What would you like to do?
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