Analysing or interpolating scattered data that follow a common centerline, like bathymetry data in a river, may require interpreting the data in terms of their position along and distance from that centerline. For example, river bathymetry varies more strongly laterally to the river centerline than longitudinally.
This submission provides two functions, xy2sn and sn2xy, to transform between cartesian (xy) and curvilinear orthogonal (sn) coordinates using a spline representation of a centerline.
It requires the arclength, interparc, and distance2curve functions by John D'Errico. In the distance2curve function, there is a small bug that needs to be corrected in order for xy2sn to work: Line 453 in distance2curve.m should read "if nargout == 3" instead of "if nargout > 3".
The approach is based on Merwade et al (2005) "Geospatial Representation of River Channels", Journal of Hydrological Engineering, 10, 243-251.