// https://stackoverflow.com/questions/1171849/finding-quaternion-representing-the-rotation-from-one-vector-to-another
 public static __rot3t__ HalfWayVec(__v3t__ from, __v3t__ into)
 {
     if (from.Dot(into).ApproximateEquals(-1))
     {
         return(new __rot3t__(0, from.AxisAlignedNormal()));
     }
     else
     {
         __v3t__   half = Vec.Normalized(from + into);
         __quatt__ q    = new __quatt__(Vec.Dot(from, half), Vec.Cross(from, half));
         return(new __rot3t__(q.Normalized));
     }
 }
            public static __rot3t__ HalfWayQuat(__v3t__ from, __v3t__ into)
            {
                var d = Vec.Dot(from, into);

                if (d.ApproximateEquals(-1))
                {
                    return(new __rot3t__(0, from.AxisAlignedNormal()));
                }
                else
                {
                    __quatt__ q = new __quatt__(d + 1, Vec.Cross(from, into));
                    return(new __rot3t__(q.Normalized));
                }
            }
Example #3
0
 public __type__(__quatt__ q)
 {
     /*# qfields.ForEach(f => {*/ __f__ = q.__f__; /*# });*/
     __assertNorm__;
 }