Marching cube

A great explanation of the Marching Cube algorithm is here. The algorithm’s goal is to draw meshes of an implicit surface function . Based on the 8 corner points for each tiny cube is above or below the threshold, the mesh triangles for the cube can be easily determined. The algorithm then just iterates over…

Mixin

Mixin is an incomplete class that can be mixed into multiple classes. For example, mixin Fluttering { void flutter() { print(‘fluttering’); } } abstract class Bird with Fluttering { void chirp() { print(‘chirp chirp’); } } Note that the Fluttering mixin can be used in multiple classes. If we want to restrict the mixin to…

Cannot locate adb starting Android emulator in Android Studio

I got this obscure problem and couldn’t resolve it no matter what I tried. It turns out it simply was because I was running virtualbox on another desktop and I wasn’t aware of that. The error is totally misleading. I was using Ubuntu 16.04. After I shut down the other virtual machine, Android emulator started…

Game programming with Flutter and Flame

A very nice video tutorial to build 2D game with Flame/Flutter. I’m new to Flutter and Dart. I usually write in Python and wrote some Java decade ago. Dart is reasonable intuitive if one is familiar with Java or C/C++/C#. I came across some issues going through the tutorial though. I use Ubuntu 16.04 and…

Asynchronous programming in Dart

There are three keywords future, await, async to achieve asynchronous programming in Dart. I found the below example from the official documentation is most insightfull. Future printOrderMessage() async { print(‘Awaiting user order…’); var order = await fetchUserOrder(); print(‘Your order is: $order’); } Future fetchUserOrder() { // Imagine that this function is more complex and slow….