Ejemplo n.º 1
0
    def test_sum_vector(self):
        print(">> test_sum_vector")
        v=Vector(0.,1.,0.)
        v2=v.sum(v)

        print(v2.info())
        assert_almost_equal(v2.x, 0.0, 15)
        assert_almost_equal(v2.y, 2., 15)
        assert_almost_equal(v2.z, 0., 15)
Ejemplo n.º 2
0
    def test_sum_list_vector(self):
        print(">> test_sum_list_vector")

        x=np.zeros(10)
        y=np.ones(10)
        z=np.zeros(10)
        v=Vector(x,y,z)
        v2=v.sum(v)
        assert_almost_equal(v2.x, np.zeros(10), 15)
        assert_almost_equal(v2.y, 2*np.ones(10), 15)
        assert_almost_equal(v2.z, np.zeros(10), 15)
Ejemplo n.º 3
0
    def mirror_output_direction(self,beam):

        if self.type == "Surface conical mirror":
            normal_conic = self.ccc_object.get_normal(np.array([beam.x, beam.y, beam.z]))
        elif self.type == "My hyperbolic mirror":
            normal_conic = self.ccc_object.get_normal(np.array([beam.x, beam.y, beam.z]))
        elif self.type == "Surface conical mirror 2":
            normal_conic = self.ccc_object.get_normal(np.array([beam.x, beam.y, beam.z]))

        normal = Vector(normal_conic[0,:],normal_conic[1,:], normal_conic[2,:])
        velocity = Vector(beam.vx, beam.vy, beam.vz)
        vperp = velocity.perpendicular_component(normal)
        v2 = velocity.sum(vperp)
        v2 = v2.sum(vperp)
        [beam.vx, beam.vy, beam.vz] = [v2.x, v2.y, v2.z]