We study several meshing problems from the point of view of sampling and numerical optimization. This specific point of view means optimizing the mesh by minimizing an objective function that depends on the coordinates at all the vertices of the mesh. The objective function that we minimize is similar to the one that defines Centroidal Voronoi Tesselation (quantization noise power). We propose efficient algorithms to minimize such objective functions and present some applications to surface and volume meshing (isotropic surface remeshing and hex-dominant volume meshing).