bezier-curve: Add toArray/toJSON methods.