Archive for category Simulation

Traffic Simulation

Traffic SimulationSome time ago I implemented a traffic simulation program in JavaScript, a little less advances than this one (non Java) but with full source disclosure. To make it part of this is the post associated with it. Check it out for a one crossing simulation or a double crossing simulation using the same engine.

No Comments

Virtual Switchboard

Switchboard in real lifeBack when I was in highschool, during some physics lessons we worked with ‘systeemborden‘ (Dutch for ‘system boards‘ or ’switchboards’). It was to learn basic logic gates. They were boards with component on them which you could wire, to make a system. For instance, you could connect a button to a led, which made that when you pressed the button, the led would turn on. You could also instead connect the button to an AND-component, along with a sound-sensor (microphone) and connect the output of the AND-port to the led. That way the led would show light when a sound is made and the button is pushed. There are a lot of other and more complex combinations possible with a lot more different components too. I thought to virtualize it in HTML5 and JavaScript. Have look and play with the switchboard I made (the source code is free and not obfuscated).

No Comments

The Game of Office Decoration

Life LogoThis week I had a discussion with a colleague of mine about decoration for the new office rooms we hired. We thought of an Arduino based project, because it would just be cool to have some fun with the gadget.

We could make a giant board filled with buttons with a led in them. You’d press a button to toggle it. This board could be controlled by an Arduino and display several things on it. A clock for instance or news headlines from an arbitrary RSS feed or… since they’re buttons, Conway’s Game of Life! Read the rest of this entry »

No Comments

Math behind a world sunlight map

World sunlight map fractionMy neighbour has a map of the world on the wall. You can see it from the street in front of his house. It has a backlight but that only illuminates half of the map. The transition from day to night is shaped like a sine wave most of the time. It actually is a physical world sunlight map. Of course, you can simulate this with a computer too. There even is an instance using Google maps.

As many roads lead to Rome multiple ways are possible to this simulation. One could model the sun, earth, maybe more and start ray tracing. This approach would include solar eclipses but is quite heavy by means of the load on the processor. Because of the number of calculations involved in ray tracing is quite high. The way I choose to describe fully in this article is one close to it. Using vectors pointing from a sphere (earth) to a point (sun) I map a Mercator projected map of the world on the sphere. The challenges included are the yearly orbit of earth around the sun and it’s 23.5° tilted 24 hour spin. Read the rest of this entry »