When someone has angered you, and the light of reason and the standard of God’s law has revealed their error, use all suitable means to make sure that your anger does not hijack your reason.
The first strategy is to consider the nature of grace and the importance of circumstances. Consider how you may have been favored by God in ways that this person was not. Also, reflect on their circumstances and consider that their bad behavior is the result of things that go beyond their control. The goal is not to excuse their behavior nor to negate the necessities of justice, but rather to be freed from the chaos within so that one can clearly decide what is good and just. Disordered emotions cloud reason.
Another exercise to cultivate mercy is to understand and meditate on the nature of hell and purgatory. If a person’s wickedness is clearly such that their soul is in danger, consider the great suffering this person will endure. Be patient with them and pray for conversion. Also consider that even if they should repent, how terrible their experience of purgatory will be and live in Holy fear that you will not share the same fate.
Likewise, to cultivate mercy, think of the many ways that you too have sinned and have done similar things, and marvel at God’s mercy. Hold before your gaze how you deserved hell for your wickedness and yet God in his kindness saved you. Realize you did not earn this mercy, and do the same with others.