More Fn changes

This commit is contained in:
Marc Hernandez 2022-11-04 21:49:51 -07:00
parent efe517abea
commit a6212a1484

View File

@ -1,25 +1,4 @@
// Copyright (c) Xenko contributors (https://xenko.com) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
//
// Copyright (c) 2010-2011 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.ComponentModel;
@ -27,6 +6,8 @@ using System.Globalization;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace math
{
@ -38,6 +19,30 @@ namespace math
return v < min ? min : v > max ? max : v;
}
static public float LogisticsUnit( float v, float spread = 4.0f, float height = 1.0f )
{
return LogisticsFull( v, height, spread, 0, 0.1f, -0.5f );
}
static public float LogisticsFull( float v, float height, float spread, float f, float g, float h )
{
float res = height / (1.0f + (float)Math.Pow( g, (spread * (v+h))) ) + f;
return res;
}
static public float LogisticsSymmetric( float v, float height = 1.0f, float spread = 3.65f )
{
float fullHeight = height * 2.0f;
float negF = -height;
float res = LogisticsFull( v, fullHeight, spread, negF, 0.1f, 0.0f );
return res;
}
//Tracked these down in Desmos
static public float s_a = 0.0f;
static public float s_b = 0.155f;