Mesh generation using algebraic techniques