def advance_positions(self, lerp_value, eps=1e-2): line_segment = LineSegment(self.position, self.target_position) if line_segment.Length() < eps: self.position = self.target_position else: self.position = line_segment.Lerp(lerp_value) for child in self.child_list: child.advance_positions(lerp_value)
def Length(self): from math2d_line_segment import LineSegment if len(self.point_list) < 2: return 0.0 length = 0.0 for i in range(len(self.point_list) - 1): line_segment = LineSegment(self.point_list[i], self.point_list[i + 1]) length += line_segment.Length() return length