works for D-dimensional ESS and k-plans, reducing 1 dimension at a time