Let us put ourselves in the place of him with whom we are angry. At present an overweening conceit of our own importance makes us prone to anger, and we are quite willing to do to others what we cannot endure to be done to ourselves. (Seneca, On Anger, 3.12)
When people injure you, ask yourself what good or harm they thought would come of it. If you understand that, you’ll feel sympathy rather than outrage or anger. Your sense of good and evil may be the same as theirs, or near it, in which case you have to excuse them. Or your sense of good and evil may differ from theirs. In which case they’re misguided and deserve your compassion. Is that so hard? (Marcus Aurelius, Meditation Book VII)
It's common to imagine that when someone makes us angry, their actions were about us. That they either intended to wrong us or, at best, did so out of negligence. But any misdeed, if it exists, is only their logical (from their vantage) response to their own circumstances. We are, at most, a bystander.
When any person does ill by you, or speaks ill of you, remember that he acts or speaks from an impression that it is right for him to do so. Now it is not possible that he should follow what appears right to you, but only what appears so to himself. Therefore, if he judges from false appearances, he is the person hurt, since he, too, is the person deceived. (Epictetus, Enchridion XLII)
When you feel another has treated you unkindly, unfairly, thoughtlessly, or in any way you would understand to be in error, understand that they think the offending act is called for. They are quite possibly wrong, but it makes sense to them because they don't know better. Maybe they don't understand virtue like you do. Maybe they think there is something more important at stake. Maybe someone they trusted led them astray. If you took a moment to consider your impression of events, it shouldn't be too hard for you to imagine a plausible sequence of events that might lead you to act the same way.
We are all the products of our past; our genetics and experience. Yours now includes the capacity to consider events objectively, and from the viewpoint of another. You can dismiss the irrelevant details of your bruised ego or marginally reduced circumstances to see the misfortune of the person who struggles in ignorance and confusion. You have full control over how you will respond.
It shouldn't take much effort to realize that you are the fortunate one in this encounter.