Advertisement
Guest User

point3d

a guest
Dec 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. class Point3D:
  2.     def __init__(self, x, y, z, r, phi, psi):
  3.         self.x = x
  4.         self.y = y
  5.         self.z = z
  6.         self.r = r
  7.         self.phi = phi
  8.         self.psi = psi
  9.    
  10.     @staticmethod
  11.     def r_from_cartesian(x, y, z):
  12.         pass
  13.    
  14.     @staticmethod
  15.     def phi_from_cartesian(x, y, z):
  16.         pass
  17.    
  18.     @staticmethod
  19.     def psi_from_cartesian(x, y, z):
  20.         pass
  21.    
  22.     @staticmethod
  23.     def x_from_polar(r, phi, psi):
  24.         pass
  25.    
  26.     @staticmethod
  27.     def y_from_polar(r, phi, psi):
  28.         pass
  29.    
  30.     @staticmethod
  31.     def z_from_polar(r, phi, psi):
  32.         pass
  33.    
  34.     @classmethod
  35.     def from_cartesian(cls, x, y, z):
  36.         r = cls.r_from_cartesian()
  37.         phi = cls.phi_from_cartesian()
  38.         psi = cls.psi_from_cartesian()
  39.         return cls(x, y, z, r, phi, psi)
  40.    
  41.     @classmethod
  42.     def from_polar(cls, r, phi, psi):
  43.         x = cls.x_from_polar(r, phi, psi)
  44.         y = cls.y_from_polar(r, phi, psi)
  45.         z = cls.z_from_polar(r, phi, psi)
  46.         return cls(x, y, z, r, phi, psi)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement