Distributing N points on a sphere

February 25, 2013 at 22:55

In one of my PhD projects, I had the need to distribute n points on a sphere of radius r. I found a very interesting post in stackoverflow about how to solve the problem and I tested a few of the solutions they proposed by myself. In my opinion, one of the most elegant solutions consists in using a spiral function to distribute the points uniformly. Below you can find a little snippet in Python which uses the spiral method to calculate a list of n points (thanks to my colleague Iain for sharing his source code with me):

This function is based on the original work “Minimal Discrete Energy on the Sphere” which you can find online here.

An this is how a sphere of radius 10 with 300 points looks.

Points on a sphere using the spiral method

Points on a sphere using the spiral method

Panda3D and rapid prototyping

October 14, 2012 at 12:59

A new project I’m involved in requires a walking skeleton in a few weeks and it consists of a 3D interface where some proteins are displayed. My first idea was to reuse some C++ libraries I coded a couple months ago to read and parse PDB files (proteins) and use what I know from Qt and OpenGL to display them. But wait, what about time constraints? My friend trikitrok recommended me to have a look at the state-of-the-art python 3D engines and I ended in the Python wiki checking the Python Games section. After comparing them, I chose Panda3D. The main reasons why I chose it are:

  1. Panda3D is free and open source. It also includes proprietary parts, but there is always free code to avoid them already encoded in the engine.
  2. It’s being developed by Disney and Carnegie Mellon and it has been tested in real (and commercial) projects.
  3. The core is written in C++, but Python bindings are available. It’s possible to code some parts in C++ and the rest in Python.
  4. Documentation is simply exquisite.
  5. Really good samples included in the engine.

And which is the result? In three days I’ve encoded most of the functionalities required and the application looks sexy!

I even had time to play with pixel shading and cartoon filters 🙂

Despite I didn’t optimize any line of code, the application runs fluid and if the project goes on I could code the critical parts in C++ to gain performance. I’m absolutely in love with Panda3D engine 🙂