def plot_clip_AABB(p_vs, pMin, pMax, clipf, step=True): dim = p_vs[0].shape[0] if dim == 2: n = None plotter = Plotter2D() elif dim == 3: n = get_normal(p_vs) plotter = Plotter3D() else: return p_vs plotter.plot_contour(p_vs, color='r') plotter.plot_AABB(pMin, pMax, color='b') new_p_vs = clipf(p_vs, pMin, pMax, step=step) plotter.plot_contour(new_p_vs, color='g') print(area(new_p_vs, n)) return new_p_vs
def f(p_vs, pMin, pMax): new_p_vs = clip_AABB_robust(np.array(p_vs), np.array(pMin), np.array(pMax)) return area(new_p_vs, n=get_normal(np.array(p_vs)))