Pathfinding.RVO.Sampled.Agent.Sqr C# (CSharp) Method

Sqr() private method

private Sqr ( float x ) : float
x float
return float
		float Sqr (float x) {
			return x*x;
		}

Usage Example

Example #1
0
        private Vector2 Trace(Agent.VOBuffer vos, Vector2 p, out float score)
        {
            float   num    = Mathf.Max(this.radius, 0.2f * this.desiredSpeed);
            float   num2   = float.PositiveInfinity;
            Vector2 result = p;

            for (int i = 0; i < 50; i++)
            {
                float num3 = 1f - (float)i / 50f;
                num3 = Agent.Sqr(num3) * num;
                float   num4;
                Vector2 vector = this.EvaluateGradient(vos, p, out num4);
                if (num4 < num2)
                {
                    num2   = num4;
                    result = p;
                }
                vector.Normalize();
                vector *= num3;
                Vector2 a = p;
                p += vector;
                if (this.DebugDraw)
                {
                    Debug.DrawLine(Agent.FromXZ(a + this.position), Agent.FromXZ(p + this.position), Agent.Rainbow((float)i * 0.1f) * new Color(1f, 1f, 1f, 1f));
                }
            }
            score = num2;
            return(result);
        }
All Usage Examples Of Pathfinding.RVO.Sampled.Agent::Sqr