The shape and topological optimizations connection