public CVImage Smooth(SmoothType smoothtype, int param1, int param2, double param3, double param4) { CVImage dst = this.Clone(); PInvoke.cvSmooth(new __CvArrPtr(this), new __CvArrPtr(dst), (int)smoothtype, param1, param2, param3, param4); return(dst); }
// takes 't' and smoothes it. public static float Smooth0to1(this float t, SmoothType smoothType) { t = Mathf.Clamp01(t); switch (smoothType) { case SmoothType.none: break; case SmoothType.smoothstep: t = t * t * (3f - 2f * t); break; case SmoothType.smootherstep: t = t * t * t * (t * (6f * t - 15f) + 10f); break; case SmoothType.exponential: t = t * t; break; case SmoothType.easeIn: t = 1f - Mathf.Cos(t * Mathf.PI * 0.5f); break; case SmoothType.easeOut: t = Mathf.Sin(t * Mathf.PI * 0.5f); break; } return(t); }
/// <summary> /// Specifies that this Tween should the given smoothing method. /// </summary> public Tween Smooth(SmoothType type = SmoothType.Smooth) { throwIfInvalid(); _instance.smoothType = type; _instance.smoothFunction = null; return(this); }
private void BlendToTransform(float pSmoothTime, SmoothType pSmoothType) { StopAllCoroutines(); if (_orhto) { StartCoroutine(SmoothFromTo(_cam.transform.position, _orthoPosition, _cam.transform.rotation.eulerAngles, _orthoRotation, pSmoothTime, pSmoothType)); } else { StartCoroutine(SmoothFromTo(_cam.transform.position, _perspPosition, _cam.transform.rotation.eulerAngles, _perpRotation, pSmoothTime, pSmoothType)); } }
public void SwitchMatrix(float pSmoothTime, SmoothType pSmoothType) { _ortho = !_ortho; if (_ortho) { BlendToMatrix(_matrixOrtho, pSmoothTime, pSmoothType); } else { BlendToMatrix(_matrixPersp, pSmoothTime, pSmoothType); } }
public void ResetDefaults() { returnToPoolUponStop = true; curPercent = 0; dstPercent = 1; velPercent = 1; //By default, tween over the course of 1 second direction = Direction.Forward; smoothType = SmoothType.Linear; smoothFunction = null; OnProgress = null; OnLeaveEnd = null; OnReachEnd = null; OnLeaveStart = null; OnReachStart = null; }
public Bitmap Smooth(SmoothType st) { Bitmap ret = new Bitmap(1, 1); switch (st) { case SmoothType.MEAN_SMOOTH: ret = meanSmooth(); break; case SmoothType.MEDIAN_SMOOTH: ret = medianSmooth(); break; case SmoothType.GAUSSIAN_SMOOTH: ret = gaussianSmooth(); break; } return(ret); }
public static float Interpolation(this float t, SmoothType type) { switch (type) { case SmoothType.SmootherStep: return(t * t * (3 - 2 * t)); case SmoothType.SoSmootherStep: return(t * t * t * (t * (6f * t - 15f) + 10f)); case SmoothType.EaseOutWithSin: return(Mathf.Sin(t * Mathf.PI * 0.5f)); case SmoothType.EaseInWithCos: return(1f - Mathf.Cos(t * Mathf.PI * 0.5f)); case SmoothType.Exponential: return(t * t); default: return(t); } }
public CVImage Smooth(SmoothType smoothtype) { return(Smooth(smoothtype, 3)); }
public static extern void cvSmooth(IntPtr src, IntPtr dst, SmoothType type, int param1, int param2, double param3, double param4);
public CVImage Smooth(SmoothType smoothtype, int param1, int param2) { return Smooth(smoothtype, param1, param2, 0); }
public CVImage Smooth(SmoothType smoothtype, int param1, int param2, double param3) { return Smooth(smoothtype, param1, param2, param3, 0); }
public override void KeyPressed(KeyConstant key, Scancode scancode, bool isRepeat) { base.KeyPressed(key, scancode, isRepeat); switch (key) { case KeyConstant.Right: horizontal_smoothness++; break; case KeyConstant.Left: if (horizontal_smoothness > 1) { horizontal_smoothness--; } break; case KeyConstant.Down: if (vertical_smoothness > 1) { vertical_smoothness--; for (int i = 0; i < smooth.Count; i++) { smooth.RemoveAt(i); } } break; case KeyConstant.Up: vertical_smoothness++; for (int i = 0; i < smooth.Count; i++) { smooth.RemoveAt(i); } break; case KeyConstant.H: smoothType = SmoothType.horizontal; break; case KeyConstant.V: smoothType = SmoothType.vertical; break; case KeyConstant.B: smoothType = SmoothType.both; break; case KeyConstant.Number1: vis_mode = 0; break; case KeyConstant.Number2: vis_mode = 1; break; case KeyConstant.Number3: vis_mode = 2; break; case KeyConstant.Number4: vis_mode = 3; break; case KeyConstant.Number5: vis_mode = 4; break; case KeyConstant.Number6: vis_mode = 5; break; case KeyConstant.Number7: vis_mode = 6; break; case KeyConstant.Number8: vis_mode = 7; break; case KeyConstant.Number9: vis_mode = 8; break; case KeyConstant.Number0: vis_mode = 9; break; } }
public CVImage Smooth(SmoothType smoothtype, int param1, int param2, double param3) { return(Smooth(smoothtype, param1, param2, param3, 0)); }
public CVImage Smooth(SmoothType smoothtype, int param1, int param2, double param3, double param4) { CVImage dst = this.Clone(); PInvoke.cvSmooth(new __CvArrPtr(this), new __CvArrPtr(dst), (int)smoothtype, param1, param2, param3, param4); CVUtils.CheckLastError(); return dst; }
public CVImage Smooth(SmoothType smoothtype, int param1, int param2) { return(Smooth(smoothtype, param1, param2, 0)); }
public CVImage Smooth(SmoothType smoothtype) { return Smooth(smoothtype, 3); }
IEnumerator SmoothFromTo(Vector3 pPositionStart, Vector3 pPositionEnd, Vector2 pRotationStart, Vector2 pRotationEnd, float pSmoothTime, SmoothType pSmoothType) { for (float t = 0; t <= pSmoothTime; t += Time.deltaTime) { if (pSmoothType == SmoothType.Lerp) { _cam.transform.position = Vector3.Lerp(pPositionStart, pPositionEnd, t / pSmoothTime); _cam.transform.rotation = Quaternion.Euler(Vector3.Lerp(pRotationStart, pRotationEnd, t / pSmoothTime)); } else if (pSmoothType == SmoothType.SmoothStep) { _cam.transform.position = SmoothStepV3(pPositionStart, pPositionEnd, t / pSmoothTime); _cam.transform.rotation = Quaternion.Euler(SmoothStepV3(pRotationStart, pRotationEnd, t / pSmoothTime)); } else if (pSmoothType == SmoothType.SmootherStep) { _cam.transform.position = SmoothertStepV3(pPositionStart, pPositionEnd, t / pSmoothTime); _cam.transform.rotation = Quaternion.Euler(SmoothertStepV3(pRotationStart, pRotationEnd, t / pSmoothTime)); } else if (pSmoothType == SmoothType.SmoothestStep) { _cam.transform.position = SmoothestStepV3(pPositionStart, pPositionEnd, t / pSmoothTime); _cam.transform.rotation = Quaternion.Euler(SmoothestStepV3(pRotationStart, pRotationEnd, t / pSmoothTime)); } yield return(new WaitForEndOfFrame());; } }
private void BlendToMatrix(Matrix4x4 pDst, float pSmoothTime, SmoothType pSmoothType) { StopAllCoroutines(); StartCoroutine(SmoothFromTo(_cam.projectionMatrix, pDst, pSmoothTime, pSmoothType)); }
private IEnumerator SmoothFromTo(Matrix4x4 pSrc, Matrix4x4 pDst, float pSmoothTime, SmoothType pSmoothType) { for (float t = 0; t <= pSmoothTime; t += Time.deltaTime) { if (pSmoothType == SmoothType.Lerp) { _cam.projectionMatrix = LerpMatrix(pSrc, pDst, t / pSmoothTime); } else if (pSmoothType == SmoothType.SmoothStep) { _cam.projectionMatrix = SmoothStepMatrix(pSrc, pDst, t / pSmoothTime); } else if (pSmoothType == SmoothType.SmootherStep) { _cam.projectionMatrix = SmootherStepMatrix(pSrc, pDst, t / pSmoothTime); } else if (pSmoothType == SmoothType.SmoothestStep) { _cam.projectionMatrix = SmoothestStepMatrix(pSrc, pDst, t / pSmoothTime); } yield return(new WaitForEndOfFrame());; } _cam.projectionMatrix = pDst; }