The transition and formation of igneous, metamorphic and sedimentary rock