/// <summary> /// 補間生成 /// </summary> /// <param name="left"></param> /// <param name="leftKey"></param> /// <param name="right"></param> /// <param name="rightKey"></param> /// <returns></returns> protected override ReadOnlyCollection <ValueBase> Interpolate( ValueBase left, int leftKey, ValueBase right, int rightKey) { Value leftValue = (Value)left; Value rightValue = (Value)right; int count = rightKey - leftKey - 1; List <ValueBase> results = new List <ValueBase>(count); // 間のフレームの補間を生み出す Interpolater interporator = Interpolater.GetInterpolater(leftValue.ipType); for (int i = 0; i < count; ++i) { float value = interporator.Interpolate( leftValue.value, rightValue.value, leftKey, rightKey, i + leftKey + 1); results.Add(new Value() { ipType = leftValue.ipType, value = value, }); } return(results.AsReadOnly()); }
public static void diffirentiate(IApplicationBuilder app) { app.Run(async context => { try { var input = DiffirentialEquationInput.getFromRequest(context); DiffirentialEquationSolver.Update(input); var resultDiff = DiffirentialEquationSolver.Solve(); var interpolater = new Interpolater(0); var resultInterpolate = interpolater.Interpolate( resultDiff.xData, 0, resultDiff.yData ); resultDiff.xData = resultInterpolate.xData; resultDiff.yData = resultInterpolate.yData; await context.Response.WriteAsync(resultDiff.ToString()); } catch (Exception ex) { await context.Response.WriteAsync(ex.Message); } }); }
/// <summary> /// 補間 /// </summary> /// <param name="left"></param> /// <param name="leftKey"></param> /// <param name="right"></param> /// <param name="rightKey"></param> /// <returns></returns> protected override ReadOnlyCollection <ValueBase> Interpolate( ValueBase left, int leftKey, ValueBase right, int rightKey) { Value leftValue = (Value)left; Value rightValue = (Value)right; int count = rightKey - leftKey - 1; List <ValueBase> results = new List <ValueBase>(count); // 間のフレームの補間を生み出す Interpolater interporator = Interpolater.GetInterpolater("linear"); for (int i = 0; i < count; ++i) { float[] lt = interporator.Interpolate(leftValue.lt, rightValue.lt, leftKey, rightKey, i + leftKey + 1); float[] rt = interporator.Interpolate(leftValue.rt, rightValue.rt, leftKey, rightKey, i + leftKey + 1); float[] lb = interporator.Interpolate(leftValue.lb, rightValue.lb, leftKey, rightKey, i + leftKey + 1); float[] rb = interporator.Interpolate(leftValue.rb, rightValue.rb, leftKey, rightKey, i + leftKey + 1); results.Add(new Value() { lt = lt, rt = rt, lb = lb, rb = rb }); } return(results.AsReadOnly()); }
public void MoveLinear(int time, float y, float x) { this.MovingFrames = time; this.MaxMovingFrames = time; Vector2 height = (new Vector2(x, y) - this.Position) / (float)time; this.MovingDelta = (t) => height; }
void resetRotation() { float duration = .2f; if (resetRot != null) { StopCoroutine(resetRot); } resetRot = StartCoroutine(Interpolater.InterpolateLocalRotation(camControl.turn, Quaternion.Euler(Vector3.zero), duration)); }
public void ToggleLook(bool isAiming) { float duration = .2f; if (lookAt != null) { StopCoroutine(lookAt); } lookAt = StartCoroutine(Interpolater.InterpolateConstraintWeight(camControl.camLook, isAiming ? 0 : 1, duration)); }
void TurnAround(float baseTurnSpeed, Quaternion toLook) { float duration = baseTurnSpeed / turnSpeed; if (look != null) { StopCoroutine(look); } look = StartCoroutine(Interpolater.InterpolateLocalRotation(this.transform, toLook, duration)); }
public void ZoomTo(Vector3 pos, bool isLocal) { float duration = .2f; if (zoom != null) { StopCoroutine(zoom); } zoom = isLocal ? StartCoroutine(Interpolater.InterpolateLocalTransform(camControl.offset, pos, duration)) : StartCoroutine(Interpolater.InterpolateGlobalTransform(camControl.offset, pos, duration)); }
private static List <TransliterationRule> CreateTranslationRules( IEnumerable <GraphemeTranslation> correctedGraphemeTranslations) { GraphemeStatistic statistic = GraphemeStatistic.Create(correctedGraphemeTranslations); var rules = TransliterationRule.Create(statistic); foreach (TransliterationRule rule in rules) { Interpolater.Interpolate(rule.Target, Bit.OnesCount((uint)rule.Target.Length - 1)); } return(rules); }
void ToggleLook(bool _isLocked) { if (index >= targetCollider.targets.Count) { index = 0; } if (isLockedOn != _isLocked && _isLocked == true) { float duration = .1f; if (orient != null) { StopCoroutine(orient); } orient = StartCoroutine(Interpolater.InterpolateLocalRotation(camControl.turn, Quaternion.Euler(10, 0, 0), duration)); } //The camera aim target object Transform _targeter = target.sourceTransform; isLockedOn = _isLocked; camControl.pitchIsLocked = _isLocked; camControl.enabled = !_isLocked; player.weight = _isLocked ? 0 : 1; target.weight = _isLocked ? 1 : 0; playerLook.constraintActive = _isLocked; look.SetSource(0, player); look.SetSource(1, target); if (targetCollider.targets.Count == 0) { return; } lockTarget = targetCollider.targets[index].transform; _targeter.parent = _isLocked ? lockTarget : player.sourceTransform; _targeter.localPosition = Vector3.zero; _targeter.localRotation = new Quaternion(0, 0, 0, 0); index++; }
public static void Interpolate(IApplicationBuilder app) { app.Run(async context => { try { var input = InterpolaterInput.getFromRequest(context); var interpolater = new Interpolater(input.Offset); var result = interpolater.Interpolate(input.XData, funcNumber: input.FuncType); await context.Response.WriteAsync(result.ToString()); } catch (Exception ex) { await context.Response.WriteAsync(ex.Message); } }); }
/// <summary> /// Creates a tween that animates a parameter from a given end value to /// the current value over a set duration. /// </summary> /// <typeparam name="T">The type of the parameter.</typeparam> /// <param name="interpolater">The function that interpolates values between the start and end value.</param> /// <param name="getter">The function that gets the current value of the parameter.</param> /// <param name="setter">The function that sets a new value of the parameter.</param> /// <param name="endValue">The end value of the parameter.</param> /// <param name="duration">The duration of the tween.</param> /// <returns>A new tween that animates the parameter.</returns> public static Tween From <T>(Interpolater <T> interpolater, TweenGetter <T> getter, TweenSetter <T> setter, T endValue, float duration) { if (TweenManager.Unloading) { return(null); } Tweener <T> tween = TweenManager.Instance.BuildTweener <T>(); tween.interpolater = interpolater; tween.getter = getter; tween.setter = setter; tween.endValue = endValue; tween.duration = duration; tween.reversed = true; return(tween); }
public void MoveCubic(int time, float y, float x) { this.MovingFrames = time; this.MaxMovingFrames = time; Vector2 height = (new Vector2(x, y) - this.Position) / (float)time * 4.0f; this.MovingDelta = (t) => { if (t >= 0.5) { return(height * (1.0f - t)); } else { return(height * t); } }; }
public void ZoomTo(Vector3 pos, Vector3 targetPos) { float duration = .2f; if (zoom != null) { StopCoroutine(zoom); } if (shiftFocus != null) { StopCoroutine(shiftFocus); } if (resetRot != null) { StopCoroutine(resetRot); } zoom = StartCoroutine(Interpolater.InterpolateLocalTransform(camControl.offset, pos, duration)); shiftFocus = StartCoroutine(Interpolater.InterpolateLocalTransform(camControl.focusTarget, targetPos, duration)); resetRot = StartCoroutine(Interpolater.InterpolateLocalRotation(camControl.turn, Quaternion.Euler(Vector3.zero), duration)); }
/// <inheritdoc/> protected override void OnReset() { interpolater = null; getter = null; setter = null; }
public Lerper() { predicate = lerp; }
public Lerper(Interpolater interpolater) { predicate = interpolater; }