Spaces of generalized splines over T-meshes