A Corotational Formulation Based on Hamilton’s Principle for Geometrically Nonlinear Thin and Thick Planar Beams and Frames