So if a car is dangerously close to you and you slap it as a warning, then you are saying the police and courts would have a problem with that??
In a similar situation I had to slap a car that was dangerously close. What else was I supposed to do? Wave? Ring my bell? Let the car hit me and be run over or crash into railings at 20mph?
I fail to visualise how slapping a car at speed can avoid or prevent an incident like you describe. The best I can come up with is that the slap can only agravate the situation by either upsetting your balance and causing a crash or provoking a suspiciously dangerous driver.