Heavily influenced, and some code is based on "Customizable Sundial" by doctek Feb 17, 2013, https://www.thingiverse.com/thing:51183
I wanted a square version of doctek's clock, so here it is to share with you all!
My sundial only works in the Northern hemisphere. I don't think sundials caught on in the Southern hemisphere because the "clock" runs backwards, anti-clockwise!
To get an accurate time the sundials numbers need to have their angles adjusted, and the spike sticking out needs to be tilted all depending on where you are in the North.
doctek's written some great instructions for setting up your sundial over there.
I found typing into google "[location] latitude"..... for instance "paris latitude", and google displays at the top - "Paris / Coordinates 48.8566° N, 2.3522° E"
You can enter these into the OpenSCAD script right up at the top.
These give the program what it needs to adjust the numerical dial, and the spike so the time is correct.
Does it work?
I've checked the sundial works from a real one I printed out, along with one I rendered with a program that emulates the sun accurately that I could test in different positions across the earth.
As you can see in the images - the simulated sun is at it's 3 o'clock position in the sky where I live, and my model shows the shadow falling at 3pm. Success!
It works for other Northern locations just fine.
I like the square style of sundial, so I re-wrote some core sections of the original sketch.
The trickiest part was getting the clock hour marks to intersect with the perimeter of the clock.
I discovered splitting the rectangle into quarters, and using 4 different equations to work out the angles gave me the best results.
There's a little bug I haven't found the cause of yet - if an hour mark lands directly on a corner the maths goes a little wrong. It's fairly rare though.
Many thanks to doctek for sharing the OpenSCAD script - and I hope you find this square version come in handy!