I had a quick look and found one error. I also have a question.

First the question. Why do you use: TScalar = single;
and then everywhere x : TScalar; instead of x : single;. IMO the last makes it more readable.

I've tried to compile it but it gave an error at line 198 undeclared identifier VectArcCos.