local orthogonal bases I: construction