public static Rot3f Original(V3f from, V3f into)
            {
                var angle = from.AngleBetween(into);

                if (angle < 1e-6f)
                {
                    return(Rot3f.Identity);
                }
                else if (Constant.PiF - angle < 1e-6f)
                {
                    return(new Rot3f(0, from.AxisAlignedNormal()));
                }
                else
                {
                    V3f axis = Vec.Cross(from, into).Normalized;
                    return(Rot3f.Rotation(axis, angle));
                }
            }
Esempio n. 2
0
        public DistanceRot3f()
        {
            var rnd = new RandomSystem(1);

            A.SetByIndex(i => RndRot(rnd));
            angles.SetByIndex(i =>
            {
                float a = 0;
                do
                {
                    a = RndAngle(rnd);
                }while (a == 0);

                return(a);
            });

            B.SetByIndex(i =>
            {
                var r = Rot3f.Rotation(RndAxis(rnd), angles[i]);
                return(r * A[i]);
            });
        }
Esempio n. 3
0
 private static Rot3f RndRot(RandomSystem rnd)
 => Rot3f.Rotation(RndAxis(rnd), RndAngle(rnd));