changed approach to better handle curves defined on a different number of points