Unity3d Mathf数学运算说明

Mathf数学运算

Struct 结构

A collection of common math functions.

Mathf提供

数学计算的函数与常量,面有所有数学计算时需要用到的函数。Mathf对象没有构造函数,是一个固有的对象,并不像String那样是对象的类,因此没有构造函数 Math()。

Class Variables类变量

  • PI
    The infamous 3.14159265358979... value (Read Only).
    PI(读pai)的值,也就是圆周率(π)的值3.14159265358979323846...(只读)
  • A representation of positive infinity (Read Only).
    表示正无穷,也就是无穷大,∞ (只读)[in'finiti]
  • A representation of negative infinity (Read Only).
    表示负无穷,也就是无穷小,-∞ (只读)['negətiv][in'finiti]
  • Degrees-to-radians conversion constant (Read Only).
    度到弧度的转化常量。(只读)[di'gri:s] ['reidiəns]
  • Radians-to-degrees conversion constant (Read Only).
    弧度到度的转化常量。(只读)
  • A tiny floating point value (Read Only).
    一个很小的浮点数值。(只读)['epsilən]

Class Functions类函数

  • Sin
    Returns the sine of angle f in radians.
    计算并返回以弧度为单位指定的角 f 的正弦值。
  • Cos
    Returns the cosine of angle f in radians.
    返回由参数 f 指定的角的余弦值(介于 -1.0 与 1.0 之间的值)。
  • Tan
    Returns the tangent of angle f in radians.
    计算并返回以弧度为单位 f 指定角度的正切值。
  • Returns the arc-sine of f - the angle in radians whose sine is f.
    以弧度为单位计算并返回参数 f 中指定的数字的反正弦值。
  • Returns the arc-cosine of f - the angle in radians whose cosine is f.
    以弧度为单位计算并返回参数 f 中指定的数字的反余弦值。
  • Returns the arc-tangent of f - the angle in radians whose tangent is f.
    计算并返回参数 f 中指定的数字的反正切值。返回值介于负二分之 pi 与正二分之 pi 之间。
  • Returns the angle in radians whose Tan is y/x.
    以弧度为单位计算并返回 y/x 的反正切值。返回值表示相对直角三角形对角的角,其中 x 是临边边长,而 y 是对边边长。
  • Returns square root of f.
    计算并返回 f 的平方根。
  • Abs
    Returns the absolute value of f.
    计算并返回指定参数 f 绝对值。
  • Min
    Returns the smallest of two or more values.
    返回两个或更多值中最小的值。
  • Max
    Returns largest of two or more values.
    返回两个或更多值中最大的值。
  • Pow
    Returns f raised to power p.
    计算并返回 f 的 p 次方。
  • Exp
    Returns e raised to the specified power.
    返回 e 的 power 次方的值。
  • Log
    Returns the logarithm of a specified number in a specified base.
    返回参数 f 的对数。
  • Returns the base 10 logarithm of a specified number.
    返回f的对数,基数为10。
  • Returns the smallest integer greater to or equal to f.
    返回 f 指定数字或表达式的上限值。数字的上限值是大于等于该数字的最接近的整数。
  • Returns the largest integer smaller to or equal to f.
    返回参数 f 中指定的数字或表达式的下限值。下限值是小于等于指定数字或表达式的最接近的整数。
  • Returns f rounded to the nearest integer.
    返回浮点数 f 进行四舍五入最接近的整数。
  • Returns the smallest integer greater to or equal to f.
    返回最小的整数大于或等于f。
  • Returns the largest integer smaller to or equal to f.
    返回最大的整数,小于或等于f。
  • Returns f rounded to the nearest integer.
    返回 f 指定的值四舍五入到最近的整数。
  • Returns the sign of f.
    返回 f 的符号。当 f 为正或为0返回1,为负返回-1。
  • Clamps a value between a minimum float and maximum float value.
    限制value的值在min和max之间, 如果value小于min,返回min。 如果value大于max,返回max,否则返回value
  • Clamps value between 0 and 1 and returns value.
    限制value在0,1之间,如果value小于0,返回0。如果value大于1,返回1,否则返回value 。
  • Interpolates a towards b by t. t is clamped between 0 and 1.
    基于浮点数t返回a到b之间的插值,t限制在0~1之间。
  • Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
    和Lerp的原理一样,当他们环绕360度确保插值正确。a和b是代表度数。
  • Moves a value current towards target.
    改变一个当前值向目标值靠近。
  • Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.
    像MoveTowards,但是当它们环绕360度确保插值正确。
  • Interpolates between min and max and eases in and out at the limits.
    和lerp类似,在最小和最大值之间的插值,并在限制处渐入渐出。
  • Compares two floating point values if they are similar.
    比较两个浮点数值,看它们是否非常接近。
  • Gradually changes a value towards a desired goal over time.
    随着时间的推移逐渐改变一个值到期望值。
  • Gradually changes an angle given in degrees towards a desired goal angle over time.
    随着时间的推移逐渐改变一个给定的角度到期望的角度。
  • Loops the value t, so that it is never larger than length and never smaller than 0.
    循环数值t,0到length之间。t值永远不会大于length的值,也永远不会小于0。
  • PingPongs the value t, so that it is never larger than length and never smaller than 0.
    让数值t在 0到length之间往返。t值永远不会大于length的值,也永远不会小于0。
  • Calculates the Lerp parameter between of two values.
    计算两个值之间的Lerp参数。也就是value在from和to之间的比例值。
  • Returns true if the value is power of two.
    如果该值是2的幂,返回true。
  • Returns the next power of two value
    返回下一个2的幂值。
  • Returns the closest power of two value.
    返回距离value最近的2的次方数。
  • Calculates the shortest difference between two given angles.
    计算给定的两个角之间最短的差异。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值