brandonpelfrey / SimpleOctree

A simple octree with good commenting for learning how octrees work.
MIT License
254 stars 74 forks source link

Range of Points #5

Open ShubhamCpp opened 7 years ago

ShubhamCpp commented 7 years ago

Hi Brandon,

Why does it specifically work only for points in the range of [-1, 1]. Is there a way to make it work for all ranges of Points?

Sorry for the noob question.

fdmatoz commented 6 years ago

Reading the code and the documentation it's seems that we define in the first line of the main the following octree size :

// Create a new Octree centered at the origin // with physical dimension 2x2x2 octree = new Octree(Vec3(0,0,0), Vec3(1,1,1));

so basically your space os bounded by -1 and 1. Now, I haven't use the code yet, but what you can do, if changing the code doesn't work for bigger numbers, is simply "scale" your numbers so fit into [-1,1] simply doing NUM/NUM_MAX where NUM is you number and NUM_MAX is the maximum value that your NUM can be.

cheers!