Quadratic Stabilization and Control of Piecewise