public void UpdateSamplePos() { SamplePos.Clear(); for (int i = 0; i < m_initSampleCount; ++i) { Vector3 pos = CalculateCubicBezierPos(i / (float)(m_initSampleCount - 1)); SamplePos.Add(pos); } }
private void Update(EvaluationContext context) { var t = SamplePos.GetValue(context); var gradient = Gradient.GetValue(context); var interpolation = (Gradient.Interpolations)Interpolation.GetValue(context); gradient.Interpolation = interpolation; Color.Value = gradient.Sample(t); OutGradient.Value = gradient.TypedClone(); //FIXME: This might not be efficient or required }
/// <summary> /// Gets the position of a point on the spline that's close to the desired point along the spline. For example, if u = 0.5, then a point /// that's about halfway through the spline will be returned. The returned point will lie exactly on one of the curves that make up the /// spline. /// </summary> /// <param name="u">How far along the spline to sample (for example, 0.5 will be halfway along the length of the spline). Should be between 0 and 1.</param> /// <returns>The position on the spline.</returns> public VECTOR Sample(FLOAT u) { SamplePos pos = GetSamplePosition(u); return(_curves[pos.Index].Sample(pos.Time)); }