/// <summary> /// Translates the position of the model. /// </summary> /// <param name="state">Current state.</param> /// <param name="offset">Position offset.</param> /// <returns>New state.</returns> public static PerspectiveProjection2DModel Translate(this PerspectiveProjection2DModel state, PointF offset) { var newState = state.Clone(); newState.ImagePosition.X += offset.X; newState.ImagePosition.Y += offset.Y; return(newState); }
/// <summary> /// Converts the model to the array. /// </summary> /// <param name="modelState">Model to convert.</param> /// <returns>Array.</returns> public static double[] ToArray(PerspectiveProjection2DModel modelState) { return(new double[] { modelState.ImagePosition.X, modelState.ImagePosition.Y, modelState.ImageObjectWidth, modelState.Velocity }); }
/// <summary> /// Evaluates the model by using the provided parameters. The velocity value is copied. /// </summary> /// <param name="timeInterval">Time interval.</param> /// <param name="velocityMultiplierConst">Velocity multiplier which is calculated by using: <see cref="CalculateVelocityMultiplierConstant"/> function.</param> /// <returns>New model state.</returns> public PerspectiveProjection2DModel Evaluate(double timeInterval, double velocityMultiplierConst) { var newState = new PerspectiveProjection2DModel(); var multiplier = 1 / (1 + velocityMultiplierConst * this.Velocity * this.ImageObjectWidth * timeInterval); newState.ImagePosition.X = (float)(this.ImagePosition.X * multiplier); newState.ImagePosition.Y = (float)(this.ImagePosition.Y * multiplier); newState.ImageObjectWidth = this.ImageObjectWidth * multiplier; newState.Velocity = this.Velocity; return newState; }
/// <summary> /// Evaluates the model by using the provided parameters. The velocity value is copied. /// </summary> /// <param name="timeInterval">Time interval.</param> /// <param name="velocityMultiplierConst">Velocity multiplier which is calculated by using: <see cref="CalculateVelocityMultiplierConstant"/> function.</param> /// <returns>New model state.</returns> public PerspectiveProjection2DModel Evaluate(double timeInterval, double velocityMultiplierConst) { var newState = new PerspectiveProjection2DModel(); var multiplier = 1 / (1 + velocityMultiplierConst * this.Velocity * this.ImageObjectWidth * timeInterval); newState.ImagePosition.X = (float)(this.ImagePosition.X * multiplier); newState.ImagePosition.Y = (float)(this.ImagePosition.Y * multiplier); newState.ImageObjectWidth = this.ImageObjectWidth * multiplier; newState.Velocity = this.Velocity; return(newState); }
/// <summary> /// Converts the model to the array. /// </summary> /// <param name="modelState">Model to convert.</param> /// <returns>Array.</returns> public static double[] ToArray(PerspectiveProjection2DModel modelState) { return new double[] { modelState.ImagePosition.X, modelState.ImagePosition.Y, modelState.ImageObjectWidth, modelState.Velocity }; }