Vector3d GetTangetFromNormal(Vector3d norm, Vector3d dir)
        {
            Vector3d normxdir = Vector3d.cross(norm, dir);
            Vector3d res      = Vector3d.cross(normxdir, norm);

            if ((Math.Abs(res.x) < Epsilon) && (Math.Abs(res.y) < Epsilon) && (Math.Abs(res.z) < Epsilon))
            {
                res = dir.clone();
            }
            res.Normalize();
            //res = res * dir.Mag();
            return(res);
        }
 Vector3d GetTangetFromNormal(Vector3d norm, Vector3d dir)
 {
     Vector3d normxdir = Vector3d.cross(norm, dir);
     Vector3d res = Vector3d.cross(normxdir, norm);
     if ((Math.Abs(res.x) < Epsilon) && (Math.Abs(res.y) < Epsilon) && (Math.Abs(res.z) < Epsilon))
         res = dir.clone();
     res.Normalize();
     //res = res * dir.Mag();
     return res;
 }