12 Mar, 2019The Wonders of Duck Typing

Having immersed myself entirely in JavaScript for the past few years, going back to something like C# should have been a bit of relief. However, it mainly served to highlight just how inflexible and full of unnecessary overhead C# is, and just how much I love the flexibility and interoperability of JavaScript. This particular post details one of those ridiculous situations that languages like C# often create, with a relatively simple app containing at least 6 different classes/structures for storing 3D position data, many of them pretty much the same but entirely incompatible with each other.


19 Feb, 2019The Profligacy of Immutability

There have been a couple of times over the past few months where I have run into major performance issues due to excessive garbage collection when trying to create dynamic models that work with immutable data objects used in 3rd-party code. Even just one or two immutable classes in a library can have huge flow-on effects. I have no problems with functional programming and immutability per se, but when that code starts gorging on new memory and leaving behind a trail of garbage for others to clean up, then it's time to register a complaint.


18 Dec, 2018Sky Distribution Equations

A number of people have asked me for more information about a comment I made in the CIE Sky app description about using the "latest" sky distribution equations. Basically, whilst trying to work out why the numbers I was getting from my implementation of the CIE Standard General Sky were slightly different to those from other popular daylight tools, I noticed that all of them appeared to be based on code that implemented the original Perez All-Weather Sky equations published in 1993, rather than the CIE Standard General Sky equations from 2003. The differences between the two are relatively small, but certainly enough to confound any direct numerical comparison.


12 Jun, 2014Earth/Sun Relationship Update

I've been doing a fair bit of low-level optimisation work on my solar calculations code recently and, whilst I have a reasonably extensive test suite for it, nothing beats being able to actually see things in action and interactively put them through their paces. Also, I've been wanting to update my old Earth/Sun Relationship app for a while now with some new ideas and graphics, so the synthesis seemed pretty logical. Thus, I just finished a brand new version with lots of new features as a way of both examining and visualising the relationships involved and letting me test and validate the core code.


26 May, 2014Processing Libraries - Where are They?

As I've mentioned in previous posts, I have been working on a graphical user interface and 3D modelling library in Processing for some time now. I originally chose Processing because it was truly cross-platform and the only tool that also supported embedded web applets. I got to a reasonably advanced state in v1.5.1 and then, of course, everything changed. Processing 2 moved entirely to OpenGL and completely abandoned web applets.


02 Aug, 2013Dynamic Charts in WPF

There are a plethora of WPF charting solutions out there, both commercial and open source. I have tried quite a few but have yet to find one that is capable of handling highly dynamic data whilst also providing useful customisations such as centered axis or generating polar diagrams. I do most of my dynamic charts in OpenGL but labelling axis and data points using textured fonts lacks some of the polish I have seen in many WPF-based solutions. Thus I thought that, for my Windows apps, I would try porting my OpenGL chart library to WPF.


22 Mar, 2013Event Handling in Analysis Classes

As I have mentioned in a couple of other posts, I have been working on the API for a suite of building performance analysis classes, with a particular focus on dynamic visualisation and interactive manipulation. Part of this involves implementing an event notification system so that changes can propagate through even the most complex object hierarchies without the user having to worry about the internal plumbing. Unfortunately the standard approaches that I have found aren't particularly suitable here, so I have had to hack out something of my own.


28 Sep, 2012Where's the Point in 3D APIs

Whilst working on an analysis library recently, I have been trying to reconcile how best to define positional and directional information. Most 3D frameworks and Application Programming Interfaces (API) use a single Vector class (or similar) to define a generic object with X, Y and Z properties, which is then used interchangeably to describe both points in space and direction vectors. The closer I look, however, the more I think that it's important to clearly distinguish between the two and treat them as separate classes in an API in order to avoid inadvertent user mistakes. Unfortunately there is no single knock-out justification for either approach, so the following are some simple contemplations on the subject as I try to work out which way to go.


23 Sep, 2012Designing for Sub-Classing in Java

One of the projects I have been working on over the last few months is a graphical user-interface (GUI) library for Processing. The Java API to the library makes extensive use of sub-classing and the intention is that it be easily sub-classed by the end user to allow for deep customisation of its functionality. Deep customisation means allowing for any property in any of its classes to be easily overridden. Sounds trivial as this is what object-oriented programming and Java is all about, but it actually leads to an interesting code-design dilemma.


07 Jan, 2012Fast 3D Vector Text in Processing

Technical illustrations and 3D graphs tend to need lots of different kinds of text - some bold/italic, some large/small, and often in a range of different colors or shades of grey. Having struggled with image-based font glyphs in 3D for ages, I've kinda had enough - so set out to develop my own parametric vector text in Processing/OpenGL. This applet is a demo of some of the types of 3D text object I've been playing with as well as some experiments with annotation arrows.


28 Dec, 2011Dynamically Dimensioning 3D Models

When interactively manipulating objects in 3D, having clear dimensions that update dynamically while dragging around allows for much greater confidence and accuracy in the process. This is especially true on a tablet where accurate alignment is well near impossible as your finger (and sometimes hand) effectively obscures the drag point. However, what started out as a quick experiment ended up sucking me into a 6 day vortex, swirling around with quaternion maths and 3D text manipulation in an attempt to get radial dimensions visible when viewed from any direction. This tiny applet is the result of those 6 days.


04 Dec, 2011gluUnproject() for P3D and OPENGL Sketches

I have been struggling for a while in Processing with the reverse projection of 2D screen coordinates back into 3D world coordinates. It's relatively straightforward in OPENGL sketches using the JOGL view matrices and the GLU.gluUnproject() function. However, I could never get anything solid when using the P3D renderer or the PGraphics3D matrices. For some reason there was always a slight scaling issue which varied with different views. Previously I've used fudge factors to get it pretty close but, as I still prefer P3D for browser embedded work, I finally spent some time on it and made the breakthrough I needed. This is a brief description of what I learnt along the way as well as a demo applet and custom gluUnproject() function.


02 Nov, 2011A Small Mac Mini Server Cluster

I have recently been building a small multi-node cluster of Mac Mini Servers as a development tool to explore some cloud services and parallel processing techniques. For this purpose, the Mac Mini is great as they are dead quiet, use very little power, boot with no problems without a keyboard, mouse or monitor attached and are easily set up to allow full remote management, configuration and screen sharing. For me the Server version is best as only they come with an Intel quad-core i7 CPU, giving effectively 8 processing nodes each. The CPU speed is a bit slower compared to the best non-server version (2.0MHz vs 2.7MHz), however the non-server version is only dual-core.


07 Aug, 2011Analytical Space Inspection

When dealing with complex analytical models, visually checking that all the spaces within a building have been generated correctly is never easy. This is because there are usually so many of them and their bounding surfaces are invariably adjacent to those of other spaces. You often wish that there was a way to 'explode' the building apart so you could see all of its constituent parts. Well, this the first of my experiments to do exactly that.


12 Jun, 2011Super Shapes Generator

Having just done the Spherical Harmonics demo, and with most of the infrastructure already in place, it would have been remiss not to do a Super Shapes demo. Super Shapes are 3D forms generated using Johan Gielis' generalisation of the superellipse formula, often termed the superformula. This was proposed in 2003 as a framework for simulating natural forms and is basically an equation with four input parameters that generate a range of natural polygons.