C# 클래스 Server.Utils.Math.MathHelper

Contains commonly used precalculated values and mathematical operations.
파일 보기 프로젝트 열기: GrindFest/GrindFest

공개 메소드들

메소드 설명
Barycentric ( float value1, float value2, float value3, float amount1, float amount2 ) : float

Returns the Cartesian coordinate for one axis of a point that is defined by a given triangle and two normalized barycentric (areal) coordinates.

CatmullRom ( float value1, float value2, float value3, float value4, float amount ) : float

Performs a Catmull-Rom interpolation using the specified positions.

Clamp ( float value, float min, float max ) : float

Restricts a value to be within a specified range.

Clamp ( int value, int min, int max ) : int

Restricts a value to be within a specified range.

Distance ( float value1, float value2 ) : float

Calculates the absolute value of the difference of two values.

Hermite ( float value1, float tangent1, float value2, float tangent2, float amount ) : float

Performs a Hermite spline interpolation.

IsPowerOfTwo ( int value ) : bool

Determines if value is powered by two.

Lerp ( float value1, float value2, float amount ) : float

Linearly interpolates between two values.

This method performs the linear interpolation based on the following formula. value1 + (value2 - value1) * amount Passing amount a value of 0 will cause value1 to be returned, a value of 1 will cause value2 to be returned.

Max ( float value1, float value2 ) : float

Returns the greater of two values.

Min ( float value1, float value2 ) : float

Returns the lesser of two values.

SmoothStep ( float value1, float value2, float amount ) : float

Interpolates between two values using a cubic equation.

ToDegrees ( float radians ) : float

Converts radians to degrees.

This method uses double precission internally, though it returns single float Factor = 180 / pi

ToRadians ( float degrees ) : float

Converts degrees to radians.

This method uses double precission internally, though it returns single float Factor = pi / 180

WrapAngle ( float angle ) : float

Reduces a given angle to a value between π and -π.

메소드 상세

Barycentric() 공개 정적인 메소드

Returns the Cartesian coordinate for one axis of a point that is defined by a given triangle and two normalized barycentric (areal) coordinates.
public static Barycentric ( float value1, float value2, float value3, float amount1, float amount2 ) : float
value1 float The coordinate on one axis of vertex 1 of the defining triangle.
value2 float The coordinate on the same axis of vertex 2 of the defining triangle.
value3 float The coordinate on the same axis of vertex 3 of the defining triangle.
amount1 float The normalized barycentric (areal) coordinate b2, equal to the weighting factor for vertex 2, the coordinate of which is specified in value2.
amount2 float The normalized barycentric (areal) coordinate b3, equal to the weighting factor for vertex 3, the coordinate of which is specified in value3.
리턴 float

CatmullRom() 공개 정적인 메소드

Performs a Catmull-Rom interpolation using the specified positions.
public static CatmullRom ( float value1, float value2, float value3, float value4, float amount ) : float
value1 float The first position in the interpolation.
value2 float The second position in the interpolation.
value3 float The third position in the interpolation.
value4 float The fourth position in the interpolation.
amount float Weighting factor.
리턴 float

Clamp() 공개 정적인 메소드

Restricts a value to be within a specified range.
public static Clamp ( float value, float min, float max ) : float
value float The value to clamp.
min float The minimum value. If value is less than min, min will be returned.
max float The maximum value. If value is greater than max, max will be returned.
리턴 float

Clamp() 공개 정적인 메소드

Restricts a value to be within a specified range.
public static Clamp ( int value, int min, int max ) : int
value int The value to clamp.
min int The minimum value. If value is less than min, min will be returned.
max int The maximum value. If value is greater than max, max will be returned.
리턴 int

Distance() 공개 정적인 메소드

Calculates the absolute value of the difference of two values.
public static Distance ( float value1, float value2 ) : float
value1 float Source value.
value2 float Source value.
리턴 float

Hermite() 공개 정적인 메소드

Performs a Hermite spline interpolation.
public static Hermite ( float value1, float tangent1, float value2, float tangent2, float amount ) : float
value1 float Source position.
tangent1 float Source tangent.
value2 float Source position.
tangent2 float Source tangent.
amount float Weighting factor.
리턴 float

IsPowerOfTwo() 공개 정적인 메소드

Determines if value is powered by two.
public static IsPowerOfTwo ( int value ) : bool
value int A value.
리턴 bool

Lerp() 공개 정적인 메소드

Linearly interpolates between two values.
This method performs the linear interpolation based on the following formula. value1 + (value2 - value1) * amount Passing amount a value of 0 will cause value1 to be returned, a value of 1 will cause value2 to be returned.
public static Lerp ( float value1, float value2, float amount ) : float
value1 float Source value.
value2 float Source value.
amount float Value between 0 and 1 indicating the weight of value2.
리턴 float

Max() 공개 정적인 메소드

Returns the greater of two values.
public static Max ( float value1, float value2 ) : float
value1 float Source value.
value2 float Source value.
리턴 float

Min() 공개 정적인 메소드

Returns the lesser of two values.
public static Min ( float value1, float value2 ) : float
value1 float Source value.
value2 float Source value.
리턴 float

SmoothStep() 공개 정적인 메소드

Interpolates between two values using a cubic equation.
public static SmoothStep ( float value1, float value2, float amount ) : float
value1 float Source value.
value2 float Source value.
amount float Weighting value.
리턴 float

ToDegrees() 공개 정적인 메소드

Converts radians to degrees.
This method uses double precission internally, though it returns single float Factor = 180 / pi
public static ToDegrees ( float radians ) : float
radians float The angle in radians.
리턴 float

ToRadians() 공개 정적인 메소드

Converts degrees to radians.
This method uses double precission internally, though it returns single float Factor = pi / 180
public static ToRadians ( float degrees ) : float
degrees float The angle in degrees.
리턴 float

WrapAngle() 공개 정적인 메소드

Reduces a given angle to a value between π and -π.
public static WrapAngle ( float angle ) : float
angle float The angle to reduce, in radians.
리턴 float