Skip to content

isExcludedByPair()

Jasmin B. Maglic edited this page Jan 30, 2022 · 4 revisions

This page no longer reflects actual code

bool Voxel::isExcludedByPair(const Vector& vec_vxl, const Vector& vec_atat, const double& rad_atom1, const double& rad_atom2, const double& rad_probe);

This method checks whether a pair of atoms make the voxel inaccessible by a spherical probe. The voxel position is given by the vector vec_vxl relative to one of the atoms. The vector vec_atat points from the atom located at the origin to the other atom. The radii of the atoms are given by rad_atom1 and rad_atom2, and the radius of the probe is given by rad_probe.

This problem can be reduced to a 2 dimensional problem, by conducting all calculations in the plane spanned by the two vectors. Furthermore, the two atoms only allow a hypothetical probe to protrude between the atoms to a defined point. This point, together with the centres of the two atoms define a triangle that is useful for the calculations.

Process

The test whether the voxel is inaccessible is conducted in three steps. In a first step, the vector pointing from one to the other atom is normalised to yield a unit vector parallel to the axis. By calculating the dot product between the unit vector and the vector pointing to the voxel, one obtains the component of the latter along the former as a scalar.

By comparing the length of the parallel component of the voxel vector with the distance between the atoms, it is possible to exclude all voxels not between the atoms.

In the next step, the method determines whether the voxel is inside the triangle spanned by the closest probe position and the atom positions. For that, the angles at the corners of the triangle are compared by the angles of another triangle defined by both atoms and the voxel position. It is enough to compare two sets of angles in order to determine that the voxel is inside the triangle. All other voxels can be dismissed.

Finally, the vector pointing to the probe position is determined in terms of the unit vectors parallel and orthogonal to the axis connecting the atoms. Once such vector is available, it is possible to compare the calculate the vector pointing to the voxel from the probe centre. If the length of this vector exceeds the probe's radius, then the voxel is inaccessible by the probe and true is returned.

Clone this wiki locally