I believe a logic similar to this was used to enact the "Gestures" system in Black and White 1. Breaking down the mouse-movements into vectors following a guide-point. (https://blackandwhite.fandom.com/wiki/Gesture).
Damn, what a flashback. I forgot about that game, it was quite something for its time. I remember the gesture spell casting system not working very consistently, but it was still a ton of fun.