daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Dec 9th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. X       Y       Z
  2. 0   0.65612 0.53440 0.24175
  3. 1   0.62279 0.51946 0.25744
  4. 2   0.61216 0.53959 0.26394
  5.    
  6. import numpy as np
  7. import matplotlib.pyplot as plt
  8. from mpl_toolkits.mplot3d import Axes3D
  9.  
  10. points = [[0.65612, 0.53440, 0.24175],
  11.            [0.62279, 0.51946, 0.25744],
  12.            [0.61216, 0.53959, 0.26394]]
  13.  
  14. p0, p1, p2 = points
  15. x0, y0, z0 = p0
  16. x1, y1, z1 = p1
  17. x2, y2, z2 = p2
  18.  
  19. ux, uy, uz = u = [x1-x0, y1-y0, z1-z0]
  20. vx, vy, vz = v = [x2-x0, y2-y0, z2-z0]
  21.  
  22. u_cross_v = [uy*vz-uz*vy, uz*vx-ux*vz, ux*vy-uy*vx]
  23.  
  24. point  = np.array(p0)
  25. normal = np.array(u_cross_v)
  26.  
  27. d = -point.dot(normal)
  28.  
  29. xx, yy = np.meshgrid(range(10), range(10))
  30.  
  31. z = (-normal[0] * xx - normal[1] * yy - d) * 1. / normal[2]
  32.  
  33. # plot the surface
  34. plt3d = plt.figure().gca(projection='3d')
  35. plt3d.plot_surface(xx, yy, z)
  36. plt.show()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top