def theta(): p = 0.23e-3 f = 0.23e-3 / 2 xp = 0.0127046 yp = 0.350885 m = xp / p v = Vector(xp, yp - f, 0.) v.normalization() t = Vector(xp / p, -1, 0.) t.normalization() print((np.arccos(v.dot(t))) * 180. / np.pi) return np.arccos(v.dot(t))
def test_dot_product_vector(self): print(">> test_dot_product_vector") v=Vector(0.,1.,0.) dot_product=v.dot(v) print(dot_product) assert_almost_equal(dot_product, 1., 15)
beam.y = b3 beam.z = b2 beam.z = -beam.z + f p = wolter_japanese.oe[0].p q = wolter_japanese.oe[0].q beta = np.arccos((p**2 + 4 * f**2 - q**2) / (4 * p * f)) y = -p * np.sin(beta) z = f - p * np.cos(beta) v = Vector(0., y, z - f) v.normalization() v0 = Vector(0., 0., -1.) v0.normalization() alpha = np.arccos(v.dot(v0)) t = (-v.x * beam.x - v.y * beam.y - v.z * beam.z) / (v.x * beam.vx + v.y * beam.vy + v.z * beam.vz) beam.x += beam.vx * t beam.y += beam.vy * t beam.z += beam.vz * t velocity = Vector(beam.vx, beam.vz, -beam.vy) velocity.rotation(-alpha, 'x') beam.vx = velocity.x beam.vy = velocity.y beam.vz = velocity.z wolter_japanese.oe[0].set_parameters(p=0., q=0., theta=90 * np.pi / 180)