def _ellipse_in_shape(shape, center, radii, rotation=0.0):
 (r_lim, c_lim) = np.ogrid[0:float(shape[0]), 0:float(shape[1])]
 (r_org, c_org) = center
 (r_rad, c_rad) = radii
 rotation %= np.pi
 (sin_alpha, cos_alpha) = (np.sin(rotation), np.cos(rotation))
 (r, c) = ((r_lim - r_org), (c_lim - c_org))
 distances = (((((r * cos_alpha) + (c * sin_alpha)) / r_rad) ** 2) + ((((r * sin_alpha) - (c * cos_alpha)) / c_rad) ** 2))
 return np.nonzero((distances < 1))

def _ellipse_in_shape ( shape , center , radii , rotation = 0.0 ) : ( r_lim , c_lim ) = np . ogrid [ 0 : float ( shape [ 0 ] ) , 0 : float ( shape [ 1 ] ) ] ( r_org , c_org ) = center ( r_rad , c_rad ) = radii rotation %= np . pi ( sin_alpha , cos_alpha ) = ( np . sin ( rotation ) , np . cos ( rotation ) ) ( r , c ) = ( ( r_lim - r_org ) , ( c_lim - c_org ) ) distances = ( ( ( ( ( r * cos_alpha ) + ( c * sin_alpha ) ) / r_rad ) ** 2 ) + ( ( ( ( r * sin_alpha ) - ( c * cos_alpha ) ) / c_rad ) ** 2 ) ) return np . nonzero ( ( distances < 1 ) )
generate coordinates of points within ellipse bounded by shape .