This function computes the locations where a curve self-intersects in a fast and robust way. The curve can be broken with NaNs or have vertical segments. Segments of the curve involved in each of the self-interesections are also provided.
Example of use:
axis ('equal'); grid