def draw(self, origin, scale, colors): bob_theta, _ = self.state bob_delta_polar = Vector(0, bob_theta) pushMatrix() translate(*origin) stroke(colors[0]) x, y = scale * polar2rect(bob_delta_polar + self.bob_pos_rest, flip_y = True) line(0, 0, x, y) circle(x, y, self.bob_size) popMatrix()
def draw(self, origin, scale, colors): bob_theta, _ = self.state bob_delta_polar = Vector(0, bob_theta) pushMatrix() translate(*origin) stroke(colors[0]) x, y = scale * polar2rect(bob_delta_polar + self.bob_pos_rest, flip_y=True) line(0, 0, x, y) circle(x, y, self.bob_size) popMatrix()
def draw(self, origin, scale, colors): bob_theta1, _, bob_theta2, _ = self.state bob_delta_polar1 = Vector(0, bob_theta1) bob_delta_polar2 = Vector(0, bob_theta2) pushMatrix() translate(*origin) stroke(colors[0]) x1, y1 = scale * polar2rect(bob_delta_polar1 + self.bob_pos_rest1, flip_y = True) line(0, 0, x1, y1) circle(x1, y1, self.bob_size1) translate(x1, y1) stroke(colors[1]) x2, y2 = scale * polar2rect(bob_delta_polar2 + self.bob_pos_rest2, flip_y = True) line(0, 0, x2, y2) circle(x2, y2, self.bob_size2) popMatrix()