Introdction
The math package contains various useful classes for dealing with problems in geometry, linear algebra, collision detection, interpolation, and common unit conversions.Math包里包含了多种类来处理几何,线性代数,插值,和常用单位转换等功能。
The MathUtils (code) class covers a number of useful odds and ends. There is a handy static
Random
member to avoid instantiating one in your own code. Using the same random instance throughout your code can also ensure consistently deterministic behavior as long as you store the seed value used. There are constants for conversion between radians and degrees as well as look-up tables for the sine and cosine functions. There are also float
versions of common java.lang.Math
functions to avoid having to cast down from double
.
MathUtils包含了许多有用的实现类,静态的Random类,避免用户在代码中再次初始化,只要保存了所要的值,保证确定的行为。也提供了转换弧度和度数的常量,sin 和 cos函数的查询表,以及float版本,避免将double降低精确度转为float。
Catmull-Rom Spline CR 样条曲线
A Catmull-Rom spline (code) allows a continuous curve to be generated from a discrete list of control points. Splines can be useful for describing a smooth path of motion of a body or camera through space. Catmull-Rom splines are particularly useful in this regard as they are simple to compute and can guarantee the resulting path will pass through each control point (except the first and last points which control spline shape but do not become part of the path). Unlike Bezier splines, control tangents are implicit and control over spline shape is traded for ease of path definition. All that is required is a list of points through which the desired path must pass.
CR-Spline通过多个分离的控制点列表生成一个连续的曲线,可以用来描述一个主体或摄像头平滑移动的路径,考虑到计算简单,并且保证曲线通过所有的控制点(注意:首尾两个控制点为辅助点,曲线不会穿过,其余控制点在之间曲线会穿过(路径点)。不像贝塞尔曲线,控制切线是暗示的和控制整个路径的形状,所需要的就是个包含了所有穿过的点。
Ear-Clipping Triangulator 三角切割器
One way to triangulate a simple polygon is based on the fact that any simple polygon with at least four vertices and with no holes has at least two so called 'ears', which are triangles with two sides being the edges of the polygon and the third one completely inside it. The Ear-Clipping Triangulator (code) class implements this idea, producing a list of triangles from a list of supplied points representing a two-dimensional polygon. The input polygon may be concave and the resulting triangles have a clockwise order.
可以将简单的多边形分割成多个三角形,最少四个顶点的多边形,至少含有2个所谓的“耳朵”(2侧组成了多边形的边,第三条完全在多边形里面。可以依据2维的多边形提供的控制点列表生成三角形列表。输入的多边形可能是曲面的,生成的三角形是顺时针顺序。
Windowed Mean 加窗平均?
The Windowed Mean (code) class is useful for tracking the mean of a running stream of floating point values within a certain window. This can be useful for basic statistical analysis such as measuring average network speed, gauging user reaction times for dynamic difficulty adjustment, or energy-based beat detection in music visualizations.
对于跟踪在特定窗口活动的浮点流的 平均是是很有用的,也可以用来统计分析,例如测量网速均值,用户反映速度,或 在乐器模拟中的能量化的节拍探测。