Skip to content
Jasmin B. Maglic edited this page Jul 29, 2021 · 8 revisions

This small class defines individual voxels and subvoxels. Voxels are essentially 3D pixels, cubic in shape. The only information contained within instances of this class is their type and their identity (see below). Furthermore, Voxel objects may be part of an octree, i.e., be a parent to eight children. Positional information about voxels is not stored explicitly, but can be inferred from the corresponding Space object, in which all voxel objects are stored.

Top-Level and Bottom-Level Voxels

It makes sense to distinguish between without parent voxel, i.e., top-level voxels, and the smallest subvoxels that any voxel may be broken down to, i.e., bottom-level voxels.

Top-level voxels are stored in a vector within an instance of the Space class. If during the type assignment routine a voxel is determined to be of "mixed" kind, the voxel is split into eight subvoxels that have half the edge length and are spatially arranged in a 2×2×2 grid, such that they fill out the parent voxel. The eight subvoxels are stored inside the Space object.

This splitting cannot continue indefinitely, nor does it need to for a sufficiently accurate result. Once the subvoxels have hit a maximum tree depth and have thus also hit the minimum grid resolution (both specified by the user), the "mixed" type becomes forbidden and no more splitting can occur. These are bottom-level voxels.

The bottom-level voxel edge length is the value that determines the resolution of the volume calculation. The octree depth, on the other hand, determines the efficiency of the algorithm. Increasing the octree depth can reduce the number of voxels that need to be evaluated

Since the user specifies both the bottom-level voxel edge length r and the maximum tree depth d, the top-level voxel's edge length rmax is never explicitly expressed. It can, however, be obtained from the other two inputs.

f-dist

Types

Voxels can be assigned different types, based on their relation to surrounding atoms. In the case of bottom-level voxels only the centre position is relevant.

The voxel type is stored in a byte where each bit marks a different type. All types are therefore orthogonal to each other.

Bitposition:

  • 0 - Final type has been assigned, do not change anymore.
  • 1 - Voxel is inside of an atom.
  • 2 - Voxel is inaccessible by probe.
  • 3 - Voxel is accessible by small probe core.
  • 4 - Voxel is accessible by small probe shell but not core.
  • 5 - Voxel is accessible by large probe core.
  • 6 - Voxel is accessible by large probe shell but not core.
  • 7 - Voxel contains subvoxels.

The bit positions run from right to left, i.e. 76543210.

Parent voxel types are determined by the types of all children. The parent type is determined by a bitwise OR operation for all bit positions except 0 and 7. Bit position 0 is determined by a bitwise AND operation while bit position 7 is set to true.

Identity

The identity is an integer number used to determine which cavity a voxel belongs to. Voxels belonging to the same cavity are assigned the same identity. For core type voxels, any other core or shell type neighbor voxel is assigned the same identity. Identities are assigned as part of a flood fill algorithm.

Methods

Members

  char _type
  unsigned char _identity
  static Space* s_cell
  static AtomTree* s_atomtree
  static double s_r_probe
  static bool s_masking_mode
  static SearchIndex s_search_index
Clone this wiki locally