public bool PosTest4()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest4: Verify the value of atn(inf+1)=atn(inf)");

        try
        {
            float angle    = MathF.Atan(float.PositiveInfinity + 1);
            float baseline = MathF.Atan(float.PositiveInfinity);
            if (!MathFTestLib.SingleIsWithinEpsilon(angle, baseline))
            {
                TestLibrary.TestFramework.LogError("007", "Expected: " + baseline.ToString() + ", actual: " +
                                                   angle.ToString() + " diff>epsilon= " + MathFTestLib.Epsilon.ToString());
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("008", "Unexpected exception occurs: " + e);
            retVal = false;
        }

        return(retVal);
    }
示例#2
0
 public void UpdateFacing(Vector2f?position)
 {
     if (Position != position)
     {
         Vector2f?vec = Position - position;
         if (vec != null)
         {
             float nfacing = MathF.Atan(vec.Value.Y / vec.Value.X) * 180 / MathF.PI;
             if (nfacing < 0)
             {
                 nfacing = nfacing + 180;
             }
             if (vec.Value.Y >= 0)
             {
                 nfacing += 180;
             }
             nfacing -= 90;
             if (nfacing < 0)
             {
                 nfacing += 360;
             }
             facing = nfacing;
         }
     }
 }
示例#3
0
        private void GenPlanetWOrbit(Planet toOrbit, Vector2 diff, Color colour, float radius, float mass, float dir)
        {
            float rOrbit = diff.Length();
            float angle  = MathF.Atan(diff.Y / diff.X);
            float vel    = MathF.Sqrt(toOrbit.Mass / rOrbit) * dir;

            planets.Add(new Planet(colour, radius, vel * new Vector2(-MathF.Sin(angle), MathF.Cos(angle)) + toOrbit.Velocity, toOrbit.Displacement + diff, mass));
        }
示例#4
0
        public Color ToRGB(float exposure)
        {
            byte red   = (byte)(255.0 * MathF.Atan(exposure * R) * 2.0 / MathF.PI + 1.0);
            byte green = (byte)(255.0 * MathF.Atan(exposure * G) * 2.0 / MathF.PI + 1.0);
            byte blue  = (byte)(255.0 * MathF.Atan(exposure * B) * 2.0 / MathF.PI + 1.0);

            return(Color.FromArgb(red, green, blue));
        }
 public static void Atan()
 {
     AssertEqual(MathF.PI / 4.0f, MathF.Atan(1.0f), CrossPlatformMachineEpsilon);
     Assert.Equal(0.0f, MathF.Atan(0.0f));
     AssertEqual(-MathF.PI / 4.0f, MathF.Atan(-1.0f), CrossPlatformMachineEpsilon);
     Assert.Equal(float.NaN, MathF.Atan(float.NaN));
     AssertEqual(MathF.PI / 2.0f, MathF.Atan(float.PositiveInfinity), CrossPlatformMachineEpsilon * 10);
     AssertEqual(-MathF.PI / 2.0f, MathF.Atan(float.NegativeInfinity), CrossPlatformMachineEpsilon * 10);
 }
示例#6
0
        public Sprite Draw(AnimationPart part, AnimationState state)
        {
            AnimationStep step = part.CurrentStep(state.elapsed);

            if (step == null)
            {
                if (state.Repeatable)
                {
                    state.elapsed = Time.Zero;
                    step          = part.CurrentStep(state.elapsed);
                }
                else
                {
                    state.Finished = true;
                }
            }
            if (state.ID != LastState || LastStateTime != part.TotalStepTimeUntil(state.elapsed) && step != null)
            {
                LastRotation  = NewRotation;
                LastState     = state.ID;
                LastStateTime = part.TotalStepTimeUntil(state.elapsed);
                NewRotation   = step.Rotation;
            }
            int    direction = RotationState(state.facing);
            Sprite ret       = new Sprite(BaseTexture[direction]);

            if (step == null)
            {
                state.ID      = 0;
                state.elapsed = Time.Zero;
                ret.Position  = new Vector2f(
                    (float)(state.Position.X + Math.Cos((Math.PI / 180) * state.facing) * RotationCenter.X) -
                    ret.GetLocalBounds().Width / 2,
                    (float)(state.Position.Y + Math.Sin((Math.PI / 180) * state.facing) * RotationCenter.X / 2 +
                            RotationCenter.Y));
                return(ret);
            }

            Time  timeInState = state.elapsed - part.TotalStepTimeUntil(state.elapsed);
            float currentRotation;

            currentRotation = LastRotation + (NewRotation - LastRotation) * timeInState.AsSeconds() / step.Duration.AsSeconds();
            float actualRotation =
                MathF.Atan(MathF.Tan(currentRotation * MathF.PI / 180) * MathF.Sin(state.facing * MathF.PI / 180)) *
                180 / MathF.PI;
            float desiredHeight = (float)(Math.Cos((Math.PI / 180) * currentRotation) / Math.Cos((Math.PI / 180) * actualRotation) *
                                          BaseTexture[direction].GetLocalBounds().Height);

            ret.Scale    = new Vector2f(1, desiredHeight / BaseTexture[direction].GetLocalBounds().Height);
            ret.Rotation = actualRotation;
            ret.Origin   = GetOriginCenter(direction);
            ret.Position = new Vector2f(
                (float)(state.Position.X + Math.Cos((Math.PI / 180) * state.facing) * RotationCenter.X) - Origin.X - ret.GetLocalBounds().Width / 2,
                (float)(state.Position.Y + Math.Sin((Math.PI / 180) * state.facing) * RotationCenter.X / 2 + RotationCenter.Y + Origin.Y));
            return(ret);
        }
示例#7
0
        /// <summary>
        /// Set the top of the camera stack to this camera
        /// </summary>
        public void SetCamera(Region region, float aspectRatio, float near, float far)
        {
            var pos = Transform.GetPositionInRegion(region).To <float>();

            Camera.SetProjection(
                pos, pos + Transform.Forward,
                MathF.Atan(MathF.Tan(FOV) / Zoom), aspectRatio, Transform.Up,
                near,
                far
                );
        }
        public static Single GetRotation(Vector2 vector)
        {
            // Calculate the angle.
            var Angle = MathF.Atan(vector.Y / vector.X);

            if (vector.X < 0)
            {
                Angle += (float)Math.PI;
            }
            return(Angle);
        }
示例#9
0
        private void SetupCamera()
        {
            viewMatrix = Matrix4.LookAt(currentScene.Camera.Position.X, currentScene.Camera.Position.Y,
                                        currentScene.Camera.Position.Z, currentScene.Camera.LookAt.X, currentScene.Camera.LookAt.Y,
                                        currentScene.Camera.LookAt.Z, 0f, 1f, 0f);

            float fov = MathF.Atan((0.5f * 36f) / currentScene.Camera.FocalLength) * 2f;

            projectionMatrix = Matrix4.CreatePerspectiveFieldOfView(fov,
                                                                    (float)(control.ActualWidth / control.ActualHeight), 0.01f, 1000f);
        }
示例#10
0
        public static void Test(float f, bool doSin = false, bool doCos = false, bool doTan = false, bool doSinCos = false, bool doATan = false, bool doATan2 = false)
        {
            Console.WriteLine($"For value {f}: ");

            var v = Vector128.Create(f);

            if (doSin)
            {
                Console.WriteLine($"MathF Sin:             {MathF.Sin(f)}");
                Console.WriteLine($"MathSharp Sin:         {Sin(v).ToScalar()}");
                Console.WriteLine($"MathSharp SinApprox:   {SinApprox(v).ToScalar()}");
            }

            if (doCos)
            {
                Console.WriteLine($"MathF Cos:             {MathF.Cos(f)}");
                Console.WriteLine($"MathSharp Cos:         {Cos(v).ToScalar()}");
                Console.WriteLine($"MathSharp CosApprox:   {CosApprox(v).ToScalar()}");
            }

            if (doTan)
            {
                Console.WriteLine($"MathF Tan:             {MathF.Tan(f)}");
                Console.WriteLine($"MathSharp Tan:         {Tan(v).ToScalar()}");
                Console.WriteLine($"MathSharp TanApprox:   {TanApprox(v).ToScalar()}");
            }

            if (doSinCos)
            {
                SinCos(v, out Vector128 <float> sin, out Vector128 <float> cos);
                SinCosApprox(v, out Vector128 <float> sinEst, out Vector128 <float> cosEst);

                Console.WriteLine($"MathF SinCos:             {MathF.Sin(f)}, {MathF.Cos(f)}");
                Console.WriteLine($"MathSharp SinCos:         {sin.ToScalar()}, {cos.ToScalar()}");
                Console.WriteLine($"MathSharp SinCosApprox:   {sinEst.ToScalar()}, {cosEst.ToScalar()}");
            }

            if (doATan)
            {
                Console.WriteLine($"MathF ATan:             {MathF.Atan(f)}");
                Console.WriteLine($"MathSharp ATan:         {ATan(v).ToScalar()}");
                //Console.WriteLine($"MathSharp ATanApprox:   {ATanApprox(v).ToScalar()}");
            }

            if (doATan2)
            {
                Console.WriteLine($"MathF ATan2:             {MathF.Atan2(f, f)}");
                Console.WriteLine($"MathSharp ATan2:         {ATan2(v, v).ToScalar()}");
                //Console.WriteLine($"MathSharp ATan2Approx:   {TanApprox(v).ToScalar()}");
            }

            Console.WriteLine("\n");
        }
示例#11
0
        private Matrix4 getLightViewMatrix(Camera camera, Light light)
        {
            var ld    = light.Direction.Normalized();
            var pitch = MathF.Acos(ld.Xz.Length);
            var yaw   = MathF.Atan(ld.X / ld.Z);

            yaw = ld.Z > 0 ? yaw - MathF.PI : yaw;

            return(Matrix4.CreateTranslation(-camera.Look) *
                   Matrix4.CreateRotationY(-yaw) *
                   Matrix4.CreateRotationX(pitch));
        }
示例#12
0
        private static void CorrectFishEye(ImageGrid grid, float correctionRadius, RgbColor[] buffer)
        {
            // calculate the coordinates of the center of the image
            var centerX = grid.Width / 2;
            var centerY = grid.Height / 2;

            // iterate through all horizontal lines
            for (var y = 0; y < grid.Height; y++)
            {
                // calculate the y-coordinate currently processing and precompute the squared value
                // of the current center y-coordinate being processed
                var currentY        = y - centerY;
                var currentYSquared = MathF.Pow(currentY, 2);

                // iterate through all vertical lines in the current horizontal scan line
                for (var x = 0; x < grid.Width; x++)
                {
                    // calculate the x-coordinate currently processing and compute the squared value
                    // of the current center x-coordinate being processed
                    var currentX        = x - centerX;
                    var currentXSquared = MathF.Pow(currentX, 2);

                    // compute the distance between the original center and the current point
                    var distance = MathF.Sqrt(currentXSquared + currentYSquared);

                    // compute the current correction radius to perform correction with
                    var radius = distance / correctionRadius;

                    // the theta used as a factor to correct the fish-eye distortion, pre-initialize
                    // with 1F to avoid division through zero errors
                    var theta = 1F;

                    // check if the radius is not zero, to avoid division through zero errors
                    if (radius is not 0.0F)
                    {
                        // compute the theta
                        theta = MathF.Atan(radius) / radius;
                    }

                    // calculate the coordinates of the pixel to retrieve the value from
                    var sourceX = (int)MathF.Floor(centerX + (theta * currentX));
                    var sourceY = (int)MathF.Floor(centerY + (theta * currentY));

                    // retrieve the value of the source pixel
                    var value = grid.GetPixel(sourceX, sourceY);

                    // set the current target pixel to the corrected pixel
                    buffer[x + (y * grid.Width)] = value;
                }
            }
        }
示例#13
0
        private void Move()
        {
            Vector2 playerPosition = EntityManager.Instance.Player.Position;
            float   differenceY    = Sprite.Position.Y - playerPosition.Y;
            float   differenceX    = Sprite.Position.X - playerPosition.X;

            if (differenceX < 0)
            {
                Rotation = MathF.Atan(differenceY / differenceX) - (MathF.PI / 2);
            }
            else
            {
                Rotation = MathF.Atan(differenceY / differenceX) + (MathF.PI / 2);
            }

            Position = new Vector2(Position.X - (Speed * MathF.Sin(Rotation)), Position.Y + (Speed * MathF.Cos(Rotation)));
        }
示例#14
0
        public void CreateGrids()
        {
            if (slopeGrid.IsNotSetup())
            {
                // setup custom grids with the same size as this DEM
                slopeGrid.Setup(this);
                viewGrid.Setup(this);
                aspectGrid.Setup(this);
            }
            else
            {
                return;
            }

            // use fixed values for azimuth (315) and angle (45 deg) and calculate
            // norm vectors
            float sun_x = MathF.Cos(315.0F * MathF.PI / 180.0F) * MathF.Cos(45.0F * MathF.PI / 180.0F);
            float sun_y = MathF.Sin(315.0F * MathF.PI / 180.0F) * MathF.Cos(45.0F * MathF.PI / 180.0F);
            float sun_z = MathF.Sin(45.0F * MathF.PI / 180.0F);

            float a_x, a_y, a_z;

            for (int p = 0; p < this.Count; ++p)
            {
                PointF pt     = GetCellCenterPosition(p);
                float  height = GetOrientation(pt, out float slope, out float aspect);
                slopeGrid[p]  = slope;
                aspectGrid[p] = aspect;
                // calculate the view value:
                if (height > 0)
                {
                    float h = MathF.Atan(slopeGrid[p]);
                    a_x = MathF.Cos(aspectGrid[p] * MathF.PI / 180.0F) * MathF.Cos(h);
                    a_y = MathF.Sin(aspectGrid[p] * MathF.PI / 180.0F) * MathF.Cos(h);
                    a_z = MathF.Sin(h);

                    // use the scalar product to calculate the angle, and then
                    // transform from [-1,1] to [0,1]
                    viewGrid[p] = (a_x * sun_x + a_y * sun_y + a_z * sun_z + 1.0F) / 2.0F;
                }
                else
                {
                    viewGrid[p] = 0.0F;
                }
            }
        }
示例#15
0
        public static void AtanTest()
        {
            float result = 0.0f, value = -1.0f;

            for (int iteration = 0; iteration < MathTests.Iterations; iteration++)
            {
                value  += atanDelta;
                result += MathF.Atan(value);
            }

            float diff = MathF.Abs(atanExpectedResult - result);

            if (diff > MathTests.SingleEpsilon)
            {
                throw new Exception($"Expected Result {atanExpectedResult,10:g9}; Actual Result {result,10:g9}");
            }
        }
示例#16
0
        public static float radPOX(float x, float y)
        {
            //P在(0,0)的情况
            if (x == 0 && y == 0)
            {
                return(0);
            }

            //P在四个坐标轴上的情况:x正、x负、y正、y负
            if (y == 0 && x > 0)
            {
                return(0);
            }
            if (y == 0 && x < 0)
            {
                return(MathF.PI);
            }
            if (x == 0 && y > 0)
            {
                return(MathF.PI / 2);
            }
            if (x == 0 && y < 0)
            {
                return(MathF.PI / 2 * 3);
            }

            //点在第一、二、三、四象限时的情况
            if (x > 0 && y > 0)
            {
                return(MathF.Atan(y / x));
            }
            if (x < 0 && y > 0)
            {
                return(MathF.PI - MathF.Atan(y / -x));
            }
            if (x < 0 && y < 0)
            {
                return(MathF.PI + MathF.Atan(-y / -x));
            }
            if (x > 0 && y < 0)
            {
                return(MathF.PI * 2 - MathF.Atan(-y / x));
            }

            return(0);
        }
示例#17
0
        public static void AtanSingleTest()
        {
            var result = 0.0f; var value = -1.0f;

            for (var iteration = 0; iteration < iterations; iteration++)
            {
                value  += atanSingleDelta;
                result += MathF.Atan(value);
            }

            var diff = MathF.Abs(atanSingleExpectedResult - result);

            if (diff > singleEpsilon)
            {
                throw new Exception($"Expected Result {atanSingleExpectedResult,10:g9}; Actual Result {result,10:g9}");
            }
        }
示例#18
0
 private void SetBoxState(int x, int y, int z)
 {
     boxes[x, y, z] = new Box
                      (
         size: boxSize,
         position: new Vector3f
         (
             x * boxSize.X - ((boxCount.X - 1) * boxSize.X) / 2,
             y * boxSize.Y - ((boxCount.Y - 1) * boxSize.Y) / 2,
             z * boxSize.Z - ((boxCount.Z - 1) * boxSize.Z) / 2 + 0.0001f // Preventing Zero Exeption
         ),
         rotation: new Vector3f
         (
             MathF.PI / 4f,
             -MathF.Atan(1 / MathF.Sqrt(2)),
             0
         ),
         fillColor: Color.Black,
         type: PrimitiveType.Quads
                      );
 }
示例#19
0
    public bool PosTest5()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest5: Verify atn(-inf -1)=atn(-inf)");

        try
        {
            float angle    = MathF.Atan(float.NegativeInfinity - 1);
            float baseline = MathF.Atan(float.NegativeInfinity);
            if (!MathFTestLib.SingleIsWithinEpsilon(angle, baseline))
            {
                TestLibrary.TestFramework.LogError("009", "Expected " + baseline.ToString() + ", actual: " + angle.ToString());
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("010", "Unexpected exception occurs: " + e);
            retVal = false;
        }

        return(retVal);
    }
示例#20
0
    public bool PosTest3()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest3: Verify the value of arctan(0) is zero...");

        try
        {
            float angle = MathF.Atan(0);
            if (!MathFTestLib.SingleIsWithinEpsilon(angle, 0))
            {
                TestLibrary.TestFramework.LogError("005", "Expected: 0, actual: " +
                                                   angle.ToString() + " diff>epsilon= " + MathFTestLib.Epsilon.ToString());
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpected exception occurs: " + e);
            retVal = false;
        }

        return(retVal);
    }
示例#21
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Verify the value of arctan(PositiveInfinity) is MathF.PI/2...");

        try
        {
            float angle = MathF.Atan(float.PositiveInfinity);
            if (!MathFTestLib.SingleIsWithinEpsilon(angle, MathF.PI / 2))
            {
                TestLibrary.TestFramework.LogError("003", "Expected: pi/2, actual: " +
                                                   angle.ToString() + " diff>epsilon= " + MathFTestLib.Epsilon.ToString());
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception occurs: " + e);
            retVal = false;
        }

        return(retVal);
    }
示例#22
0
        public float GetAngleBetweenTwoAsteroids(Asteroid refferenceAsteroid, Asteroid otherAsteroid)
        {
            float ySub = -otherAsteroid.y - -refferenceAsteroid.y;
            float xSub = otherAsteroid.x - refferenceAsteroid.x;

            if (ySub == 0)
            {
                return(xSub > 0 ? 0 : 180);
            }

            float angle = MathF.Atan(ySub / xSub) * 180 / MathF.PI;

            if (xSub < 0)
            {
                angle = 180 + angle;
            }

            while (angle < 0)
            {
                angle += 360;
            }

            return(angle);
        }
        public void Update()
        {
            if (health <= 0)
            {
                GameLogic.respawnAnimal(id);
            }
            float searchDistance = viewDistance;

            foreach (Client _client in Server.clients.Values)
            {
                if (_client.player != null)
                {
                    if (_client.player.spectating)
                    {
                        // Console.WriteLine(false);
                        // occupied = false;
                        checkWaitTimer();
                        continue;
                    }
                    // Console.WriteLine(true);
                    float playerDistance = Vector2.DistanceSquared(_client.player.position, position);
                    if (playerDistance < searchDistance)
                    {
                        searchDistance = playerDistance;
                        if (species == "wolf")
                        {
                            targetPosition = _client.player.position;
                        }
                        else if (species == "hare")
                        {
                            targetPosition = position - (_client.player.position - position);
                        }
                        occupied  = false;
                        waitTimer = 0;
                        break;
                    }
                    else
                    {
                        checkWaitTimer();
                    }
                }
            }
            if (waitTimer > 0)
            {
                waitTimer--;
            }
            Vector2 _moveDirection = targetPosition - position;

            if (_moveDirection.X != 0)
            {
                rotation = MathF.Atan(_moveDirection.Y / _moveDirection.X) * 180f / ((float)Math.PI) + 90f;
                if (_moveDirection.X > 0)
                {
                    rotation += 180f;
                }
            }

            if (knockbackVelocity > 0)
            {
                position          += knockbackVelocity * knockbackDirection;
                knockbackVelocity -= 0.3f;
                if (knockbackVelocity < 0)
                {
                    knockbackVelocity = 0;
                }
            }

            Move(_moveDirection);
        }
示例#24
0
 public void AtanTest()
 {
     AssumeFunctionSupported("atan");
     Test(o => MathF.Round(MathF.Atan((float)o.UnitPrice), 5));
 }
示例#25
0
 public float Atan(float a) => MathF.Atan(a);
示例#26
0
 public AngleF GetDirection()
 => MathF.Atan(Y / X);
示例#27
0
 public override void Init()
 {
     this.Orientation      = new(-PI / 4, MathF.Atan(1 / MathF.Sqrt(2)));
     this.DistanceToTarget = 10;
 }
        public override void ReceiveSignal(Signal signal, Connection connection)
        {
            float.TryParse(signal.value, NumberStyles.Float, CultureInfo.InvariantCulture, out float value);
            switch (Function)
            {
            case FunctionType.Sin:
                if (!UseRadians)
                {
                    value = MathHelper.ToRadians(value);
                }
                value = MathF.Sin(value);
                break;

            case FunctionType.Cos:
                if (!UseRadians)
                {
                    value = MathHelper.ToRadians(value);
                }
                value = MathF.Cos(value);
                break;

            case FunctionType.Tan:
                if (!UseRadians)
                {
                    value = MathHelper.ToRadians(value);
                }
                //tan is undefined if the value is (π / 2) + πk, where k is any integer
                if (!MathUtils.NearlyEqual(value % MathHelper.Pi, MathHelper.PiOver2))
                {
                    value = MathF.Tan(value);
                }
                break;

            case FunctionType.Asin:
                //asin is only defined in the range [-1,1]
                if (value >= -1.0f && value <= 1.0f)
                {
                    float angle = MathF.Asin(value);
                    if (!UseRadians)
                    {
                        angle = MathHelper.ToDegrees(angle);
                    }
                    value = angle;
                }
                break;

            case FunctionType.Acos:
                //acos is only defined in the range [-1,1]
                if (value >= -1.0f && value <= 1.0f)
                {
                    float angle = MathF.Acos(value);
                    if (!UseRadians)
                    {
                        angle = MathHelper.ToDegrees(angle);
                    }
                    value = angle;
                }
                break;

            case FunctionType.Atan:
                if (connection.Name == "signal_in_x")
                {
                    timeSinceReceived[0] = 0.0f;
                    float.TryParse(signal.value, NumberStyles.Float, CultureInfo.InvariantCulture, out receivedSignal[0]);
                }
                else if (connection.Name == "signal_in_y")
                {
                    timeSinceReceived[1] = 0.0f;
                    float.TryParse(signal.value, NumberStyles.Float, CultureInfo.InvariantCulture, out receivedSignal[1]);
                }
                else
                {
                    float angle = MathF.Atan(value);
                    if (!UseRadians)
                    {
                        angle = MathHelper.ToDegrees(angle);
                    }
                    value = angle;
                }
                break;

            default:
                throw new NotImplementedException($"Function {Function} has not been implemented.");
            }

            signal.value = value.ToString("G", CultureInfo.InvariantCulture);
            item.SendSignal(signal, "signal_out");
        }
示例#29
0
        public override RacketNumber Evaluate()
        {
            RacketNumber currentNumber = (RacketNumber)arguments[0].Evaluate();

            return(RacketNumber.Parse(MathF.Atan(currentNumber.Value), false, currentNumber.IsRational));
        }
示例#30
0
 static float ToBARK(float lsp)
 {
     return(13.1f * MathF.Atan(0.00074f * lsp) + 2.24f * MathF.Atan(0.0000000185f * lsp * lsp) + 0.0001f * lsp);
 }