Esempio n. 1
0
    def set_time(self, t):
        super(Pendulum, self).set_time(t)

        # manually update time and values
        self.pivot.set_time(t)
        self.weight.set_time(t)

        # align to new position unrotate angle zero by 90 degrees
        self.weight.do_align(Vector.from_polar(1, self._angle_zero * math.cos(t / (math.sqrt(self.weight.r() / scipy.constants.g))) - math.radians(90)))
Esempio n. 2
0
    def _time_velocity(self):
        curtime = self.t
        x = self.t

        self.set_time(curtime-0.1)
        oldweight = Vector.from_vector(self.weight)
        self.set_time(curtime)
        y = Vector(self.weight.x - oldweight.x, self.weight.y - oldweight.y).r()
        return Point(x, y)
Esempio n. 3
0
 def transform(r, point):
     x = r[0][0] * point.x + r[0][1] * point.y
     y = r[1][0] * point.x + r[1][1] * point.y
     return Vector(x, y)