Piero V.

Picking voxels on the Open3D visualizer

While working on my M.S. thesis, I got to know Open3D. To me, it is basically the Swiss army knife for 3D data acquired from reality.

It offers implementations of performant algorithms, Python support to quickly change your scripts or adjust parameters to improve your results, and a visualizer to see them.

Unfortunately, this very visualizer is not very interactive. Often, I would like to pick objects in the scene and drag them or modify them. Sadly, in Python, it is not possible. But it is in C++, and I will comment on how you can implement that.

But first, I suggest you download my code, as I will refer to it. It combines the routines of the following sections to allow picking and deleting voxels.

Interact with the Mouse

Usually, when I want to do something with Open3D, I look at the examples on their Read the Docs documentation. However, they also offer a Doxygen-based one for the C++ part of the library. … [Leggi il resto]

Finally, I booted GC-Linux

The platinum GameCube and Pokémon Colosseum, that I had since I was a kid, and the memory card, SD gecko and microSD card that I bought for this adventure

An obsession for half of my life

When I was a very little kid, my neighbor had a PlayStation One, and I wanted one as as well. I knew almost nothing about video games, I just thought they were cool. Then the PlayStation 2 came out, and I started wanting it.

So, after many years of requests, when I was like 8 or 9, on the Saturday before Christmas, my Dad took me and my syster to a shop close to our home… and we bought a GameCube. He liked a Logitech steering wheel that was for the GC, and, influenced by a shop assistant, we bought the bundle of a platinum GameCube with Mario Kart: Double Dash!!. … [Leggi il resto]

A dynamic character controller for Bullet?

Or, how I tried to create a dynamic character controller for Bullet, but eventually (almost?) gave up.

Motivations

I like spending some time using the Bullet physics library, I already wrote some articles about my experiments with it. This time, I wanted to create a custom character controller.

Bullet alread provides a (kinematic) character controller, but in general it is not regarded as a good one. I also tried to study a bit its code, but, in my opinion, it adds many complications without reason, and even something like managing in the correct way the velocity is a big problem with it. Indeed, Erwin Coumans himself (the main Bullet developer) said that btKinematicCharacterController is not supported anymore.

Therefore I decided to write my own one.

There are two kinds of character controller: kinematic ones and dynamic ones.

The former use the Physics engine, if any, just for collisions, and compute all the movements by themselves. This was the only way at the beginning of the video games, since there was not any Physics engine at all, but only some code for specific purposes. … [Leggi il resto]

Python custom exceptions in C(++) extensions

Python is a nice scripting language, but it has the fame of being difficult to embed and interact with existing projects.

Until now, I have been able to embed it in the software I work on with pybind11 and Binder (half of my MS degree thesis is about that), I had some problems, but I was able to solve most of them. But recently I have experienced a problem that is quite uncommon on the Internet: declaring a new exception in a native (C++/C module) with some custom methods/properties.

The existing proposal

I quickly looked on the Internet for the problem. The Python C API makes creating an exception type possible with PyObject *PyErr_NewException(const char *name, PyObject *bases, PyObject *dict): the first parameter is the name of the exception, in the modulename.ExceptionName format, the second parameter is the base or bases of the new exception (can be a PyType, or a tuple of PyTypes), and a dictionary of custom members and methods for the new type.

However both the second and third parameter can be left to NULL: in this case the new type will inherit from PyExc_Exception and will not have customizations. This is the majority of the cases, and by a search on the CPython code I could not find any reference that could use as an example on how to use the dict parameter. … [Leggi il resto]

Adwaita+Tango for PuTTY

Recently I have started using PuTTY more and more. It is a very nice program that has lots of features but it has also a big problem: with the default settings, fonts and colors are a bit ugly and in some case the text is even difficult to read.

Luckily PuTTY has lots of customization possibilities. My first idea was to use Solarized (Light), because I use it also on my phone with JuiceSSH and on Gedit. However, almost immediately I realized this problem:

ls using the Solarized Light theme: the image shows that it is difficult to tells directories from files

As you can see, directories, files and links have almost the same color and are very difficult to distinguish. Notice that I have enabled the bold as font, which by default is disabled, otherwise directories and links would have normal weight, and it would be even more difficult to what is what. … [Leggi il resto]