# ZF4 Blog

## Building a garden trellis with calc

I recently had to build some garden trellis' from scratch as I wanted them in particular size with curved tops. And because in a past life I've trained and worked as a carpenter I didn't think twice about a bit of DIY.

With a bit of sketching I decided on a design for what I wanted and it came to creating the things themselves.

Digging back into my woody background I remembered that I was once charged with working out the radius of a bay window so it could be laid out and pannelled. My senior at the time showed me an empirical way that carpenters would have done it, which actually comes done to a bit of geometry. Having a bit of maths in my pocket, I worked it out with a calculator.

radius of arc R = w^2/8h +2h where w = width of arc h = height of arc

We still ended up using a bit of string anchored to a nail, a bit of chalk on the other end to draw the radius, but the fact that I could do the calculation on my phone impressed my senior to the extent that he bought the first beer that evening and asked me to explain it.

So to the trellis. A trellis can take many forms, but in my case it had a curved top. They all have vertical and horizontal members. It's the verticals that change height.

As I had to build a number of these in different dimensions, I needed a way to quickly work out what lengths the verticals needed to be. Cutting a long story short, the formula uses Pythagoras' theorem and is

Height of vertical H at distance d from centre for total height of trellis L = H(L, d) => sqrt(R^2 -d^2) + R - L where R is previously defined

Now I could have used my calculator again, but I only have a simple, but good calculator on the phone with no function storing capability. I could have used a graphical calculator and certainly there are many good ones around for the phone, but I'm lazy and had my linux lappy open anyway. So - calc, (available in most linux app repos,) it was.

>calc ; define R(h,w) = w^2/(8*h) + (h/2) ; define H(h,w,L,d) = sqrt(R(h,w)^2 - d^2) + L - R(h,w)

One of trellises was 2.5m tall, 2.2m wide with a height of 250mm on the arch so calculations became:

; H(250,2200,2500,100) 2498.03460456203780695469 ; H(250,2200,2500,300) 2482.25641754057081274547 ; H(250,2200,2500,500) 2450.40076941560631554556 ; H(250,2200,2500,700) 2401.83979859736628406008 ; H(250,2200,2500,900) 2335.55140671231882557646 ; H(250,2200,2500,1100) 2250

so my cutting list for the verticals becomes

2 @ 2498 2 @ 2482 2 @ 2450 2 @ 2401 2 @ 2335 2 @ 2250

Trust me, the odd 1/10th of a millimeter doesn't matter much in a piece of wood!

The calc program has the ability to save and load function definitions, so if you need this again, you can do it. You can use it very simply on the command line

calc 2*78 156

which makes it a great tool to have on your machine instead of having to open an app, (you always have a terminal open right!). And of course for the shell scripters, it can be used in those as well.

#### footnotes

If you want to find the angle in degrees to cut the top of your verticals then

define A(h,w,d) = acos(d/R(h,w)) * 180 / pi() A(250,2200,200) ~85.49273733922472734090

Remember that the angle is through the centre line of your vertical, so adjust your cut accordingly

Empirical method is basically explained by constructing a circle through 3 points

You may find these interesting too

http://www.thisiscarpentry.com/2012/01/06/circular-based-arches-part-1/

http://www.mycarpentry.com/arch-calculator.html

http://www.thisiscarpentry.com/2012/03/30/the-elegant-ellipse/