Ejemplo n.º 1
0
 def __init__(self, theta_grid: S1Grid, rho_grid: S1Grid):
     self.theta_grid = theta_grid
     self.rho_grid = rho_grid
     theta = np.tile(theta_grid.points, rho_grid.points.shape)
     rho = rho_grid.points
     v = Vector3d.from_polar(theta, rho)
     self.points = v
Ejemplo n.º 2
0
 def get_plot_data(self):
     from texpy.vector import Vector3d
     theta = np.linspace(0, 2 * np.pi + 1e-9, 361)
     rho = np.linspace(0, np.pi, 181)
     theta, rho = np.meshgrid(theta, rho)
     g = Vector3d.from_polar(rho, theta)
     n = Rodrigues.from_rotation(self).norm.data[:, np.newaxis, np.newaxis]
     if n.size == 0:
         return Rotation.from_neo_euler(AxAngle.from_axes_angles(g, np.pi))
     d = (-self.axis).dot_outer(g.unit).data
     x = n * d
     x = 2 * np.arctan(x**-1)
     x[x < 0] = np.pi
     x = np.min(x, axis=0)
     r = Rotation.from_neo_euler(AxAngle.from_axes_angles(g.unit, x))
     return r
Ejemplo n.º 3
0
def test_polar(theta, phi, r, expected):
    assert np.allclose(Vector3d.from_polar(theta, phi, r).data, expected.data, atol=1e-5)