# Octrees

This topic is 2097 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've understood quadtrees but I have problems with understanding octrees.

quad-trees have a parent node which has 4 children and each child has another 4 children and it keeps on going (we keep on subdividing) until we've reached a certain number of triangles. .

like this

struct qtreeNode

{

qtreeNode* child[4];

};

qtreeNode* parentNode;

but what are octrees? I've read on wiki and it says that it's each internal node has 8 children but honestly I don't understand it (figures are confusing me).

Edited by newtechnology

##### Share on other sites

Quadtrees are a 2D subdivision, octrees are 3D or "2 quadtrees on top of each other".

In quadtrees the division is only in 2 axis (x,y). So the z-position of an object doesn't matter.

In octrees the third axis is also used for subdivision, so the z-position is evaluated, if an object is in the upper or lower quadtree of an octree.

##### Share on other sites

In 2D you draw a North-South line and an East-West line, thus dividing the plane in 4 regions:

* North + East

* North + West

* South + East

* South + West

In 3D, you "draw" a horizontal floor, a North-South wall and an East-West wall, thus dividing the space in 8 regions:

* Up + North + East

* Up + North + West

* Up + South + East

* Up + South + West

* Down + North + East

* Down + North + West

* Down + South + East

* Down + South + West

Does that clear things up?

##### Share on other sites

Understood, thanks.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 16
• 9
• 15
• 9
• 11