Vector3 结构

定义

表示一个具有三个单精度浮点值的向量。Represents a vector with three single-precision floating-point values.

public value class Vector3 : IEquatable<System::Numerics::Vector3>, IFormattable
public struct Vector3 : IEquatable<System.Numerics.Vector3>, IFormattable
type Vector3 = struct
    interface IFormattable
Public Structure Vector3
Implements IEquatable(Of Vector3), IFormattable
继承
Vector3
实现

注解

Vector3 结构为硬件加速提供支持。The Vector3 structure provides support for hardware acceleration.

对于矩阵转换,Vector2Vector3Vector4 实例表示为行:矩阵 M 使用 vM 乘法转换矢量 v 。For matrix transformations, the Vector2, Vector3, and Vector4 instances are represented as rows: a vector v is transformed by a matrix M with vM multiplication.

构造函数

Vector3(Single)

创建一个其三个元素具有相同值的新 Vector3 对象。Creates a new Vector3 object whose three elements have the same value.

Vector3(Single, Single, Single)

创建一个其元素具有指定值的向量。Creates a vector whose elements have the specified values.

Vector3(Vector2, Single)

从指定的 Vector3 对象和指定值创建新的 Vector2 对象。Creates a new Vector3 object from the specified Vector2 object and the specified value.

字段

X

向量的 X 分量。The X component of the vector.

Y

向量的 Y 分量。The Y component of the vector.

Z

向量的 Z 分量。The Z component of the vector.

属性

One

获取一个其 3 个元素等于 1 的向量。Gets a vector whose 3 elements are equal to one.

UnitX

获取向量 (1,0,0)。Gets the vector (1,0,0).

UnitY

获取向量 (0,1,0)。Gets the vector (0,1,0).

UnitZ

获取向量 (0,0,1)。Gets the vector (0,0,1).

Zero

获取一个其 3 个元素等于 0 的向量。Gets a vector whose 3 elements are equal to zero.

方法

Abs(Vector3)

返回一个向量,其元素是指定向量的每个元素的绝对值。Returns a vector whose elements are the absolute values of each of the specified vector's elements.

Add(Vector3, Vector3)

将两个向量相加。Adds two vectors together.

Clamp(Vector3, Vector3, Vector3)

将向量限制在最小值与最大值之间。Restricts a vector between a minimum and a maximum value.

CopyTo(Single[])

将向量的元素复制到指定数组中。Copies the elements of the vector to a specified array.

CopyTo(Single[], Int32)

从指定的索引位置开始,将向量的元素复制到指定的数组中。Copies the elements of the vector to a specified array starting at a specified index position.

Cross(Vector3, Vector3)

计算两个向量的叉积。Computes the cross product of two vectors.

Distance(Vector3, Vector3)

计算两个给定点之间的欧几里得距离。Computes the Euclidean distance between the two given points.

DistanceSquared(Vector3, Vector3)

返回两个指定点之间的欧几里得距离平方值。Returns the Euclidean distance squared between two specified points.

Divide(Vector3, Single)

将指定向量除以指定标量值。Divides the specified vector by a specified scalar value.

Divide(Vector3, Vector3)

将第一个向量除以第二个向量。Divides the first vector by the second.

Dot(Vector3, Vector3)

返回两个向量的点积。Returns the dot product of two vectors.

Equals(Object)

返回一个值,该值指示此实例是否与指定对象相等。Returns a value that indicates whether this instance and a specified object are equal.

Equals(Vector3)

返回一个值,该值指示此实例是否与另一个向量相等。Returns a value that indicates whether this instance and another vector are equal.

GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

Length()

返回此向量对象的长度。Returns the length of this vector object.

LengthSquared()

返回向量长度平方值。Returns the length of the vector squared.

Lerp(Vector3, Vector3, Single)

基于给定权重在两个向量之间执行线性内插。Performs a linear interpolation between two vectors based on the given weighting.

Max(Vector3, Vector3)

返回一个向量,其元素是两个指定向量中每对元素的较大值。Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.

Min(Vector3, Vector3)

返回一个向量,其元素是两个指定向量中每对元素的较小值。Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.

Multiply(Single, Vector3)

将标量值乘以指定向量。Multiplies a scalar value by a specified vector.

Multiply(Vector3, Single)

将向量乘以指定标量。Multiplies a vector by a specified scalar.

Multiply(Vector3, Vector3)

返回一个新向量,其值是两个指定向量中的每对元素的乘积。Returns a new vector whose values are the product of each pair of elements in two specified vectors.

Negate(Vector3)

对指定向量求反。Negates a specified vector.

Normalize(Vector3)

返回一个向量,其方向与指定向量相同,但长度为一。Returns a vector with the same direction as the specified vector, but with a length of one.

Reflect(Vector3, Vector3)

返回向量对具有指定法线的表面的反射。Returns the reflection of a vector off a surface that has the specified normal.

SquareRoot(Vector3)

返回一个向量,其元素是指定向量的每个元素的平方根。Returns a vector whose elements are the square root of each of a specified vector's elements.

Subtract(Vector3, Vector3)

从第一个向量中减去第二个向量。Subtracts the second vector from the first.

ToString()

使用默认格式设置返回当前实例的字符串表示形式。Returns the string representation of the current instance using default formatting.

ToString(String)

通过使用指定格式字符串设置各个元素的格式,来返回当前实例的字符串表示形式。Returns the string representation of the current instance using the specified format string to format individual elements.

ToString(String, IFormatProvider)

通过使用指定格式字符串设置各个元素的格式并使用指定格式提供程序定义特定于区域性的格式设置,来返回当前实例的字符串表示形式。Returns the string representation of the current instance using the specified format string to format individual elements and the specified format provider to define culture-specific formatting.

Transform(Vector3, Matrix4x4)

通过指定 4 x 4 矩阵转换向量。Transforms a vector by a specified 4x4 matrix.

Transform(Vector3, Quaternion)

通过指定的四元数旋转值转换向量。Transforms a vector by the specified Quaternion rotation value.

TransformNormal(Vector3, Matrix4x4)

通过给定的 4 x 4 矩阵变换向量法线。Transforms a vector normal by the given 4x4 matrix.

运算符

Addition(Vector3, Vector3)

将两个向量相加。Adds two vectors together.

Division(Vector3, Single)

将指定向量除以指定标量值。Divides the specified vector by a specified scalar value.

Division(Vector3, Vector3)

将第一个向量除以第二个向量。Divides the first vector by the second.

Equality(Vector3, Vector3)

返回一个值,该值指示两个指定向量中的每对元素是否相等。Returns a value that indicates whether each pair of elements in two specified vectors is equal.

Inequality(Vector3, Vector3)

返回一个值,该值指示两个指定向量是否不相等。Returns a value that indicates whether two specified vectors are not equal.

Multiply(Single, Vector3)

将标量值乘以指定向量。Multiples the scalar value by the specified vector.

Multiply(Vector3, Single)

将指定向量乘以指定标量值。Multiples the specified vector by the specified scalar value.

Multiply(Vector3, Vector3)

返回一个新向量,其值是两个指定向量中的每对元素的乘积。Returns a new vector whose values are the product of each pair of elements in two specified vectors.

Subtraction(Vector3, Vector3)

从第一个向量中减去第二个向量。Subtracts the second vector from the first.

UnaryNegation(Vector3)

对指定向量求反。Negates the specified vector.

扩展方法

AsVector128(Vector3)

适用于