;;; -*- lexical-binding: t -*-
;; This file: http://user.it.uu.se/~embe8573/emacs-init/wood.el
;; https://dataswamp.org/~incal/emacs-init/wood.el
;; make a railing of equally big beams
;; How to use: input the number of beams and
;; the program will compute the distance
;; (space) between each beam, then test for
;; different number of beams until a distance
;; is outputted that seems reasonable
(defun compute-space-distance (dist num-beams beam-width)
(let*((spaces (1+ num-beams))
(dist-covered (* num-beams beam-width))
(dist-uncovered (- dist dist-covered))
(space (/ dist-uncovered spaces 1.0) ))
space ))
;; 16
;; (insert (format "\n;; %.2f" (compute-space-distance 262 16 12)))
;; 4.12
;; 17
;; (insert (format "\n;; %.2f" (compute-space-distance 262 17 12)))
;; 3.22
;; 18
;; (insert (format "\n;; %.2f" (compute-space-distance 262 18 12)))
;; 2.42
;; 19
;; (insert (format "\n;; %.2f" (compute-space-distance 262 19 12)))
;; 1.70
;; 20
;; (insert (format "\n;; %.2f" (compute-space-distance 262 20 12)))
;; 1.05
;; if you are making a grid
;; out of beams
;; that are of different sizes
;; it doesn't look asymmetric
;; if you make the *holes* equally big :)
(defun compute-wood-distance (total beams)
(let*((sum-beam (apply #'+ beams) )
(space (- total sum-beam))
(num-holes (1+ (length beams)))
(hole-len (/ space num-holes)) )
(message "%.1f cm" hole-len) ))
;; (compute-wood-distance 139 '(6 7 9.5 9.5 9.5 9.5)) ;; 12.6 cm
;; (compute-wood-distance 28.7 '(4.9 4.8)) ;; 6.3 cm