The perfect intellectual operation in man consists in an abstraction from sensible phantasms, wherefore the more a man's intellect is freed from those phantasms, the more thoroughly will it be able to consider things intelligible, and to set in order all things sensible. Thus Anaxagoras stated that the intellect requires to be "detached" in order to command, and that the agent must have power over matter, in order to be able to move it. Now it is evident that pleasure fixes a man's attention on that which he takes pleasure in: wherefore the Philosopher says (Ethic. x, 4,5) that we all do best that which we take pleasure in doing, while as to other things, we do them either not at all, or in a faint-hearted fashion.
Now carnal vices, namely gluttony and lust, are concerned with pleasures of touch in matters of food and sex; and these are the most impetuous of all pleasures of the body. For this reason these vices cause man's attention to be very firmly fixed on corporeal things, so that in consequence man's operation in regard to intelligible things is weakened, more, however, by lust than by gluttony, forasmuch as sexual pleasures are more vehement than those of the table. Wherefore lust gives rise to blindness of mind, which excludes almost entirely the knowledge of spiritual things, while dullness of sense arises from gluttony, which makes a man weak in regard to the same intelligible things. On the other hand, the contrary virtues, viz. abstinence and chastity, dispose man very much to the perfection of intellectual operation. Hence it is written (Dan. 1:17) that "to these children" on account of their abstinence and continency, "God gave knowledge and understanding in every book, and wisdom."
-Saint Thomas Aquinas, Summa Theologica, II ii, Q 15 Art. 3