How to get the products for a particular category?

Use the \Magento\Catalog\Model\Category::getProductCollection() method:

Usage examples