Snake in canvas using homogeneous coordinate transform