If I tell you that someone died in a car accident you might respond with a simple, "Wow, that's really unfortunate" or some other disassociated response. As soon as I let you know that the person that died in the car accident is someone very close to you it's a different story, completely different emotional triggers go off. Now why is that? The information is essentially the same, you would just choose to react different based on the context of that information.
The same is true with interactions with other people. Someone says or does something that upsets you... why does it upset you? Well, you have chosen to be upset about it for some reason. If you can get down low enough to the point of understanding why you've gotten upset over what someone has done then that's the first steps towards controlling your response.
In your recent case, someone violated your space and made you feel vulnerable in a place you'd formerly felt safe. That can be a jarring experience and it's perfectly normal and healthy to have an emotional reaction to this. Immediately going towards violence is not healthy though, that degree is something you've chosen based on something else going on in your life/past.