Word Wrapping With System.Draw

Rendered Text with Horizontal and Vertical Wrapping

Rendered Text with Horizontal and Vertical Wrapping


I was writing a program last week to make some bitmaps from text strings. I needed to render a series of strings into individual bitmaps, with some restrictions/complications,

 
  • The text needs to be outlined
  • The bitmaps need to all be the same size
  • The whole string must be rendered in the bitmap
  • This has to be done in C#, as I need this to work with another library I’m using.

In looking for inspiration on how to do this I remembered how powerpoint resizes text to maximise the space used in a text box. Unfortunately, this functionality isn’t built in to any library I could find. Read more

Desktop Wind Tunnel, Now With Smoke!

Wind Tunnel Components

Wind Tunnel Components


I “finished” the wind tunnel last month, its not really finished (is anything ever finished) but it is working to the point that the kids can test their model rockets in it. In my last post I added a video of one of the first motor tests I did, since then I’ve added the flow laminarizer (drinking straws), a platform to mount models, and an axle for the same purpose.

Read more

Desktop Wind Tunnel Initial Test

Half Finished, Tube and Motor are Mounted

Half Finished, Tube and Motor are Mounted


Shortly after I moved to Boston I became involved with a great after school program, the Innovation Institute. The idea behind the innovation institute is to teach kids science and engineering, but not in the way I was taught. Each class is designed to engage the kids in cutting edge science and technology, rather than belaboring the history of science and technology. My task is to get the kids to use this knowledge to solve a problem in the form of an engineering design challenge. Read more

CUDA and Amazon EC2

Amazon have their own linux distribution, I still prefer ubuntu...

Amazon have their own linux distribution, I still prefer ubuntu…


I’ve been trying to find an excuse to try out Amazon’s EC2 system for a while now, and in the past few weeks I got one. I need to run some benchmarks on a relatively recent nVidia Tesla card so I can prove a point about an algorithm I’m developing. The problem is, those things are expensive… and its a bit of a waste to buy one for a few hours worth of benchmarks. So I bit the bullet and signed up for Amazon Web Services (AWS).

Read more

Autonomous Fighting Robots!


This sunday was the climax of Artisan’s Asylum’s autonomous fighting robots competition, and we entered a robot!
The Arena in the Basement of the Middle East, Cambridge

The Arena in the Basement of the Middle East, Cambridge


The competition was organised as a design challenge where 8 teams had two weeks to design, fabricate and test a robot that was capable of autonomously locating and attacking the enemy, whilst not tearing itself apart. The schedule was strict, 5 hours allotted every week day, and 10 hours on the weekend. Going in to this I had no idea how I was going to survive a day of work followed by 5 hours of robot building, but it was totally worth it.
Jean Claude Van Smith - Our Autonomous Fighting Robot

Jean Claude Van Smith – Our Autonomous Fighting Robot


Read more

Multiphase Toys




I was recently at a conference discussing a phenomena called “snap through”. Snap through occurs in multiphase fluid flows in porous media, where a bubble of one fluid is stuck in a pore. When a pressure gradient is applied, a large amount of work is required to initiate the transport of this bubble through the pore throat. At a certain point however, the fluid will snap through the pore throat, accelerating in the process.

Multiphase fluid flows are difficult to conceptualise, a property of many engineering problems. What we really needed was something I like to call a Toy model, one which is only qualitatively correct.

So I fired up matlab and threw something together that would allow us to directly visualise what is actually going on during snap through. The result was a lattice Boltzmann simulation based on the Shan Chen model for multiphase flows. The video and model are truly a testament to the flexibility, and simplicity, of the lattice Boltzmann method.

As a side note, I often find toy models to be a hell of a lot more useful than those you would normally find in academia (the type with a stupid name like 15th order finite hyper element super method). Toys are quick to write, quick to run, and lead to instant insight.

Ordo Shader Effects

Ordo Before Shader Effects

Ordo Before Shader Effects


Up until a month ago, Ordo looked quite clean and simple. But something was clearly missing. Last year, I dabbled in applying post processing effects with shaders. At the time there were some problems with Samsung Galaxy S2’s not working like every other phone we tried this on. We also had a terrible rendering system which wasn’t very flexible or efficient.

Read more

Programmable Filters in Paraview


The Python integration in Paraview is pretty powerful. Before I discovered it I was a bit of a Matlab purist when it came to post-processing simulation data. But over the last 6 months I’ve gotten deeper into Paraview, and I think I’m now at a point where I know enough about the python integration to actually do useful things with it(!). Why did it take 6 months? Because the documentation is sparse at best, and completely nonexistant for the most part.
Shear box with a single fixed position particle

Shear box with a single fixed position particle


Read more