# Octrees

This topic is 1818 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.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 9
• ### Forum Statistics

• Total Topics
634084
• Total Posts
3015403
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!