the rapier and the epee are the same weapon, in the same view as the Anschutz Olympic .22 is the same weapon as the SA-80/Steyr AUG/M14/M16. I presume you're talking about the historic rapier BJimS? immortalised by the three musketeers

Thats a weapon designed to deal with the new muskets and aquebuses. Amour was too heavy to carry around if it didn't provide protection, and muskets made armour obsolete, so it was reduced to a light breastplate, since swords no longer needed to be big bludgeons to smash though armour, the rapier took over from the broadsword. But battles were still settled by edged weapons once the muskets had fired since they took too long to reload at that stage.
As to rapier vs Epee, ones a training arm the others a fighting arm. over time the training weapon become the basis for the non-mortal sporting instrument, and training bouts against oppodents become fun sporting events, and duels become competitions.
The cavalry saber became the saber, and the foil is a dumbed down training arm for the epee/rapier
on that note i'm sure theres somewhere a new orleans bowie fighting re-enactment society fighting with blunt blades with felt on the edges dipped in red ink.