https://github.com/cben/huppoid
Retroactive: Code from our wedding invitation (2009)
https://github.com/cben/huppoid
Last synced: 9 months ago
JSON representation
Retroactive: Code from our wedding invitation (2009)
- Host: GitHub
- URL: https://github.com/cben/huppoid
- Owner: cben
- Created: 2015-12-07T20:11:28.000Z (over 10 years ago)
- Default Branch: gh-pages
- Last Pushed: 2015-12-09T13:02:00.000Z (over 10 years ago)
- Last Synced: 2025-08-28T08:32:49.345Z (9 months ago)
- Language: Python
- Homepage: https://cben.github.io/huppoid/huppa.html
- Size: 1.62 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Retroactive: Code from our wedding invitation (2009)
We ([@anpc](https://github.com/anpc) & [@cben](https://github.com/cben)) wanted something geeky and XKCD-ish for our wedding invitation and came up with a [Huppa](https://en.wikipedia.org/wiki/Huppa) extended in the 4th dimension, or a 4-dimensional [Cubiod](https://en.wikipedia.org/wiki/Cuboid) with frills:

Yes, we're strange :-)
The invitation details page (originally at bit.ly/huppoid -> sourceforge) included code to render it from different points of view.
I don't think anybody cares, but I wanted to release & preserve it...
I failed to find a good-looking direct 4D->2D projection so did a 4D->3D (resulting in cube-within-a-cube) followed by 3D->2D from *a different point*. Apparently that's a well known way to visualize 4D — [Schlegel diagram](https://en.wikipedia.org/wiki/Schlegel_diagram).
The original 2009 version can be seen at https://rawgit.com/cben/huppoid/a6f4f499066606a427637b57b7cb0e4daa8c7ae4/output/huppa.html.
It was compiled to JavaScript with Pyjamas, now known as [Pyjs](http://pyjs.org/) and drew on a CANVAS tag.
a6f4f499066606a427637b57b7cb0e4daa8c7ae4 contains the latest source I found but I failed to find a Pyjamas version that will compile it correctly...
As Pyjs does browser sniffing and requires compilation, I figured [Brython](http://brython.info) which interprets Python 3 in-browser would be a better archival format.
> **=> https://cben.github.io/huppoid/huppa.html**
Alas Brython turned out waaay slower than the 2009 version (even with Moore's law?!), but oh well.
(If I were to write it now, I'd have used something with 1:1 translation to JS such as Coffeescript or Rapydscript, or just raw JS. And WebGL.)
I also found the z-order (aka painter's algorithm) was very lacking — it always drew all lines, then the fat points and the stick figures image last on top.
I somewhat improved the sorting but there are still some buggy angles, e.g. https://cben.github.io/huppoid/huppa.html#-5.0,3.0,4.0,5.0 .
I'm not sure it's even possible always find a correct drawing order without splitting objects or *per-pixel* z-buffer...
## Debugging
- `huppa.py` is loaded via XHR which may not work from a `file://` local checkout, a web server is needed.
- Prints & exceptions go to JS console.
- Accessing Brython from JS console is hard (`__BRYTHON__.builtins.getattr(__BRYTHON__.globals().main, 'draw')`...).
Instead, add `?debug=` to get a very simple in-page *Python* console (type, press Enter, see JS console for history).
See also http://brython.info/static_doc/en/test.html.
- Add `?clearpage=` to remove the static images & text - helps with screenshotting/cross-browser testing tools.
## Attribution & License
Stick figures were shamelessly stolen from https://xkcd.com/489, formal attire from https://xkcd.com/422.
(Hint: XKCD scales up really well by [tracing with Inkscape](http://www.inkscape.org/doc/tracing/tutorial-tracing.html).)
The final invitation hazmana.jpg, hazmana2.jpg were designed by Vlad Kaminsky; I probably can license them as I see fit but not formally sure.
[CC0](http://creativecommons.org/publicdomain/zero/1.0/): I place *everything else here* under public domain / waive all rights to the extent possible.