(self, xy, tol=0.1)
| 117 | return 0.8 * cost1 + 0.2 * cost2 * cost1 |
| 118 | |
| 119 | def contains_points(self, xy, tol=0.1): |
| 120 | ca = math.cos(self.theta) |
| 121 | sa = math.sin(self.theta) |
| 122 | x_demean = xy[:, 0] - self.x |
| 123 | y_demean = xy[:, 1] - self.y |
| 124 | return ( |
| 125 | ((ca * x_demean + sa * y_demean) ** 2 / (0.5 * self.width) ** 2) |
| 126 | + ((sa * x_demean - ca * y_demean) ** 2 / (0.5 * self.height) ** 2) |
| 127 | ) <= 1 + tol |
| 128 | |
| 129 | def draw(self, show_axes=True, ax=None, **kwargs): |
| 130 | import matplotlib.pyplot as plt |
no outgoing calls