-
pygame.math
- pygame module for vector classes
— a 2-Dimensional Vector — a 3-Dimensional Vector PYGAME数学模块目前提供二维和三维的向量类,
Vector2
和Vector3
分别为。它们支持以下数值运算:
vec+vec
,vec-vec
,vec*number
,number*vec
,vec/number
,vec//number
,vec+=vec
,vec-=vec
,vec*=number
,vec/=number
,vec//=number
。所有这些操作都将以元素为单位执行。此外
vec*vec
将执行标量积(也称为点阵产品)。如果要将向量v中的每个元素与向量w中的每个元素相乘,可以使用ElementWise方法:v.elementwise() * w
可以使用属性或下标检索或设置矢量的坐标
v = pygame.Vector3() v.x = 5 v[1] = 2 * v.x print(v[1]) # 10 v.x == v[0] v.y == v[1] v.z == v[2]
可以使用切片或旋转设置多个坐标
v = pygame.Vector2() v.xy = 1, 2 v[:] = 1, 2
New in pygame 1.9.2pre.
Changed in pygame 1.9.4: 删除了实验通知。
Changed in pygame 1.9.4: 允许像GLSL Vector2(2)==Vector2(2.0,2.0)这样的标量构造
Changed in pygame 1.9.4:
pygame.math
pygame module for vector classes 所需的导入。更方便pygame.Vector2
和pygame.Vector3
。- pygame.math.Vector2¶
- a 2-Dimensional VectorVector2() -> Vector2Vector2(int) -> Vector2Vector2(float) -> Vector2Vector2(Vector2) -> Vector2Vector2(x, y) -> Vector2Vector2((x, y)) -> Vector2
— calculates the dot- or scalar-product with the other vector — calculates the cross- or vector-product — returns the Euclidean magnitude of the vector. — returns the squared magnitude of the vector. — returns the Euclidean length of the vector. — returns the squared Euclidean length of the vector. — returns a vector with the same direction but length 1. — normalizes the vector in place so that its length is 1. — tests if the vector is normalized i.e. has length == 1. — scales the vector to a given length. — returns a vector reflected of a given normal. — reflect the vector of a given normal in place. — calculates the Euclidean distance to a given vector. — calculates the squared Euclidean distance to a given vector. — returns a vector moved toward the target by a given distance. — moves the vector toward its target at a given distance. — returns a linear interpolation to the given vector. — returns a spherical interpolation to the given vector. — The next operation will be performed elementwise. — rotates a vector by a given angle in degrees. — rotates a vector by a given angle in radians. — rotates the vector by a given angle in degrees in place. — rotates the vector by a given angle in radians in place. — rotates the vector by a given angle in radians in place. — calculates the angle to a given vector in degrees. — returns a tuple with radial distance and azimuthal angle. — Sets x and y from a polar coordinates tuple. — projects a vector onto another. — Returns a copy of itself. — Returns a copy of a vector with the magnitude clamped between max_length and min_length. — Clamps the vector's magnitude between max_length and min_length — Sets the coordinates of the vector. 有关的一些一般信息
Vector2
班级。Changed in pygame 2.1.3: 矢量子类的继承方法现在正确返回子类的实例,而不是超类
- dot()¶
- calculates the dot- or scalar-product with the other vectordot(Vector2) -> float
- cross()¶
- calculates the cross- or vector-productcross(Vector2) -> Vector2
计算叉积的第三个分量。
- magnitude()¶
- returns the Euclidean magnitude of the vector.magnitude() -> float
计算从该定理得出的向量的大小:
vec.magnitude() == math.sqrt(vec.x**2 + vec.y**2)
- magnitude_squared()¶
- returns the squared magnitude of the vector.magnitude_squared() -> float
计算从该定理得出的向量的大小:
vec.magnitude_squared() == vec.x**2 + vec.y**2
。这比这更快vec.magnitude()
因为它避免了平方根。
- length()¶
- returns the Euclidean length of the vector.length() -> float
根据毕达哥拉斯定理计算向量的欧几里得长度:
vec.length() == math.sqrt(vec.x**2 + vec.y**2)
- length_squared()¶
- returns the squared Euclidean length of the vector.length_squared() -> float
根据毕达哥拉斯定理计算向量的欧几里得长度:
vec.length_squared() == vec.x**2 + vec.y**2
。这比这更快vec.length()
因为它避免了平方根。
- normalize()¶
- returns a vector with the same direction but length 1.normalize() -> Vector2
返回具有以下属性的新向量
length
等于1
和赛尔夫的方向一样。
- normalize_ip()¶
- normalizes the vector in place so that its length is 1.normalize_ip() -> None
规格化向量,使其具有
length
等于1
。向量的方向不变。
- is_normalized()¶
- tests if the vector is normalized i.e. has length == 1.is_normalized() -> Bool
如果向量具有
length
等于1
。否则它将返回False
。
- scale_to_length()¶
- scales the vector to a given length.scale_to_length(float) -> None
缩放向量,使其具有给定的长度。向量的方向不变。您还可以根据长度进行缩放
0
。如果向量是零向量(即具有长度0
因此没有方向)aValueError
都被养大了。
- reflect()¶
- returns a vector reflected of a given normal.reflect(Vector2) -> Vector2
返回一个新向量,该向量指向由给定曲面法线表征的曲面的自反弹方向。新矢量的长度与赛尔夫的长度相同。
- reflect_ip()¶
- reflect the vector of a given normal in place.reflect_ip(Vector2) -> None
更改自身的方向,就像它会反射具有给定曲面法线的曲面一样。
- distance_to()¶
- calculates the Euclidean distance to a given vector.distance_to(Vector2) -> float
- distance_squared_to()¶
- calculates the squared Euclidean distance to a given vector.distance_squared_to(Vector2) -> float
- move_towards()¶
- returns a vector moved toward the target by a given distance.move_towards(Vector2, float) -> Vector2
返回向给定向量移动给定距离且不超过其目标向量的向量。第一个参数确定目标向量,而第二个参数确定增量距离。如果距离在负数中,则它将远离目标向量。
New in pygame 2.1.3.
- move_towards_ip()¶
- moves the vector toward its target at a given distance.move_towards_ip(Vector2, float) -> None
以给定的距离向给定的向量移动,并且不会超出其目标向量。第一个参数确定目标向量,而第二个参数确定增量距离。如果距离在负数中,则它将远离目标向量。
New in pygame 2.1.3.
- lerp()¶
- returns a linear interpolation to the given vector.lerp(Vector2, float) -> Vector2
返回一个向量,它是自身和给定向量之间的线性内插。第二个参数决定了自己和他人之间的距离。它必须是介于
0
和1
哪里0
意思是自我和1
意味着其他人将被退还。
- slerp()¶
- returns a spherical interpolation to the given vector.slerp(Vector2, float) -> Vector2
计算从自身到给定向量的球面内插。第二个参数-通常称为t-必须在范围内
[-1, 1]
。它将两个向量之间的结果应该是的位置参数化。如果给出负值,则插值不会取最短路径的补值。
- elementwise()¶
- The next operation will be performed elementwise.elementwise() -> VectorElementwiseProxy
将以下运算应用于向量的每个元素。
- rotate()¶
- rotates a vector by a given angle in degrees.rotate(angle) -> Vector2
返回与self长度相同但逆时针旋转给定角度(以度为单位)的向量。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
- rotate_rad()¶
- rotates a vector by a given angle in radians.rotate_rad(angle) -> Vector2
返回一个与self长度相同但以弧度为单位逆时针旋转给定角度的向量。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
New in pygame 2.0.0.
- rotate_ip()¶
- rotates the vector by a given angle in degrees in place.rotate_ip(angle) -> None
将矢量逆时针旋转给定的角度(以度为单位)。向量的长度不变。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
- rotate_ip_rad()¶
- rotates the vector by a given angle in radians in place.rotate_ip_rad(angle) -> None
已弃用:改用Rotate_rad_ip()。
New in pygame 2.0.0.
Deprecated since pygame 2.1.1.
- rotate_rad_ip()¶
- rotates the vector by a given angle in radians in place.rotate_rad_ip(angle) -> None
将矢量逆时针旋转给定的角度(以弧度为单位)。向量的长度不变。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
New in pygame 2.1.1.
- angle_to()¶
- calculates the angle to a given vector in degrees.angle_to(Vector2) -> float
返回self和给定向量之间的角度。
- as_polar()¶
- returns a tuple with radial distance and azimuthal angle.as_polar() -> (r, phi)
返回一个元组
(r, phi)
其中r是径向距离,Phi是方位角。
- from_polar()¶
- Sets x and y from a polar coordinates tuple.from_polar((r, phi)) -> None
从元组(r,Phi)设置x和y,其中r是径向距离,Phi是方位角。
- project()¶
- projects a vector onto another.project(Vector2) -> Vector2
返回投影向量。这对于在特定方向(例如,在墙的方向上)查找组件时的碰撞检测很有用。有关更详细的说明,请参阅 Wikipedia 。
New in pygame 2.0.2.
- copy()¶
- Returns a copy of itself.copy() -> Vector2
返回具有相同维度的新Vector2。
New in pygame 2.1.1.
- clamp_magnitude()¶
- Returns a copy of a vector with the magnitude clamped between max_length and min_length.clamp_magnitude(max_length) -> Vector2clamp_magnitude(min_length, max_length) -> Vector2
返回一个新的矢量副本,其幅值被钳制在max_length和min_length之间。如果未指定MIN_LENGTH值,则它将自动设置为0。
New in pygame 2.1.3.
- clamp_magnitude_ip()¶
- Clamps the vector's magnitude between max_length and min_lengthclamp_magnitude_ip(max_length) -> Noneclamp_magnitude_ip(min_length, max_length) -> None
将向量的幅值钳制在max_long和min_long之间。如果未指定MIN_LENGTH值,则它将自动设置为0。
New in pygame 2.1.3.
- update()¶
- Sets the coordinates of the vector.update() -> Noneupdate(int) -> Noneupdate(float) -> Noneupdate(Vector2) -> Noneupdate(x, y) -> Noneupdate((x, y)) -> None
将坐标x和y设置到位。
New in pygame 1.9.5.
- pygame.math.Vector3¶
- a 3-Dimensional VectorVector3() -> Vector3Vector3(int) -> Vector3Vector3(float) -> Vector3Vector3(Vector3) -> Vector3Vector3(x, y, z) -> Vector3Vector3((x, y, z)) -> Vector3
— calculates the dot- or scalar-product with the other vector — calculates the cross- or vector-product — returns the Euclidean magnitude of the vector. — returns the squared Euclidean magnitude of the vector. — returns the Euclidean length of the vector. — returns the squared Euclidean length of the vector. — returns a vector with the same direction but length 1. — normalizes the vector in place so that its length is 1. — tests if the vector is normalized i.e. has length == 1. — scales the vector to a given length. — returns a vector reflected of a given normal. — reflect the vector of a given normal in place. — calculates the Euclidean distance to a given vector. — calculates the squared Euclidean distance to a given vector. — returns a vector moved toward the target by a given distance. — moves the vector toward its target at a given distance. — returns a linear interpolation to the given vector. — returns a spherical interpolation to the given vector. — The next operation will be performed elementwise. — rotates a vector by a given angle in degrees. — rotates a vector by a given angle in radians. — rotates the vector by a given angle in degrees in place. — rotates the vector by a given angle in radians in place. — rotates the vector by a given angle in radians in place. — rotates a vector around the x-axis by the angle in degrees. — rotates a vector around the x-axis by the angle in radians. — rotates the vector around the x-axis by the angle in degrees in place. — rotates the vector around the x-axis by the angle in radians in place. — rotates the vector around the x-axis by the angle in radians in place. — rotates a vector around the y-axis by the angle in degrees. — rotates a vector around the y-axis by the angle in radians. — rotates the vector around the y-axis by the angle in degrees in place. — rotates the vector around the y-axis by the angle in radians in place. — rotates the vector around the y-axis by the angle in radians in place. — rotates a vector around the z-axis by the angle in degrees. — rotates a vector around the z-axis by the angle in radians. — rotates the vector around the z-axis by the angle in degrees in place. — rotates the vector around the z-axis by the angle in radians in place. — rotates the vector around the z-axis by the angle in radians in place. — calculates the angle to a given vector in degrees. — returns a tuple with radial distance, inclination and azimuthal angle. — Sets x, y and z from a spherical coordinates 3-tuple. — projects a vector onto another. — Returns a copy of itself. — Returns a copy of a vector with the magnitude clamped between max_length and min_length. — Clamps the vector's magnitude between max_length and min_length — Sets the coordinates of the vector. 有关Vector3类的一些一般信息。
Changed in pygame 2.1.3: 矢量子类的继承方法现在正确返回子类的实例,而不是超类
- dot()¶
- calculates the dot- or scalar-product with the other vectordot(Vector3) -> float
- cross()¶
- calculates the cross- or vector-productcross(Vector3) -> Vector3
计算叉积。
- magnitude()¶
- returns the Euclidean magnitude of the vector.magnitude() -> float
计算从该定理得出的向量的大小:
vec.magnitude() == math.sqrt(vec.x**2 + vec.y**2 + vec.z**2)
- magnitude_squared()¶
- returns the squared Euclidean magnitude of the vector.magnitude_squared() -> float
计算从该定理得出的向量的大小:
vec.magnitude_squared() == vec.x**2 + vec.y**2 + vec.z**2
。这比这更快vec.magnitude()
因为它避免了平方根。
- length()¶
- returns the Euclidean length of the vector.length() -> float
根据毕达哥拉斯定理计算向量的欧几里得长度:
vec.length() == math.sqrt(vec.x**2 + vec.y**2 + vec.z**2)
- length_squared()¶
- returns the squared Euclidean length of the vector.length_squared() -> float
根据毕达哥拉斯定理计算向量的欧几里得长度:
vec.length_squared() == vec.x**2 + vec.y**2 + vec.z**2
。这比这更快vec.length()
因为它避免了平方根。
- normalize()¶
- returns a vector with the same direction but length 1.normalize() -> Vector3
返回具有以下属性的新向量
length
等于1
和赛尔夫的方向一样。
- normalize_ip()¶
- normalizes the vector in place so that its length is 1.normalize_ip() -> None
规格化向量,使其具有
length
等于1
。向量的方向不变。
- is_normalized()¶
- tests if the vector is normalized i.e. has length == 1.is_normalized() -> Bool
如果向量具有
length
等于1
。否则它将返回False
。
- scale_to_length()¶
- scales the vector to a given length.scale_to_length(float) -> None
缩放向量,使其具有给定的长度。向量的方向不变。您还可以根据长度进行缩放
0
。如果向量是零向量(即具有长度0
因此没有方向)aValueError
都被养大了。
- reflect()¶
- returns a vector reflected of a given normal.reflect(Vector3) -> Vector3
返回一个新向量,该向量指向由给定曲面法线表征的曲面的自反弹方向。新矢量的长度与赛尔夫的长度相同。
- reflect_ip()¶
- reflect the vector of a given normal in place.reflect_ip(Vector3) -> None
更改自身的方向,就像它会反射具有给定曲面法线的曲面一样。
- distance_to()¶
- calculates the Euclidean distance to a given vector.distance_to(Vector3) -> float
- distance_squared_to()¶
- calculates the squared Euclidean distance to a given vector.distance_squared_to(Vector3) -> float
- move_towards()¶
- returns a vector moved toward the target by a given distance.move_towards(Vector3, float) -> Vector3
返回向给定向量移动给定距离且不超过其目标向量的向量。第一个参数确定目标向量,而第二个参数确定增量距离。如果距离在负数中,则它将远离目标向量。
New in pygame 2.1.3.
- move_towards_ip()¶
- moves the vector toward its target at a given distance.move_towards_ip(Vector3, float) -> None
以给定的距离向给定的向量移动,并且不会超出其目标向量。第一个参数确定目标向量,而第二个参数确定增量距离。如果距离在负数中,则它将远离目标向量。
New in pygame 2.1.3.
- lerp()¶
- returns a linear interpolation to the given vector.lerp(Vector3, float) -> Vector3
返回一个向量,它是自身和给定向量之间的线性内插。第二个参数确定结果与他人之间的距离。它必须是介于
0
和1
,在哪里0
意思是自我和1
意味着其他人将被退还。
- slerp()¶
- returns a spherical interpolation to the given vector.slerp(Vector3, float) -> Vector3
计算从自身到给定向量的球面内插。第二个参数-通常称为t-必须在范围内
[-1, 1]
。它将两个向量之间的结果应该是的位置参数化。如果给出负值,则插值不会取最短路径的补值。
- elementwise()¶
- The next operation will be performed elementwise.elementwise() -> VectorElementwiseProxy
将以下运算应用于向量的每个元素。
- rotate()¶
- rotates a vector by a given angle in degrees.rotate(angle, Vector3) -> Vector3
返回一个与self长度相同但以给定轴为单位逆时针旋转给定角度的向量。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
- rotate_rad()¶
- rotates a vector by a given angle in radians.rotate_rad(angle, Vector3) -> Vector3
返回一个向量,该向量与self具有相同的长度,但绕给定轴逆时针旋转给定角度(以弧度为单位)。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
New in pygame 2.0.0.
- rotate_ip()¶
- rotates the vector by a given angle in degrees in place.rotate_ip(angle, Vector3) -> None
将向量围绕给定轴逆时针旋转给定的角度(以度为单位)。向量的长度不变。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
- rotate_ip_rad()¶
- rotates the vector by a given angle in radians in place.rotate_ip_rad(angle, Vector3) -> None
已弃用:改用Rotate_rad_ip()。
New in pygame 2.0.0.
Deprecated since pygame 2.1.1.
- rotate_rad_ip()¶
- rotates the vector by a given angle in radians in place.rotate_rad_ip(angle, Vector3) -> None
将矢量围绕给定轴逆时针旋转给定的角度(以弧度为单位)。向量的长度不变。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
New in pygame 2.1.1.
- rotate_x()¶
- rotates a vector around the x-axis by the angle in degrees.rotate_x(angle) -> Vector3
返回一个与self长度相同但绕x轴逆时针旋转给定角度(以度为单位)的向量。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
- rotate_x_rad()¶
- rotates a vector around the x-axis by the angle in radians.rotate_x_rad(angle) -> Vector3
返回一个与self长度相同但以弧度为单位绕x轴逆时针旋转给定角度的向量。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
New in pygame 2.0.0.
- rotate_x_ip()¶
- rotates the vector around the x-axis by the angle in degrees in place.rotate_x_ip(angle) -> None
将向量绕x轴逆时针旋转给定的角度(以度为单位)。向量的长度不变。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
- rotate_x_ip_rad()¶
- rotates the vector around the x-axis by the angle in radians in place.rotate_x_ip_rad(angle) -> None
已弃用:改用Rotate_x_rad_ip()。
New in pygame 2.0.0.
Deprecated since pygame 2.1.1.
- rotate_x_rad_ip()¶
- rotates the vector around the x-axis by the angle in radians in place.rotate_x_rad_ip(angle) -> None
将向量绕x轴逆时针旋转给定角度(以弧度为单位)。向量的长度不变。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
New in pygame 2.1.1.
- rotate_y()¶
- rotates a vector around the y-axis by the angle in degrees.rotate_y(angle) -> Vector3
返回一个与self长度相同但绕y轴逆时针旋转给定角度(以度为单位)的向量。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
- rotate_y_rad()¶
- rotates a vector around the y-axis by the angle in radians.rotate_y_rad(angle) -> Vector3
返回一个与self长度相同但以弧度为单位绕y轴逆时针旋转给定角度的向量。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
New in pygame 2.0.0.
- rotate_y_ip()¶
- rotates the vector around the y-axis by the angle in degrees in place.rotate_y_ip(angle) -> None
将向量围绕y轴逆时针旋转给定的角度(以度为单位)。向量的长度不变。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
- rotate_y_ip_rad()¶
- rotates the vector around the y-axis by the angle in radians in place.rotate_y_ip_rad(angle) -> None
已弃用:改用Rotate_y_rad_ip()。
New in pygame 2.0.0.
Deprecated since pygame 2.1.1.
- rotate_y_rad_ip()¶
- rotates the vector around the y-axis by the angle in radians in place.rotate_y_rad_ip(angle) -> None
将矢量绕y轴逆时针旋转给定的角度(以弧度为单位)。向量的长度不变。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
New in pygame 2.1.1.
- rotate_z()¶
- rotates a vector around the z-axis by the angle in degrees.rotate_z(angle) -> Vector3
返回一个与self长度相同但绕z轴逆时针旋转给定角度(以度为单位)的矢量。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
- rotate_z_rad()¶
- rotates a vector around the z-axis by the angle in radians.rotate_z_rad(angle) -> Vector3
返回一个与self长度相同但以弧度为单位绕z轴逆时针旋转给定角度的向量。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
New in pygame 2.0.0.
- rotate_z_ip()¶
- rotates the vector around the z-axis by the angle in degrees in place.rotate_z_ip(angle) -> None
将向量围绕z轴逆时针旋转给定的角度(以度为单位)。向量的长度不变。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
- rotate_z_ip_rad()¶
- rotates the vector around the z-axis by the angle in radians in place.rotate_z_ip_rad(angle) -> None
已弃用:改用Rotate_z_rad_ip()。
Deprecated since pygame 2.1.1.
- rotate_z_rad_ip()¶
- rotates the vector around the z-axis by the angle in radians in place.rotate_z_rad_ip(angle) -> None
将向量绕z轴逆时针旋转给定的角度(以弧度为单位)。向量的长度不变。(请注意,由于PYGAME的反y坐标系,如果显示,旋转将显示为顺时针方向)。
New in pygame 2.1.1.
- angle_to()¶
- calculates the angle to a given vector in degrees.angle_to(Vector3) -> float
返回self和给定向量之间的角度。
- as_spherical()¶
- returns a tuple with radial distance, inclination and azimuthal angle.as_spherical() -> (r, theta, phi)
返回一个元组
(r, theta, phi)
其中r是径向距离,theta是倾角,Phi是方位角。
- from_spherical()¶
- Sets x, y and z from a spherical coordinates 3-tuple.from_spherical((r, theta, phi)) -> None
从元组中设置x、y和z
(r, theta, phi)
其中r是径向距离,theta是倾角,Phi是方位角。
- project()¶
- projects a vector onto another.project(Vector3) -> Vector3
返回投影向量。这对于在特定方向(例如,在墙的方向上)查找组件时的碰撞检测很有用。有关更详细的说明,请参阅 Wikipedia 。
New in pygame 2.0.2.
- copy()¶
- Returns a copy of itself.copy() -> Vector3
返回具有相同维度的新Vector3。
New in pygame 2.1.1.
- clamp_magnitude()¶
- Returns a copy of a vector with the magnitude clamped between max_length and min_length.clamp_magnitude(max_length) -> Vector3clamp_magnitude(min_length, max_length) -> Vector3
返回一个新的矢量副本,其幅值被钳制在max_length和min_length之间。如果未指定MIN_LENGTH值,则它将自动设置为0。
New in pygame 2.1.3.
- clamp_magnitude_ip()¶
- Clamps the vector's magnitude between max_length and min_lengthclamp_magnitude_ip(max_length) -> Noneclamp_magnitude_ip(min_length, max_length) -> None
将向量的幅值钳制在max_long和min_long之间。如果未指定MIN_LENGTH值,则它将自动设置为0。
New in pygame 2.1.3.
- update()¶
- Sets the coordinates of the vector.update() -> Noneupdate(int) -> Noneupdate(float) -> Noneupdate(Vector3) -> Noneupdate(x, y, z) -> Noneupdate((x, y, z)) -> None
将坐标x、y和z设置到位。
New in pygame 1.9.5.
Edit on GitHub