art with code


The true meaning of Brexit

The true meaning of Brexit. It's right there. In your heart. It's been there all along. Brexit isn't about how many presents you receive, it isn't the fancy party, it isn't even the joyful songs you sing. Brexit is deeper than that. Brexit is the love you feel for this island and the people on it.

Brexit isn't about fighting with your neighbours and throwing your friends out into the cold. Brexit is about making a better Britain. A Britain where you can be a mechanic, a nurse, a mathematician or an art historian. A Britain where you don't have to be a banker to make ends meet. That's the real meaning of Brexit.

Brexit isn't about tearing apart our relationships and breaking our contracts. Brexit is your love for Britain, the love that will create a new Britain. A better Britain. A Britain for everyone. Article 50 isn't Brexit. Article 50 is a sword that's cutting this island apart. The first step to true Brexit is revoking article 50. Only then can we start building a better Britain.

A Brexit Britain. A Britain that will be a shining beacon of light in a world fallen to darkness. A Britain that stands proud above the waves. A Britain that doesn't require our neighbours to fund its poorest regions. A Britain that can stand alone for a thousand years, but chooses to stand together with its neighbours and create a world where our children and grandchildren can live. Proud of their ancestors. Proud of you and me.

That's the true meaning of Brexit. Revoke Article 50.


Voxel grid shortcuts

This might be nice and fast if it worked right. Voxel grid shortcuts: precompute closest full cells for cell-cell-pairs, look up ray entry & exit cells, jump ray to closest cell. On exit, jump ray out of the model. 🤔

But does it make sense to swap 4 steps through a 512 element 8x8x8 acceleration structure for some math & a lookup from a 262k element shortcut list 🤔

If you do only the external faces, 64^3 grid => 6^2x64^2 accel, which might be worthwhile.

The problem in the above screenshots is that a voxel-to-voxel beam intersects more voxels than a ray would. Now it's generating the shortcuts by tracing a ray from the center the start voxel to the center of the end voxel to find the closest filled voxel the ray intersects. Which doesn't visit all the voxels a beam would, so you get gaps in the model. And my code is broken in other ways, eh.


Fix the atmosphere for profit

1) Build enough solar / wind to run your country.
2) Double your build to cover for low production periods.
3) Use the surplus to run Fischer-Tropsch process to convert atmospheric carbon to fuel.
4) Keep building solar / wind until synfuel production exceeds your demand.
5) Export the excess synfuel, use proceeds to build more solar / wind.
6) Once synfuel production exceeds global demand, start stockpiling the synfuel.
7) Keep going until atmospheric carbon hits normal levels.
8) Control global synfuel supply.

The economics of oil: different extraction technologies have a different price-per-barrel. If oil goes below that price, there's no profit in doing the extraction and the oil fields get shuttered to wait for higher prices.

If you can produce synfuel at a cost below an oil field, the oil field gets shut down. Solar has been halving in price every five years, so you might well imagine an inflection point where synfuel mined from the atmosphere with solar power is cheaper than extracted oil. At that point, the synfuel company can start accumulating excess profits and squeezing traditional producers out of the market, while protecting its monopoly by acquiring nascent competition and what traditional producers and oilfields it can.

Atmospheric mining is a zero-sum game: there's a limited amount of carbon dioxide in the atmosphere and you have to stop mining when the CO2 levels fall too low. By mining out all usable atmospheric carbon, the company can eliminate any chance of competition. To add carbon to the atmosphere, the company sells synfuel to users who burn it. The company can then mine the carbon back from the atmosphere using solar.

Because the company earlier used its excess profits to acquire unprofitable oil extractors and oil fields, it also has a source of extra carbon ready to go. As global fuel use increases, more and more carbon needs to be circulated through the atmosphere.

Similar to mining, surface solar is also a zero-sum game. To produce solar, you need land area. Once the land area is in use, it can't be used for more solar. Acquiring the best lands for solar use will make competition difficult, especially at scale.

The end state of the atmospheric carbon mining company is a monopoly over hydrocarbons and solar energy. At the end state, there are no oil reserves left and oil is a just-in-time produced synthetic product. How fast you can burn the oil depends on the speed of the atmospheric mining process. This could reach a point where an amount of oil matching the total amount drilled over the past century is circulated through the atmosphere each year. To prevent losing carbon to oceans, there also needs to be a system to extract dissolved carbon from seawater.


Beam acceleration

Noodling with beam-based acceleration. Tessellate bounding volume to N faces, connect them with N^2 beams, add primitives to beams, sort primitives inside beam, find containing beam for ray, traverse beam primitives from ray origin in ray direction.

Accelerate in-beam intersection by finding a set of primitives that completely cover the beam. Cut the beam at the rear-most primitive, tessellate the cutting plane, create new set of beams from beam entry to the cutting plane faces.

Bad: eats memory like crazy. Good: should be possible to do 2 beam classifies + 1-2 triangle intersects per ray on ~100ktri scenes. Let's see how it goes. (Also, see Fast Ray Tracing by Ray Classification (1987) by Arvo & Kirk)

Crazy = ~GB / 100ktris...


Hardware hacking

I got into these Pi devices recently. At first it was a simple "I want an easy way to control sites accessible on my office WiFi to stop wasting time when I should be working", so I set up an old broken laptop to prototype a simple service to do that. Then I replaced the laptop with a small Orange Pi hacker board. And got some wires and switches and breadboard and LEDs and resistors and ... hey, is that a Raspberry Pi 3B+? I'll get that too, maybe I can use it for something else...


I took apart a cheap RC car. Bought a soldering station to desolder the wires from the motor control board. Then got a motor controller board (an L298N, a big old chip for controlling 9-35V motors with 2A current draw -- not a good match for 3V 2A Tamiya FA-130 motors in the RC car), wired the motors to it, and the control inputs to the Raspberry Pi GPIOs.

Add some WebSockets and an Intel RealSense camera I had in a desk drawer and hey FPV web controlled car that sees in the dark with a funky structured light IR pattern. (The Intel camera is .. not really the right thing for this, it's more of a mini Kinect and outputs only 480x270 video over the RPi's USB 2 bus. And apparently Z16 depth data as well, but I haven't managed to read that out.) Getting the video streaming low-latency enough to use for driving was a big hassle.

Experimented with powering the car from the usual 5 AA batteries, then the same USB power bank that's powering the RPi (welcome to current spike crash land, the motors can suck up to 2A when stalling), and a separate USB power bank ("Hmm, it's a bit sluggish." The steering motor has two 5.6 ohm resistors wired to it and the L298N has a voltage drop of almost 1.5V at 5V, giving me about 1W of steering power with the USB. The original controller uses a tiny MX1508, which has a voltage drop something like 0.05V. Coupled with the 7.5V battery pack, the car originally steers at 5W. So, yeah, 5x loss in snappiness. Swap motor controller for a MX1508 and replace the resistors with 2.7R or 2.2R? Or keep the L298N and use 1.2R resistors.) Then went back to the 5 AA batteries. Screw it, got some NiMHs.

Tip: Don't mix up GND and +7.5V in the L298N. It doesn't work and gets very hot after a few seconds. Thankfully that didn't destroy the RPi. Nor did plugging the L298N +5V and GND to RPi +5V and GND -- you're supposed to use a jumper to bridge the +12V and GND pins on the L298N, then plug just the GND to the RPi GND (at least that's my latest understanding). I.. might be wrong on the RPi GND part, the hypothesis is that having shared ground for the L298N and the RPi gives a ground reference for the motor control pins coming from the RPi.

Tip 2: Don't wipe off the solder from the tip of the iron, then leave it at 350C for a minute. It'll turn black. The black stuff is oxides. Oxides don't conduct heat well and solder doesn't stick to it. Wipe / buff it off, then re-tin the tip of the iron. The tin should stick to the iron and form a protective layer around it.

Destroyed the power switch of the car. A big power bank in a metal shell, sliding around in a crash, crush. It was used to control the circuit of the AA battery pack. Replaced it with a heavy-duty AC switch of doom.

Cut a USB charging cable in half to splice the power wires into the motor controller. Hey, it works! Hey, it'd be nicer if it was 10 cm longer.

Cut a CAT6 in half and spliced the ends to two RJ45 wall sockets. Plugged the other two into a router. He he he, in-socket firewall.

Got a cheapo digital multimeter. Feel so EE.

Thinking of surface mount components. Like, how to build with them without the pain of soldering and PCB production. Would be neat to build the circuit on the surface of the car seats.

4-color printer with conductive, insulating, N, and P inks. And a scanner to align successive layers.

The kid really likes buttons that turn on LEDs. Should add those to the car.

Hey, the GPIO lib has stuff for I2C and SPI. Hey, there are these super-cheap ESP32 / ESP8266 WiFi boards look neat. Hey, cool, a tiny laser ToF rangefinder.

Man, the IoT rabbit hole runs deep.

(Since writing the initial part, I swapped the L298N for a MX1508 motor controller, and the D415 for a small Raspberry Pi camera module. And got a bunch of sensors, including an ultrasound rangefinder and the tiny laser rangefinder.)


1 GB/s from Samba

Hey, finally on the fast network (GPU died, so I replaced it with an IB card :P)

In other news, new workstation time.


Three thoughts


We're living on a grain of sand, five meters away from a light bulb. Of all the solar energy falling onto our tiny grain of sand, we are currently able to utilize 0.01%. The total energy falling onto our tiny grain of sand is roughly 0.00000005% of the total output of the light bulb.


Gravity sorting. In a gravity well, denser particles end up below lighter particles given time. Here's a list of densities of common elements. It matches the distribution of elements on Earth: air above water, water above silicon, silicon above iron. Note that the rare elements tend to be at the bottom of the list. There are three reasons for that. 1) Heavy elements are rare in the Universe. You need supernovas to produce them. 2) Heavy elements get gravity sorted below iron and mostly reside in the middle of the planet. 3) Some elements - like gold - don't oxidize easily, so they don't bubble up as lighter oxides. For a counter-example, tungsten has a similar density as gold (19.3 g/cm3), but oxidizes as wolframite (Fe,Mn)WO4, which has a density of 7.5 g/cm3 (close to elemental iron). As a result, the annual global tungsten production is 75,000 tons, whereas the annual gold production is 3,100 tons.

Elemental abundances from Wikipedia

The Earth formed from dust in the protoplanetary disk, similarly to other planets and objects in the Solar System. As a result, asteroids should have similar overall composition as the Earth.

Gravity sorting acts slower on less massive objects. You should see relatively more heavy elements at the surface of less massive objects. The force of gravity is also weaker, making the grains of matter less densely packed. This should make mining asteroids less energy-intensive compared to mining on Earth. Asteroid ores should also be more abundant in metals compared to Earth ores. At the extreme end, you'd have iridium, which is 500x more common on asteroids compared to the Earth's crust. Couple that with - let's say - factor of two energy reduction compared to Earth mining, and an asteroid mine could generate 1000x the iridium per watt compared to an Earth-based operation.

Suppose you want to have reusable space launch vehicles to minimize launch costs. Rockets that land. Your customers pay you to launch their stuff to space, then you recover your rocket to save on costs. You don't want to recover the stage that gets to LEO because it'd be too expensive. But what if the returning LEO vehicle brought back a ton of gold. That'd be worth $40 million at today's prices. And the amount of gold brought back this way would be small enough (say, 25 tons per year) that it wouldn't put much dent into gold demand or affect the price of gold. If anything, you could sell it as Star Gold for jewelry at 10x the spot price. Even at spot price, it'd go a long way towards covering the cost of the entire launch.


In a few decades, it looks likely that we'll be able to simulate humans in real-time using a computer the size of a match box. Match box humans. If it takes half a square meter of solar panel to power one match box human, you could sustain a population of 2 trillion in the US alone. If you were to use fusion to convert all the cosmic dust that falls on Earth (let's say, 100 tons) to energy at 1% mass-to-energy ratio, it would generate around 1 PW of energy, which could sustain 10 trillion match box humans running at 100 watts per person.

Blog Archive