domenica 24 luglio 2016

Day 152: Starting to work on octrees

Today I noticed that the book I'm following only introduces octrees, and doesn't provide the full implementation. Today I spent quite a bit of time researching how to implement them.
I'm not talking about the struct itself, which is pretty easy, but about those grey areas where more than one approach might be possible.
I'm talking about:

1) How to store an object with a shape:
The possible alternatives seems to be: store it in more than one leaf, or store them in the smaller inner node that contains it all.

2) How to handle memory:
Is it better to preallocate all the nodes up to a certain depth, or dinamically malloc / dealloc nodes that are used / removed?

Until I figure the best overall implementation choices I'll avoid to jump into implementation. Today I just wrote the skeleton of the class.

Nessun commento:

Posta un commento