Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7797873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:49:37+00:00 2026-06-01T23:49:37+00:00

This is something I’ve been thinking about for the past couple hours. This is

  • 0

This is something I’ve been thinking about for the past couple hours. This is a mind exercise.

So I learned what octrees were today! Very interesting! I’ve been thinking through how to implement an octree that resolved to a voxel.

My biggest issue I can’t wrap my head around right now, is referencing a position in the octree.

Disclaimer: First, I’m going to be using quadtrees in a 2D plane to visualize my problem. Second, I do not understand the correct jargon here, I’m going to assume any subdivision in an octree that is a parent is a “branch” and any subdivision that is only a child (in this case it resolves to a voxel) is a “leaf”. Third, I’m going to number each space in a branch of a quadtree left-to-right top-to-bottom {1,2,3,4}

Let’s say I have an quadtree that defines a 16×16 unit space. In location [16,16] I have a voxel stored.

4->4->4->4

Now say we add a voxel to position [4,4]. (Note, we start at zero)

1->4->1->1
4->4->4->4

Now let’s say I want to check [16,8] to see if a voxel is stored. Using the previous method we would technically traverse these branches:

4->1->1->1

However 4->1 has not been allocated with any data so it is empty. (it does not subdivide because it is not in use).

My question becomes this, how could I quickly traverse the quadtree to find the voxel?

My first and easiest method would be travelling down the branches in the format I used above.

// Pseudo-code
Class Quadtree {
Quadtree Parent;
Quadtree c[4]; // children
};

Quadtree test1;
test1.c[4].c[4].c[4].c[4];
Quadtree test2;
test2.c[1].c[4].c[1].c[1];

The issue here is that voxelArray[16][16], voxelArray[4][4], or voxelArray[16][8] is much faster. Using a much larger quadtree (256×256) would increase the depth (from 4 to 8). Where nested arrays are still 2 memory operations. (Note, for the quadtree, in reality we would be using something of an accessor and checking to make sure the childs existed with conditional logic)

My second thought was to store the quadtrees as voxels themselves. For example, say we have an 2×2 array, empty it would look like

{0, 0, 0, 0}

At position [1,1] we would add a voxel and it would become

{0, 0, 0, 1}

If we were to store the quadtree it would look something like this

{1/*q*/, 0, 0, 0, 1}

Take this to a 4×4 and

{0/*q*/, 0, 0, 0, 
 0/*q*/, 0, 0, 0, 
 0/*q*/, 0, 0, 0, 
 1/*q*/, 0, 0, 1}

Although now you can access the data directly, you’ve lost the memory compactness of the quadtree and you still perform many logic operations. IMO this would only work well if you had big areas of 0s and small groupings of 1s.

By storing voxels in a quadtree/octree, you gain performance when looping through them all, but lose performance when directly accessing them.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:49:39+00:00Added an answer on June 1, 2026 at 11:49 pm

    You can compute a quadkey and then hash each voxel. The idea is to reduce the dimensional complexity. You can look for example for hamiltonian path or z curve or a hilbert curve. This path traverse the plane completely but it’s technically still a curve.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is something that's been bugging me for many years: why most online services
This is something i have wondered for a while and decided to ask about
I have about 500+ memory warnings after running the static analyzer. Is this something
Something I have been curious about for quite sometime now. How exactly do you
Is this something I shouldn't try?
When you have code like this: Something something = new Something(); BlahEntities b =
I need to break apart a string that always looks like this: something --
I am getting many of the following warning messages. Is this something I should
This Code: Something = new Guid() is returning: 00000000-0000-0000-0000-000000000000 all the time and I
This is something I know can be done somehow , because I've done it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.