Exemplo n.º 1
0
    def _wall_collision_p(self, tma, pa):
        xc = np.array([ self.x[tma][pa],  self.y[tma][pa]])
        vc = np.array([self.vx[tma][pa], self.vy[tma][pa]])

        xw = [-self.p.X, self.p.X]
        yw = [-self.p.Y, self.p.Y]

        xc, vc = collision.wall_collision(xc, vc, self.p.r, \
                                          xw, yw,           \
                                          self.p.R          )

        self.x[tma][pa]  = xc[0]
        self.y[tma][pa]  = xc[1]
        self.vx[tma][pa] = vc[0]
        self.vy[tma][pa] = vc[1]
Exemplo n.º 2
0
    def _wall_collision_p(self, tma, pa):
        xc = np.array([self.x[tma][pa], self.y[tma][pa]])
        vc = np.array([self.vx[tma][pa], self.vy[tma][pa]])

        xw = [-self.p.X, self.p.X]
        yw = [-self.p.Y, self.p.Y]

        xc, vc = collision.wall_collision(xc, vc, self.p.r, \
                                          xw, yw,           \
                                          self.p.R          )

        self.x[tma][pa] = xc[0]
        self.y[tma][pa] = xc[1]
        self.vx[tma][pa] = vc[0]
        self.vy[tma][pa] = vc[1]
Exemplo n.º 3
0
    def _wall_collision_b(self):
        if -self.p.gx < self.bx < self.p.gx:
            # ball could be in the goal
            return

        xc = np.array([ self.bx,  self.by])
        vc = np.array([self.bvx, self.bvy])

        xw = [-self.p.X, self.p.X]
        yw = [-self.p.Y, self.p.Y]

        xc, vc = collision.wall_collision(xc, vc, self.p.rb, \
                                          xw, yw,            \
                                          self.p.R           )

        self.bx  = xc[0]
        self.by  = xc[1]
        self.bvx = vc[0]
        self.bvy = vc[1]
Exemplo n.º 4
0
    def _wall_collision_b(self):
        if -self.p.gx < self.bx < self.p.gx:
            # ball could be in the goal
            return

        xc = np.array([self.bx, self.by])
        vc = np.array([self.bvx, self.bvy])

        xw = [-self.p.X, self.p.X]
        yw = [-self.p.Y, self.p.Y]

        xc, vc = collision.wall_collision(xc, vc, self.p.rb, \
                                          xw, yw,            \
                                          self.p.R           )

        self.bx = xc[0]
        self.by = xc[1]
        self.bvx = vc[0]
        self.bvy = vc[1]