internal Uniform6DTransformation(AnimatableWrapper wrapper, Motion6D.ReferenceFrame frame, bool realtime, double[] changeFrameTime, TimeSpan forecastTime) { transform.Children.Add(rotate_uniform); // Adds uniform rotation transform.Children.Add(rotate_const); // Adds constant rptation transform.Children.Add(translation); // Adds translation rotate_const.Rotation = quaternionConstRotation; // Setting quaterion for constant rotation rotate_uniform.Rotation = angle_uniform; // Setting axis rotation for uniform rotation this.wrapper = wrapper; animatable = wrapper.Animatable; dependencyProperty = wrapper.DependencyProperty; this.frame = frame; this.changeFrameTime = changeFrameTime; From = 0; To = 1; calculator = new Motion6D.Uniform6D.Uniform6DMotion(frame, rotationAxis, changeFrameTime, forecastTime.TotalSeconds, wrapper.Animated.CoordinateError, wrapper.Animated.AngleError); animated = wrapper.Animated; forecast = animated.ForecastTime; this.realtime = realtime; if (realtime) { calculator.InitializePrediction(forecast.TotalSeconds); } calculator.Change += Motion_Change; }
internal AnimatableWrapper(IAnimatable animatable, DependencyProperty dependencyProperty, IAnimatedObject animatedObject, bool realtime, double[] changeFrameTime) { this.animatable = animatable; this.dependencyProperty = dependencyProperty; value = (animatable as DependencyObject).GetValue(dependencyProperty); this.animatedObject = animatedObject; transformation = new Uniform6DTransformation(this, animatedObject.ReferenceFrame, realtime, changeFrameTime, animatedObject.ForecastTime); }
/// <summary> /// Enqueue animated object /// </summary> /// <param name="animatedObject">Animated Object</param> /// <param name="timeSpan">Time Span</param> internal static void Enqueue(this IAnimatedObject animatedObject, TimeSpan timeSpan) { ReferenceFrame frame = animatedObject.ReferenceFrame; double[] position = new double[3]; Array.Copy(frame.Position, position, 3); double[] quaternion = new double[4]; Array.Copy(frame.Quaternion, quaternion, 4); Tuple<TimeSpan, double[], double[]> parameters = new Tuple<TimeSpan, double[], double[]>(timeSpan, position, quaternion); foreach (AnimatableWrapper wrapper in animatedObject.Children) { wrapper.Enqueue(parameters); } }