Twisted Cubes and their Applications in Type Theory