Octree

In a matrix-based (MX) octree, the subdivision point is implicitly the center of the space the node represents.The node index to branch out from at the top level is determined by a formula that uses the most significant bits of the red, green, and blue color components, e.g. 4r + 2g + b.Once sampling is complete, exploring all routes in the tree down to the leaf nodes, taking note of the bits along the way, will yield approximately the required number of colors.The example recursive algorithm outline below (MATLAB syntax) decomposes an array of 3-dimensional points into octree style bins.Examples of such exit conditions (shown in code below) are: Taking the full list of colors of a 24-bit RGB image as point input to the Octree point decomposition implementation outlined above, the following example show the results of octree color quantization.
Left: Recursive subdivision of a cube into octants . Right: The corresponding octree.
Time complexitybig O notationSpace complexityoctantstree data structureinternal nodechildrenthree-dimensional spacerecursively subdividingquadtrees3D graphicsgame enginesthree-dimensional pointk-d treesdepth-first search3D computer graphicsRensselaer Polytechnic Institutepriority dateLevel of detailSpatial indexingNearest neighbor searchcollision detectionView frustum cullingFast multipole methodUnstructured gridFinite element analysisSparse voxel octreeState estimationSet estimationcolor quantizationMATLABBinary space partitioningBounding interval hierarchyid Tech 6Irrlicht EngineKlee's measure problemLinear octreeSubpavingQuadtreeTree data structuresSearch treesdynamic setsassociative arrays2–3–4OptimalBinary searchDancingIntervalOrder statisticPalindromeLeft-leaningRed–blackScapegoatWeight-balancedBinaryBinomialBrodalFibonacciLeftistPairingSkew binomialvan Emde BoasC-trie (compressed ADT)SuffixTernary searchX-fastY-fastSpatialCartesianHilbert Rimplicit k-dMetricPriority RSegmentExponentialFenwickFingerFractal tree indexFusionHash calendariDistanceLeft-child right-siblingLink/cutLog-structured mergeMerkle