AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
InterpolatedVector2.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using System;
5 using UnityEngine;
6 
7 namespace HoloToolkit.Unity
8 {
12  [Serializable]
13  public class InterpolatedVector2 : InterpolatedValue<Vector2>
14  {
18  public InterpolatedVector2() : this(default(Vector2)) { }
19 
25  public InterpolatedVector2(Vector2 initialValue, bool skipFirstUpdateFrame = false)
26  : base(initialValue, skipFirstUpdateFrame)
27  {
28  }
29 
37  public override bool DoValuesEqual(Vector2 one, Vector2 other)
38  {
39  return (one - other).sqrMagnitude <= SmallNumberSquared;
40  }
41 
50  public override Vector2 ApplyCurveValue(Vector2 startValue, Vector2 targetValue, float curveValue)
51  {
52  return Vector2.Lerp(startValue, targetValue, curveValue);
53  }
54  }
55 }
override Vector2 ApplyCurveValue(Vector2 startValue, Vector2 targetValue, float curveValue)
Overrides the method to calculate the current Vector2 interpolation value by using a Vector2...
override bool DoValuesEqual(Vector2 one, Vector2 other)
Overrides the method to check if two Vector2 are "close enough".
Base class that provides the common logic for interpolating between values. This class does not inher...
InterpolatedVector2()
Instantiates the InterpolatedVector2 with default of Vector2 as initial value and skipping the first ...
Provides interpolation over Vector2.
InterpolatedVector2(Vector2 initialValue, bool skipFirstUpdateFrame=false)
Instantiates the InterpolatedVector2 with a given Vector2 value as initial value and defaulted to ski...