octadist.plane
- octadist.src.plane.find_eq_of_plane(x, y, z)[source]
Find the equation of plane of given three points using cross product:
The general form of plane equation: Ax + By + Cz = D where A, B, C, and D are coefficient. XZ X XY = (a, b, c) d = (a, b, c).Z
- Parameters:
x (array_like) – 3D Coordinate of point.
y (array_like) – 3D Coordinate of point.
z (array_like) – 3D Coordinate of point.
- Returns:
a (float64) – Coefficient of the equation of the plane.
b (float64) – Coefficient of the equation of the plane.
c (float64) – Coefficient of the equation of the plane.
d (float64) – Coefficient of the equation of the plane.
Examples
>>> N1 = [2.298354000, 5.161785000, 7.971898000] >>> N2 = [1.885657000, 4.804777000, 6.183726000] >>> N3 = [1.747515000, 6.960963000, 7.932784000] >>> a, b, c, d = find_eq_of_plane(N1, N2, N3) >>> a -3.231203733528 >>> b -0.9688526458499996 >>> c 0.9391692927779998 >>> d -4.940497273569501
- octadist.src.plane.find_fit_plane(coord)[source]
Find best fit plane to the given data points (atoms).
- Parameters:
coord (array_like) – Coordinates of selected atom chunk.
- Returns:
xx (float) – Coefficient of the surface.
yy (float) – Coefficient of the surface.
z (float) – Coefficient of the surface.
abcd (tuple) – Coefficient of the equation of the plane.
See also
scipy.optimize.minimize
Used to find the least-square plane.
Examples
>>> points = [(1.1, 2.1, 8.1), (3.2, 4.2, 8.0), (5.3, 1.3, 8.2), (3.4, 2.4, 8.3), (1.5, 4.5, 8.0), (5.5, 6.7, 4.5) ] >>> # To plot the plane, run following commands: >>> import matplotlib.pyplot as plt >>> # map coordinates for scattering plot >>> xs, ys, zs = zip(*points) >>> plt.scatter(xs, ys, zs) >>> plt.show()