def get_circumscribed_ellipsoid(self): """ Return a circumscribed ellipsoid of the cylinder. """ semiaxes = np.array(3 * [np.sqrt(2.0) * self.radius], dtype=np.float64) semiaxes[2] *= self.length_to_width mtx = np.diag(1.0 / (semiaxes**2)) return mtx
def get_origin_bounding_box(self): """ Get the ellipsoid's axes-aligned bounding box as if centered at the origin. Return: bbox : 3 x 2 array The bounding box. """ aux = np.sqrt(np.diag(inv(self.mtx)))[:, np.newaxis] return np.c_[-aux, aux]
def get_origin_bounding_box(self): """ Get the ellipsoid's axes-aligned bounding box as if centered at the origin. Return: bbox : 3 x 2 array The bounding box. """ aux = np.sqrt(np.diag(inv(self.mtx)))[:,np.newaxis] return np.c_[-aux, aux]
def __init__(self, semiaxes): """ Parameters: semiaxes : (float, float, float) The semiaxes a, b, c of the ellipsoid. """ self.semiaxes = np.array(semiaxes, dtype=np.float64) self.mtx0 = np.diag(1.0 / (self.semiaxes**2)) im = self.semiaxes.argmax() self.direction0 = np.eye(3, dtype=np.float64)[im] self.volume = 4.0 / 3.0 * np.pi * np.prod(self.semiaxes) self.surface = self.compute_approximate_surface() self.length = self.semiaxes[im] self.is_placed = False self.intersection_counters = {} self.intersector = EllipsoidIntersector()