用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:rect:rect

Rect 矩阵

struct in UnityEngine

Description 描述

A 2D Rectangle defined by X and Y position, width and height.
X,Y坐标,宽和高定义的二维矩阵。

Unity uses a number of 2D coordinate spaces, most of which define X as increasing to the right, and Y increasing upwards. The one exception is in the GUI and GUILayout classes, where Y increases downwards.
Unity使用2D空间坐标,大多数定义X向右增加,并且y定义向上增加。唯一例外是GUI和GUILayout类,Y向下增加。

The following examples are illustrated in GUI space, where (0,0) represents the top-left corner and Y increases downwards.
接下来的例子是在GUI中的插图,(0,0)代表的是左上角并且y向下为增加。

Rectangles can be specified in two different ways. The first is with an x and y position and a width and height:
可以指定矩阵的两种不同的方式。第一种x,y,宽和高:

The other way is with the X and Y coordinates of each of its edges. These are called xMin, xMax, yMin and yMax:
另一种方法是用的X和Y坐标的边缘。这些被称为xMin xMax yMin yMax:

Note that although x and y have the same values as xMin and yMin, they behave differently when you set them. Setting x or y changes the position of the rectangle, but preserves its size:
注意,尽管x和y与xMin yMin的值相同,他们表现出不同的设置。设置x或y改变矩形的位置,但保留其大小:

Setting any of xMin, xMax, yMin and yMax will resize the rectangle, but preserve the position of the opposite edge:
设置xMin, xMax, yMin 和 yMax将会改变矩形的大小,但保留位置相反的边缘:

See Also: GUI Scripting Guide, Camera.rect, Camera.pixelRect.

Variables 变量

centerThe position of the center of the rectangle.
矩形的中心点。
heightThe height of the rectangle, measured from the Y position.
矩形的高度,从Y位置测量。
maxThe position of the maximum corner of the rectangle.
矩形最大角的位置。
minThe position of the minimum corner of the rectangle.
最小角的位置的矩形。
positionThe X and Y position of the rectangle.
矩形的X和Y轴位置。
sizeThe width and height of the rectangle.
矩形的宽和高。
widthThe width of the rectangle, measured from the X position.
矩形的宽度,从x位置开始测量。
xThe X coordinate of the rectangle.
矩形的左坐标。。
xMaxThe maximum X coordinate of the rectangle.
矩形的右坐标。
xMinThe minimum X coordinate of the rectangle.
矩形的左坐标。
yThe Y coordinate of the rectangle.
矩形的顶坐标。
yMaxThe maximum Y coordinate of the rectangle.
矩形的底坐标。
yMinThe minimum Y coordinate of the rectangle.
矩形的顶坐标。

Constructors 构造

RectCreates a new rectangle.
创建新的矩形。

Public Functions 公共函数

ContainsReturns true if the x and y components of point is a point inside this rectangle. If allowInverse is present and true, the width and height of the Rect are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.
如果该点的X和y都在该矩形内返回true。如果当前是allowInverse和true,矩形的宽和高允许取负值(即,最小值大于最大值),并且测试依然运行。
OverlapsReturns true if the other rectangle overlaps this one. If allowInverse is present and true, the widths and heights of the Rects are allowed to take negative values (ie, the min value is greater than the max), and the test will still work.
如果其他的矩形重叠返回true。如果当前允许allowInverse并且值为true,矩形的宽度和高度可以取负值(即最小值大于最大值),那么测试仍然运行。
SetSet components of an existing Rect.
设置现有的矩形的组件。
ToStringReturns a nicely formatted string for this Rect.
该矩形返回精确的格式化字符串。

Static Functions 静态函数

MinMaxRectCreates a rectangle from min/max coordinate values.
根据min/max坐标值创建矩形。
NormalizedToPointReturns a point inside a rectangle, given normalized coordinates.
返回矩形内一点,给定坐标归一化。
PointToNormalizedReturns the normalized coordinates cooresponding the the point.
返回归一化坐标相对应的点。

Operators 运算符

operator!=Returns true if the rectangles are different.
如果矩形不同返回true。
operator==Returns true if the rectangles are the same.
如果矩形相同返回true。
script/unityengine/classes/rect/rect.txt · 最后更改: 2016/08/02 05:34 (外部编辑)