C# 클래스 GarrysModLuaShared.math

The math library is a standard Lua library that provides functions for manipulating numbers. In Garry's Mod several additional math functions have been added.
파일 보기 프로젝트 열기: OmegaExtern/gmod-csharp-binary-module

공개 메소드들

메소드 설명
AngleDifference ( LuaState luaState, double a, double b ) : double

Calculates the difference between two angles.

Approach ( LuaState luaState, double start, double end, double amount ) : double

Increments a value from a start point by the given amount, up to a given upper limit.

ApproachAngle ( LuaState luaState, double currentAngle, double targetAngle, double rate ) : double

Increments an angle towards another by specified rate. NOTE: This function is for numbers representing angles(0-360), NOT Structs.Angle objects!

BinToInt ( LuaState luaState, string @string ) : double

Converts a binary string into a number.

Clamp ( LuaState luaState, double input, double min, double max ) : double

Clamps a number between a minimum and maximum value.

Distance ( LuaState luaState, double x1, double y1, double x2, double y2 ) : double

Returns the difference between two points in 2D space.

EaseInOut ( LuaState luaState, double progress, double easeIn, double easeOut ) : double

Calculates the progress of a value fraction, taking in to account given easing fractions.

IntToBin ( LuaState luaState, double number ) : string

Converts an integer to a binary (base-2) string.

NormalizeAngle ( LuaState luaState, double angle ) : double

Normalizes angle, so it returns value between -180 and 180.

Rand ( LuaState luaState, double min, double max ) : double

Returns a random float between min and max.

Remap ( LuaState luaState, double value, double inMin, double inMax, double outMin, double outMax ) : double

Remaps the value from one range to another.

Round ( LuaState luaState, double value, double decimals = 0.0D ) : double

Rounds the given value to the nearest whole number or to the given decimal places.

TimeFraction ( LuaState luaState, double start, double end, double current ) : double

Returns the fraction of where the current time is relative to the start and end times.

Truncate ( LuaState luaState, double number, double digits ) : double

Rounds towards zero.

abs ( LuaState luaState, double x ) : double

Calculates the absolute value of a number (effectively removes any negative sign).

acos ( LuaState luaState, double x ) : double

Returns the arc cosine of the given number.

asin ( LuaState luaState, double x ) : double

Returns the arc sine of the given number.

atan ( LuaState luaState, double x ) : double

Returns the arc tangent of the given number.

atan2 ( LuaState luaState, double y, double x ) : double

Returns atan(y / x) in radians. The result is between - pi and pi.

calcBSplineN ( LuaState luaState, double i, double k, double t, double tInc ) : double

Basic code for Bezier-Spline algorithm.

ceil ( LuaState luaState, double number ) : double

Ceils or rounds a number up.

cos ( LuaState luaState, double angle ) : double

Returns cosine of the given angle.

cosh ( LuaState luaState, double number ) : double

Returns hyperbolic cosine of the given number.

deg ( LuaState luaState, double radians ) : double

Converts radians to degrees.

exp ( LuaState luaState, double exponent ) : double

Returns the x power of the euler constant.

floor ( LuaState luaState, double number ) : double

Floors or rounds a number down.

fmod ( LuaState luaState, double @base, double modulator ) : double

Returns the modulus of the specified values. The same effect can be achieved using the % operator.

frexp ( LuaState luaState, double inputValue ) : double>.Tuple

Used to split the number value into a normalized fraction and an exponent.

frexp ( LuaState luaState, double inputValue, double &normalizedFraction, double &exponent ) : void

Used to split the number value into a normalized fraction and an exponent.

ldexp ( LuaState luaState, double normalizedFraction, double exponent ) : double

Takes a normalised number and returns the floating-point representation.

log ( LuaState luaState, double x, double @base = e ) : double

With one argument, return the natural logarithm of x (to base e). With two arguments, return the logarithm of x to the given base, calculated as log(x)/log(base).

log10 ( LuaState luaState, double x ) : double

Returns the base-10 logarithm of x. This is usually more accurate than log( x, 10).

max ( LuaState luaState ) : double

Returns the largest value of all arguments.

min ( LuaState luaState ) : double

Returns the smallest value of all arguments.

modf ( LuaState luaState, double @base, double modulator ) : double>.Tuple

Returns the integral and fractional component of the modulo operation.

modf ( LuaState luaState, double @base, double modulator, double &integral, double &fractional ) : void

Returns the integral and fractional component of the modulo operation.

pow ( LuaState luaState, double x, double y ) : double

Returns x raised to the power y. In particular, math.pow(1.0, x) and math.pow(x, 0.0) always return 1.0, even when x is a zero or a NaN. If both x and y are finite, x is negative, and y is not an integer then math.pow( x, y) is undefined.

rad ( LuaState luaState, double degrees ) : double

Converts an angle in degrees to it's equivalent in radians.

random ( LuaState luaState, int min, int max ) : int

Returns a random integer between min and max.

randomseed ( LuaState luaState, double seed ) : void

Seeds the seed for the random generator, which will cause random to return the same sequence of numbers.

sin ( LuaState luaState, double angle ) : double

Returns sine of the given angle.

sinh ( LuaState luaState, double number ) : double

Returns hyperbolic sine of the given number.

sqrt ( LuaState luaState, double number ) : double

Returns square root of the given number.

tan ( LuaState luaState, double angle ) : double

Returns tangent of the given angle.

tanh ( LuaState luaState, double number ) : double

Returns hyperbolic tangent of the given number.

메소드 상세

AngleDifference() 공개 정적인 메소드

Calculates the difference between two angles.
public static AngleDifference ( LuaState luaState, double a, double b ) : double
luaState LuaState Pointer to lua_State struct.
a double The first angle.
b double The second angle.
리턴 double

Approach() 공개 정적인 메소드

Increments a value from a start point by the given amount, up to a given upper limit.
public static Approach ( LuaState luaState, double start, double end, double amount ) : double
luaState LuaState Pointer to lua_State struct.
start double The number to start with.
end double The max value, this function will never return a number greater than this.
amount double The amount to increment the starting number by.
리턴 double

ApproachAngle() 공개 정적인 메소드

Increments an angle towards another by specified rate. NOTE: This function is for numbers representing angles(0-360), NOT Structs.Angle objects!
public static ApproachAngle ( LuaState luaState, double currentAngle, double targetAngle, double rate ) : double
luaState LuaState Pointer to lua_State struct.
currentAngle double The current angle to increase.
targetAngle double The angle to increase towards.
rate double The amount to approach the target angle by.
리턴 double

BinToInt() 공개 정적인 메소드

Converts a binary string into a number.
public static BinToInt ( LuaState luaState, string @string ) : double
luaState LuaState Pointer to lua_State struct.
@string string
리턴 double

Clamp() 공개 정적인 메소드

Clamps a number between a minimum and maximum value.
public static Clamp ( LuaState luaState, double input, double min, double max ) : double
luaState LuaState Pointer to lua_State struct.
input double The number to clamp.
min double The minimum value, this function will never return a number less than this.
max double The maximum value, this function will never return a number greater than this.
리턴 double

Distance() 공개 정적인 메소드

Returns the difference between two points in 2D space.
public static Distance ( LuaState luaState, double x1, double y1, double x2, double y2 ) : double
luaState LuaState Pointer to lua_State struct.
x1 double X position of first point.
y1 double Y position of first point.
x2 double X position of second point.
y2 double Y position of second point.
리턴 double

EaseInOut() 공개 정적인 메소드

Calculates the progress of a value fraction, taking in to account given easing fractions.
public static EaseInOut ( LuaState luaState, double progress, double easeIn, double easeOut ) : double
luaState LuaState Pointer to lua_State struct.
progress double Fraction of the progress to ease.
easeIn double Fraction of how much easing to begin with.
easeOut double Fraction of how much easing to end with.
리턴 double

IntToBin() 공개 정적인 메소드

Converts an integer to a binary (base-2) string.
public static IntToBin ( LuaState luaState, double number ) : string
luaState LuaState Pointer to lua_State struct.
number double Number to be converted.
리턴 string

NormalizeAngle() 공개 정적인 메소드

Normalizes angle, so it returns value between -180 and 180.
public static NormalizeAngle ( LuaState luaState, double angle ) : double
luaState LuaState Pointer to lua_State struct.
angle double The angle to normalize, in degrees.
리턴 double

Rand() 공개 정적인 메소드

Returns a random float between min and max.
public static Rand ( LuaState luaState, double min, double max ) : double
luaState LuaState Pointer to lua_State struct.
min double The minimum value.
max double The maximum value.
리턴 double

Remap() 공개 정적인 메소드

Remaps the value from one range to another.
public static Remap ( LuaState luaState, double value, double inMin, double inMax, double outMin, double outMax ) : double
luaState LuaState Pointer to lua_State struct.
value double The value.
inMin double The minimum of the initial range.
inMax double The maximum of the initial range.
outMin double The minimum of new range.
outMax double The maximum of new range.
리턴 double

Round() 공개 정적인 메소드

Rounds the given value to the nearest whole number or to the given decimal places.
public static Round ( LuaState luaState, double value, double decimals = 0.0D ) : double
luaState LuaState Pointer to lua_State struct.
value double The value to round.
decimals double The decimal places to round to.
리턴 double

TimeFraction() 공개 정적인 메소드

Returns the fraction of where the current time is relative to the start and end times.
public static TimeFraction ( LuaState luaState, double start, double end, double current ) : double
luaState LuaState Pointer to lua_State struct.
start double Start time in seconds.
end double End time in seconds.
current double Current time in seconds.
리턴 double

Truncate() 공개 정적인 메소드

Rounds towards zero.
public static Truncate ( LuaState luaState, double number, double digits ) : double
luaState LuaState Pointer to lua_State struct.
number double The number to truncate.
digits double The amount of digits to keep after the point.
리턴 double

abs() 공개 정적인 메소드

Calculates the absolute value of a number (effectively removes any negative sign).
public static abs ( LuaState luaState, double x ) : double
luaState LuaState Pointer to lua_State struct.
x double The number to get the absolute value of.
리턴 double

acos() 공개 정적인 메소드

Returns the arc cosine of the given number.
public static acos ( LuaState luaState, double x ) : double
luaState LuaState Pointer to lua_State struct.
x double Value in range from -1 to +1.
리턴 double

asin() 공개 정적인 메소드

Returns the arc sine of the given number.
public static asin ( LuaState luaState, double x ) : double
luaState LuaState Pointer to lua_State struct.
x double Value in range from -1 to +1.
리턴 double

atan() 공개 정적인 메소드

Returns the arc tangent of the given number.
public static atan ( LuaState luaState, double x ) : double
luaState LuaState Pointer to lua_State struct.
x double Value in range from -1 to +1.
리턴 double

atan2() 공개 정적인 메소드

Returns atan(y / x) in radians. The result is between - pi and pi.
public static atan2 ( LuaState luaState, double y, double x ) : double
luaState LuaState Pointer to lua_State struct.
y double Y coordinate.
x double X coordinate.
리턴 double

calcBSplineN() 공개 정적인 메소드

Basic code for Bezier-Spline algorithm.
public static calcBSplineN ( LuaState luaState, double i, double k, double t, double tInc ) : double
luaState LuaState Pointer to lua_State struct.
i double
k double
t double
tInc double
리턴 double

ceil() 공개 정적인 메소드

Ceils or rounds a number up.
public static ceil ( LuaState luaState, double number ) : double
luaState LuaState Pointer to lua_State struct.
number double The number to be rounded up.
리턴 double

cos() 공개 정적인 메소드

Returns cosine of the given angle.
public static cos ( LuaState luaState, double angle ) : double
luaState LuaState Pointer to lua_State struct.
angle double Angle in radians.
리턴 double

cosh() 공개 정적인 메소드

Returns hyperbolic cosine of the given number.
public static cosh ( LuaState luaState, double number ) : double
luaState LuaState Pointer to lua_State struct.
number double Value in radians.
리턴 double

deg() 공개 정적인 메소드

Converts radians to degrees.
public static deg ( LuaState luaState, double radians ) : double
luaState LuaState Pointer to lua_State struct.
radians double Value to be converted to degrees.
리턴 double

exp() 공개 정적인 메소드

Returns the x power of the euler constant.
public static exp ( LuaState luaState, double exponent ) : double
luaState LuaState Pointer to lua_State struct.
exponent double The exponent for the function.
리턴 double

floor() 공개 정적인 메소드

Floors or rounds a number down.
public static floor ( LuaState luaState, double number ) : double
luaState LuaState Pointer to lua_State struct.
number double The number to be rounded down.
리턴 double

fmod() 공개 정적인 메소드

Returns the modulus of the specified values. The same effect can be achieved using the % operator.
public static fmod ( LuaState luaState, double @base, double modulator ) : double
luaState LuaState Pointer to lua_State struct.
@base double
modulator double The modulator.
리턴 double

frexp() 공개 정적인 메소드

Used to split the number value into a normalized fraction and an exponent.
public static frexp ( LuaState luaState, double inputValue ) : double>.Tuple
luaState LuaState Pointer to lua_State struct.
inputValue double The value to get the normalized fraction and the exponent from.
리턴 double>.Tuple

frexp() 공개 정적인 메소드

Used to split the number value into a normalized fraction and an exponent.
public static frexp ( LuaState luaState, double inputValue, double &normalizedFraction, double &exponent ) : void
luaState LuaState Pointer to lua_State struct.
inputValue double The value to get the normalized fraction and the exponent from.
normalizedFraction double Always in the range 1/2 (inclusive) to 1 (exclusive).
exponent double An exponent.
리턴 void

ldexp() 공개 정적인 메소드

Takes a normalised number and returns the floating-point representation.
public static ldexp ( LuaState luaState, double normalizedFraction, double exponent ) : double
luaState LuaState Pointer to lua_State struct.
normalizedFraction double The value to get the normalized fraction and the exponent from.
exponent double The value to get the normalized fraction and the exponent from.
리턴 double

log() 공개 정적인 메소드

With one argument, return the natural logarithm of x (to base e). With two arguments, return the logarithm of x to the given base, calculated as log(x)/log(base).
public static log ( LuaState luaState, double x, double @base = e ) : double
luaState LuaState Pointer to lua_State struct.
x double The value to get the base from exponent from.
@base double
리턴 double

log10() 공개 정적인 메소드

Returns the base-10 logarithm of x. This is usually more accurate than log( x, 10).
public static log10 ( LuaState luaState, double x ) : double
luaState LuaState Pointer to lua_State struct.
x double The value to get the base from exponent from.
리턴 double

max() 공개 정적인 메소드

Returns the largest value of all arguments.
public static max ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
리턴 double

min() 공개 정적인 메소드

Returns the smallest value of all arguments.
public static min ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
리턴 double

modf() 공개 정적인 메소드

Returns the integral and fractional component of the modulo operation.
public static modf ( LuaState luaState, double @base, double modulator ) : double>.Tuple
luaState LuaState Pointer to lua_State struct.
@base double
modulator double The modulator.
리턴 double>.Tuple

modf() 공개 정적인 메소드

Returns the integral and fractional component of the modulo operation.
public static modf ( LuaState luaState, double @base, double modulator, double &integral, double &fractional ) : void
luaState LuaState Pointer to lua_State struct.
@base double
modulator double The modulator.
integral double The integral component.
fractional double The fractional component.
리턴 void

pow() 공개 정적인 메소드

Returns x raised to the power y. In particular, math.pow(1.0, x) and math.pow(x, 0.0) always return 1.0, even when x is a zero or a NaN. If both x and y are finite, x is negative, and y is not an integer then math.pow( x, y) is undefined.
public static pow ( LuaState luaState, double x, double y ) : double
luaState LuaState Pointer to lua_State struct.
x double Base.
y double Exponent.
리턴 double

rad() 공개 정적인 메소드

Converts an angle in degrees to it's equivalent in radians.
public static rad ( LuaState luaState, double degrees ) : double
luaState LuaState Pointer to lua_State struct.
degrees double The angle measured in degrees.
리턴 double

random() 공개 정적인 메소드

Returns a random integer between min and max.
public static random ( LuaState luaState, int min, int max ) : int
luaState LuaState Pointer to lua_State struct.
min int The minimum value.
max int The maximum value.
리턴 int

randomseed() 공개 정적인 메소드

Seeds the seed for the random generator, which will cause random to return the same sequence of numbers.
public static randomseed ( LuaState luaState, double seed ) : void
luaState LuaState Pointer to lua_State struct.
seed double The new seed.
리턴 void

sin() 공개 정적인 메소드

Returns sine of the given angle.
public static sin ( LuaState luaState, double angle ) : double
luaState LuaState Pointer to lua_State struct.
angle double Angle in radians.
리턴 double

sinh() 공개 정적인 메소드

Returns hyperbolic sine of the given number.
public static sinh ( LuaState luaState, double number ) : double
luaState LuaState Pointer to lua_State struct.
number double Value in radians.
리턴 double

sqrt() 공개 정적인 메소드

Returns square root of the given number.
public static sqrt ( LuaState luaState, double number ) : double
luaState LuaState Pointer to lua_State struct.
number double Value to get the square root of.
리턴 double

tan() 공개 정적인 메소드

Returns tangent of the given angle.
public static tan ( LuaState luaState, double angle ) : double
luaState LuaState Pointer to lua_State struct.
angle double Angle in radians.
리턴 double

tanh() 공개 정적인 메소드

Returns hyperbolic tangent of the given number.
public static tanh ( LuaState luaState, double number ) : double
luaState LuaState Pointer to lua_State struct.
number double Value in radians.
리턴 double