Example #1
0
 public void Equals_Object_ReturnsExpected(Matrix3D matrix, object other, bool expected)
 {
     Assert.Equal(expected, matrix.Equals(other));
     if (other is Matrix3D otherMatrix)
     {
         Assert.Equal(expected, matrix.Equals(otherMatrix));
         Assert.Equal(expected, matrix == otherMatrix);
         Assert.Equal(!expected, matrix != otherMatrix);
         Assert.Equal(expected, matrix.GetHashCode().Equals(otherMatrix.GetHashCode()));
     }
 }
Example #2
0
        private static void updateTrackballTransform(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            try
            {
                //if (e.NewValue == e.OldValue)
                //    return;

                bool update = false;

                if (e.OldValue == null && e.NewValue != null)
                {
                    update = true;
                }
                else if (e.NewValue != null && e.OldValue != null)
                {
                    Matrix3D newM = (e.NewValue as Transform3D).Value;
                    Matrix3D oldM = (e.OldValue as Transform3D).Value;

                    if (!newM.Equals(oldM))
                    {
                        update = true;
                    }
                }

                if (update)
                {
                    ViewControlCamera3D control = source as ViewControlCamera3D;
                    control.UpdateTrackball();
                }
            }
            catch
            {
            }
        }