It can be viewed as a form of masochism, a sublimated form of sadism, or a means to experiencing algolagnia, a sexual tendency which is defined by deriving sexual pleasure and stimulation from physical pain.
It can be considered a form of masochism, an unconsciously expressed sadistic behavior, or a means to achieve algolagnia, a sexual tendency that includes pleasure derived from physical pain.