def plot(self, ax): """Plots the ball at its current location. :param ax: Figure to plot on. :type ax: matplotlib.axes :returns: Matplotlib figure :rtype: matplotlib.axes """ return plot_sphere(self.position, self.radius, ax)
def plot(self, ax): """Plots the link on the given matplotlib figure :param ax: Figure to plot link upon :type ax: matplotlib.axes :rtype: None """ if self.base_pos is None or self.end_pos is None: raise ValueError("Base and End positions were never defined") plot_sphere(self.end_pos, self.link_size, ax, color='black') # If there's no length associated, we don't have to draw one if self.length == 0 and self.offset == 0: return ax pts = np.vstack((self.base_pos, self.end_pos)) return ax.plot(pts[:, 0], pts[:, 1], pts[:, 2], color='b', linewidth=3)