mirror of
https://github.com/sam-astro/Z-Sharp.git
synced 2025-12-13 09:02:10 +00:00
81 lines
1.3 KiB
Plaintext
81 lines
1.3 KiB
Plaintext
// Default variables, can be overwritten
|
|
// if re-initialized or changed
|
|
float PI = 3.14159265358979
|
|
float EulersNumber = 2.71828183
|
|
|
|
// Trigonometric function Sin
|
|
func Sin(input)
|
|
{
|
|
//Print(input)
|
|
float out = CPP.Math.Sin(input)
|
|
return out
|
|
}
|
|
|
|
// Trigonometric function Cos
|
|
func Cos(input)
|
|
{
|
|
float out = CPP.Math.Cos(input)
|
|
return out
|
|
}
|
|
|
|
// Trigonometric function Tan
|
|
func Tan(input)
|
|
{
|
|
float out = CPP.Math.Tan(input)
|
|
return out
|
|
}
|
|
|
|
// Sigmoid activation function
|
|
func Sigmoid(input)
|
|
{
|
|
float out = 1 / (1+EulersNumber^-input)
|
|
return out
|
|
}
|
|
|
|
// Hyperbolic tangent activation function
|
|
func Tanh(input)
|
|
{
|
|
float out = ((EulersNumber^input)-(EulersNumber^-input))/((EulersNumber^input)+(EulersNumber^-input))
|
|
return out
|
|
}
|
|
|
|
// Rounds input to nearest integer value
|
|
func Round(input)
|
|
{
|
|
float out = CPP.Math.Round(input)
|
|
return out
|
|
}
|
|
|
|
// Clamps input between min and max
|
|
func Clamp(input, min, max)
|
|
{
|
|
if input < min
|
|
{
|
|
return min
|
|
}
|
|
if input > max
|
|
{
|
|
return max
|
|
}
|
|
return input
|
|
}
|
|
|
|
// Sets color of pixel to RGB value
|
|
func SetPixel(x, y, r, g, b)
|
|
{
|
|
string out = CPP.Graphics.SetPixel(x, y, r, g, b)
|
|
return out
|
|
}
|
|
|
|
// Prints input value to console
|
|
func Print(in)
|
|
{
|
|
CPP.System.Print(in)
|
|
}
|
|
|
|
// Prints input value to console with appended newline '\n'
|
|
func Printl(in)
|
|
{
|
|
CPP.System.PrintLine(in)
|
|
}
|