Skip to content

evalRelationToAtoms()

Jasmin B. Maglic edited this page Jun 18, 2021 · 1 revision
char Voxel evalRelationToAtoms(std::array<unsigned,3> index_vxl, Vector pos_vxl, int level)

Method of the Voxel class. Evaluates a voxel's position against all atoms and determines whether it is located entirely inside an atom or is entirely accessible by a probe. Otherwise, the type remains unassigned. The function is recursive, in order to take advantage of the octree data structure.

The probe radius is stored as a static variable inside the Voxel class. The voxel position is passed as argument, in order to keep the voxel class as light weight as possible. level refers to the octree level, where the lowest level corresponds to the highest tree depth. The voxel index is the three-number index of the voxel inside the order 3 storage tensor in the Space class.

The function returns the voxel type.

Implementation

If the voxel has already been assigned a final type, i.e. bit position 0 is true, return immediately.

If the voxel has no children, i.e. bit position 7 of its type has value false, then the voxel is evaluated against every atom. After this step, the voxel will have been assigned any of the following types (in binary):

  • 000000011 - Voxel is completely inside an atom. No further evaluation necessary.
  • 100000010 - Voxel is partially inside atom. Marked for splitting. (Not viable for bottom level voxels.)
  • 010000000 or 000100000 - Voxel is potential (large/small) probe shell type. Don't evaluate further.
  • 110000000 or 100100000 - Voxel is partially (large/small) probe core type. Marked for splitting. (Not viable for bottom level voxels.)
  • 000000000 - Voxel is not close enough to any atom, to be identified as atom or shell type. Must be core type.

If the type value is 00000000 then the voxel must be core type, so it gets assigned 00100001 or 00001001, depending on whether the large or small probe is being evaluated respectively.

After this, bit position 7 is checked again, to assess, whether the voxel has been marked for splitting. If yes, then its eight subvoxels are evaluated next.

If the voxel has not been marked for splitting, then its type is passed to all children up to the bottom level voxels. This is necessary because the voxel grid is initiated on all levels. In other words, regardless of whether or not a parent voxel is formally "split" into eight subvoxels, the eight children exist in memory. They need to be assigned the parent type, so that - for instance - surface maps can be correctly exported.

Clone this wiki locally