octadist.projection

octadist.src.projection.project_atom_onto_line(p, a, b)[source]

Find the point projection on the line, which defined by two distinct end points.

a <----> b

P(x) = x1 + (p - x1).(x2 - x1)/(x2-x1).(x2-x1) * (x2-x1)
Parameters:
  • p (array_like) – Coordinate of point to project.

  • a (array_like) – Coordinate of head atom of the line.

  • b (array_like) – Coordinate of tail atom of the line.

Returns:

projected_point (array_like) – The projected point on the orthogonal line.

Examples

>>> # point to project
>>> p = [10.1873, 5.7463, 5.615]
>>> # head and end points of line
>>> a = [8.494, 5.9735, 4.8091]
>>> b = [9.6526, 6.4229, 7.3079]
>>> project_atom_onto_line(p, a, b)
[9.07023235 6.19701012 6.05188388]
octadist.src.projection.project_atom_onto_plane(p, a, b, c, d)[source]

Find the orthogonal vector of point onto the given plane. The equation of plane is Ax + By + Cz = D and point is (L, M, N), then the location on the plane that is closest to the point (P, Q, R) is

(P, Q, R) = (L, M, N) + λ * (A, B, C)

where λ = (D - ( A*L + B*M + C*N)) / (A^2 + B^2 + C^2).
Parameters:
  • p (array_like) – Point to project.

  • a (int or float) – Coefficient of the equation of the plane.

  • b (int or float) – Coefficient of the equation of the plane.

  • c (int or float) – Coefficient of the equation of the plane.

  • d (int or float) – Coefficient of the equation of the plane.

Returns:

projected_point (array_like) – The projected point on the orthogonal plane.

Examples

>>> # point to project
>>> p = [10.1873, 5.7463, 5.615]
>>> # coefficient of the equation of the plane
>>> a = -3.231203733528
>>> b = -0.9688526458499996
>>> c = 0.9391692927779998
>>> d = -4.940497273569501
>>> project_atom_onto_plane(p, a, b, c, d)
[2.73723598 3.51245316 7.78040705]