datamodel.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:inf295 作者: Mondego 项目源码 文件源码
def start(self, route=[], v=10):
        r = route

        self.TopSpeed = v
        self.Route = r

        # Calculating position and velocity vector according to route points
        if len(route) > 1:
            self.CurrentRoute += 1
            self.Position = Vector3(r[0]['X'], r[0]['Y'], self.Position.Z)

            ddash = math.hypot(self.Position.X-r[1]['X'], self.Position.Y-r[1]['Y'])
            self.Velocity = Vector3((v/ddash) * (r[1]['X']-self.Position.X), (v/ddash) * (r[1]['Y']-self.Position.Y), 0)
        else:
            self.Position = Vector3(0, 0, self.Position.Z)
            self.Velocity = Vector3(0, 0, 0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号