How do I trim an open curve with given points?