Unity.Mathematics.Math 中文文档

2020-09-25  本文已影响0人  Leo0543

Unity.Mathematics.Math 中文文档 (原创翻译)
一、常量:
INFINITY
单精度常数,用于正无穷大。
public const float INFINITY = InfinityF
PI
数学常数pi。大约3.14。
public const float PI = 3.14159274F
SQRT2
平方根2。大约1.41。
public const float SQRT2 = 1.41421354F
二、方法
acos(float3)
返回float3向量的分量反余弦
public static float3 acos(float3 x)
all(bool3)
如果输入bool3向量的所有分量都为true,则返回true,否则返回false
public static bool all(bool3 x)
any(bool4)
如果输入bool4向量的任何分量为true,则返回true,否则返回false。
public static bool any(bool4 x)
asfloat(UInt32)
以浮点形式返回uint的位模式。
public static float asfloat(uint x)
asin(float4)
返回float4向量的分量反正弦
public static float4 asin(float4 x)
up()
Unity的上轴(0,1,0)
public static float3 up()
down()
Unity的下轴(0,-1,0)
public static float3 down()
forward()
Unity的前进轴(0,0,1)
public static float3 forward()
left()
Unity的左轴(-1,0,0)
public static float3 left()
right()
Unity的右轴(1,0,0)。
public static float3 right()
back()
Unity的后轴(0,0,-1)
public static float3 back()
bool2x2(bool2, bool2)
返回由两个bool2向量构造的bool2x2矩阵。
public static bool2x2 bool2x2(bool2 c0, bool2 c1)
ceil(Single)
四舍五入
返回将浮点值舍入为大于或等于原始值的最接近的整数值的结果。
public static float ceil(float x)
ceil(float3)
返回将float3向量值的每个分量四舍五入到大于或等于原始值的最近值的结果
public static float3 ceil(float3 x)
clamp(Int32, Int32, Int32)
返回将值x钳制到区间[a,b]中的结果,其中x、a和b是int值。
public static int clamp(int x, int a, int b)
cmax(float3)
返回float3向量的最大分量。
public static float cmax(float3 x)
cmin(float3)
返回float3向量的最小分量。
public static float cmin(float3 x)

determinant(float3x3)
返回float3x3矩阵的行列式。
public static float determinant(float3x3 m)
degrees(float3)
返回float3矢量从弧度到度数的组件转换结果。
public static float3 degrees(float3 x)
distance(Single, Single)
返回两个浮点值之间的距离。
public static float distance(float x, float y)
dot(Int32, Int32)
返回两个整型值的点积。相当于乘法。
public static int dot(int x, int y)
dot(float3, float3)
返回两个float3向量的点积。
public static float dot(float3 x, float3 y)
exp10(Single)
返回x的以10为底的指数。
public static float exp10(float x)
floor(Single)
返回将浮点值四舍五入到小于或等于原始值的最接近整数值的结果。
public static float floor(float x)
floor(float3)
返回将float3向量值的每个分量四舍五入到小于或等于原始值的最接近值的结果。
public static float3 floor(float3 x)
frac(Single)
返回浮点值的小数部分。
public static float frac(float x)
frac(float3)
返回float3向量的按分数小数部分。
public static float3 frac(float3 x)
half(Single)
返回从浮点值构造的一半值。
public static half half(float v)
half3(float3)
通过组件式转换,返回由float3向量构造的half3向量。
public static half3 half3(float3 v)
hash(float3)
返回float3向量的uint哈希码。
public static uint hash(float3 v)
inverse(float3x3)
返回float3x3矩阵的float3x3全逆。
public static float3x3 inverse(float3x3 m)

isfinite(Single)
如果输入浮点值是有限浮点值,则返回true,否则返回false。
public static bool isfinite(float x)
isfinite(float3)
返回一个bool3,指示float3的每个组件是否为有限浮点值。
public static bool3 isfinite(float3 x)
isinf(Single)
如果输入浮点值是无限浮点值,则返回true,否则返回false。
public static bool isinf(float x)
length(Single)
返回浮点值的长度。相当于绝对值。
public static float length(float x)
length(float3)
返回float3向量的长度。
public static float length(float3 x)
lengthsq(Single)
返回浮点值的平方长度。等于值的平方。
public static float lengthsq(float x)
lengthsq(float3)
返回一个浮点3向量的长度的平方。
public static float lengthsq(float3 x)

lerp(Single, Single, Single)
返回使用插值参数s从x到y的线性插值结果
public static float lerp(float x, float y, float s)
lerp(float3, float3, Single)
返回使用插值参数s从x到y的组件线性插值的结果。
public static float3 lerp(float3 x, float3 y, float s)
lerp(float3, float3, float3)
返回使用插值参数s的相应分量从x到y的分量线性插值的结果。
public static float3 lerp(float3 x, float3 y, float3 s)
log(Single)
返回浮点值的自然对数。
public static float log(float x)
mad(Int32, Int32, Int32)
返回对3个int值进行乘加运算(a * b + c)的结果。
public static int mad(int a, int b, int c)
mad(float3, float3, float3)
返回对3个float3向量进行逐位乘加运算(a * b + c)的结果。
public static float3 mad(float3 a, float3 b, float3 c)
max(Int32, Int32)
返回两个int值的最大值。
public static int max(int x, int y)
max(float3, float3)
返回两个float3向量的按分量最大值。
public static float3 max(float3 x, float3 y)

modf(Single, out Single)
将浮点值拆分为整数部分i和小数部分,然后返回。这两个部分都接受输入的符号。
public static float modf(float x, out float i)
mul(Single, Single)
返回浮点值和浮点值之间的矩阵乘法的浮点值结果。
public static float mul(float a, float b)
mul(float3, float3)
返回float3行向量和float3列向量之间矩阵乘法的浮点值结果。
public static float mul(float3 a, float3 b)
normalize(float3)
通过将float3向量x按1/length(x)缩放,返回其规范化版本。
public static float3 normalize(float3 x)
pow(Single, Single)
返回x的y次方。
public static float pow(float x, float y)
quaternion(float4)
返回从float4向量构造的四元数。
public static quaternion quaternion(float4 value)
radians(Single)
返回将浮点值从角度转换为弧度的结果
public static float radians(float x)
radians(float3)
返回浮点3向量从角度到弧度的组件转换的结果
public static float3 radians(float3 x)

rcp(Single)
返回一个浮点值的倒数。
public static float rcp(float x)
rcp(float3)
返回float3向量的逐项倒数。
public static float3 rcp(float3 x)
rol(Int32, Int32)
返回将整型数的位向左旋转n位的结果。
public static int rol(int x, int n)
rotate(float4x4, float3)
返回由float4x4矩阵旋转float3向量的结果
public static float3 rotate(float4x4 a, float3 b)
round(Single)
返回将浮点值四舍五入到最接近的整数值的结果。
public static float round(float x)
rsqrt(float3)
返回一个浮点3向量的按分量倒数的平方根。
public static float3 rsqrt(float3 x)
select(Int32, Int32, Boolean)
如果c为真,则返回b,否则返回a
public static int select(int a, int b, bool c)

sign(Single)
返回浮点值的符号。-小于0时为1.0f,为零时为0.0f,大于零时为1.0f
public static float sign(float x)
sign(float3)
返回float3值的分量符号。正分量为1.0f,零分量为0.0f,负分量为-1.0f。
public static float3 sign(float3 x)
sincos(Single, out Single, out Single)
通过out参数s和c返回输入浮点值x的正弦和余弦
public static void sincos(float x, out float s, out float c)
sinh(Single)
返回浮点值的双曲正弦值
public static float sinh(float x)
smoothstep(Single, Single, Single)
当x在[a,b]中时,返回介于0.0f和1.0f之间的平滑Hermite插值。
public static float smoothstep(float a, float b, float x)
sqrt(Single)
返回浮点值的平方根
public static float sqrt(float x)
step(Single, Single)
计算一个阶跃(步进)函数。x >= y时返回1.0f,否则返回0.0f。
public static float step(float y, float x)

上一篇 下一篇

猜你喜欢

热点阅读