well i now know why i'am getting -1.#IND errors.

doing arcsin needs a number input of range -1.0 - 1.0, of which the equation doesn't seem to be giving on some occasions.

Also in C++ the angles are in radians for all calculations which no doubt causes some problem, yet ironically 80% of my rotations work