Vector4 Structure (Microsoft.Xna.Framework)

Describes a 4D-vector.

Namespace: Microsoft.Xna.Framework
Assembly: MonoGame.Framework (MonoGame.Framework.dll 3.8.0.270)
  • C#
  • VB
  • F#
[DataContractAttribute]
[DebuggerDisplayAttribute("{DebugDisplayString,nq}")]
[TypeConverterAttribute(Microsoft.Xna.Framework.Design.Vector4TypeConverter)]
[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = -1, Size = -1)]
public struct Vector4 : IEquatable<Vector4>

Syntax for VB is not yet implemented.

Syntax for F# is not yet implemented.

The Vector4 type exposes the following members.

  Platforms Name Description
Vector4(float, float, float, float) Constructs a 3d vector with X, Y, Z and W from four values. 
Vector4(Vector2, float, float) Constructs a 3d vector with X and Z from Vector2 and Z and W from the scalars. 
Vector4(Vector3, float) Constructs a 3d vector with X, Y, Z from Vector3 and W from a scalar. 
Vector4(float) Constructs a 4d vector with X, Y, Z and W set to the same value. 
Top
  Platforms Name Description
W The w coordinate of this Vector4
X The x coordinate of this Vector4
Y The y coordinate of this Vector4
Z The z coordinate of this Vector4
Top
  Platforms Name Description
One Returns a Vector4 with components 1, 1, 1, 1. 
UnitW Returns a Vector4 with components 0, 0, 0, 1. 
UnitX Returns a Vector4 with components 1, 0, 0, 0. 
UnitY Returns a Vector4 with components 0, 1, 0, 0. 
UnitZ Returns a Vector4 with components 0, 0, 1, 0. 
Zero Returns a Vector4 with components 0, 0, 0, 0. 
Top
  Platforms Name Description
Add(Vector4, Vector4) Performs vector addition on value1 and value2
Add(Vector4, Vector4, out Vector4) Performs vector addition on value1 and value2, storing the result of the addition in result
Barycentric(Vector4, Vector4, Vector4, float, float) Creates a new Vector4 that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 4d-triangle. 
Barycentric(Vector4, Vector4, Vector4, float, float, out Vector4) Creates a new Vector4 that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 4d-triangle. 
CatmullRom(Vector4, Vector4, Vector4, Vector4, float, out Vector4) Creates a new Vector4 that contains CatmullRom interpolation of the specified vectors. 
CatmullRom(Vector4, Vector4, Vector4, Vector4, float) Creates a new Vector4 that contains CatmullRom interpolation of the specified vectors. 
Ceiling() Round the members of this Vector4 towards positive infinity. 
Ceiling(Vector4) Creates a new Vector4 that contains members from another vector rounded towards positive infinity. 
Ceiling(Vector4, out Vector4) Creates a new Vector4 that contains members from another vector rounded towards positive infinity. 
Clamp(Vector4, Vector4, Vector4) Clamps the specified value within a range. 
Clamp(Vector4, Vector4, Vector4, out Vector4) Clamps the specified value within a range. 
Deconstruct Deconstruction method for Vector4
Distance(Vector4, Vector4, out Single) Returns the distance between two vectors. 
Distance(Vector4, Vector4) Returns the distance between two vectors. 
DistanceSquared(Vector4, Vector4, out Single) Returns the squared distance between two vectors. 
DistanceSquared(Vector4, Vector4) Returns the squared distance between two vectors. 
Divide(Vector4, float) Divides the components of a Vector4 by a scalar. 
Divide(Vector4, Vector4, out Vector4) Divides the components of a Vector4 by the components of another Vector4
Divide(Vector4, float, out Vector4) Divides the components of a Vector4 by a scalar. 
Divide(Vector4, Vector4) Divides the components of a Vector4 by the components of another Vector4
Dot(Vector4, Vector4) Returns a dot product of two vectors. 
Dot(Vector4, Vector4, out Single) Returns a dot product of two vectors. 
Equals(Vector4) Compares whether current instance is equal to specified Vector4. (Implements IEquatable<T>.Equals().)
Equals(object) Compares whether current instance is equal to specified System.Object. (Overrides ValueType.Equals().)
Floor() Round the members of this Vector4 towards negative infinity. 
Floor(Vector4) Creates a new Vector4 that contains members from another vector rounded towards negative infinity. 
Floor(Vector4, out Vector4) Creates a new Vector4 that contains members from another vector rounded towards negative infinity. 
GetHashCode Gets the hash code of this Vector4. (Overrides ValueType.GetHashCode().)
Hermite(Vector4, Vector4, Vector4, Vector4, float) Creates a new Vector4 that contains hermite spline interpolation. 
Hermite(Vector4, Vector4, Vector4, Vector4, float, out Vector4) Creates a new Vector4 that contains hermite spline interpolation. 
Length Returns the length of this Vector4
LengthSquared Returns the squared length of this Vector4
Lerp(Vector4, Vector4, float) Creates a new Vector4 that contains linear interpolation of the specified vectors. 
Lerp(Vector4, Vector4, float, out Vector4) Creates a new Vector4 that contains linear interpolation of the specified vectors. 
LerpPrecise(Vector4, Vector4, float) Creates a new Vector4 that contains linear interpolation of the specified vectors. Uses LerpPrecise(float, float, float) on MathHelper for the interpolation. Less efficient but more precise compared to Lerp(Vector4, Vector4, float). See remarks section of LerpPrecise(float, float, float) on MathHelper for more info. 
LerpPrecise(Vector4, Vector4, float, out Vector4) Creates a new Vector4 that contains linear interpolation of the specified vectors. Uses LerpPrecise(float, float, float) on MathHelper for the interpolation. Less efficient but more precise compared to Lerp(Vector4, Vector4, float, out Vector4). See remarks section of LerpPrecise(float, float, float) on MathHelper for more info. 
Max(Vector4, Vector4) Creates a new Vector4 that contains a maximal values from the two vectors. 
Max(Vector4, Vector4, out Vector4) Creates a new Vector4 that contains a maximal values from the two vectors. 
Min(Vector4, Vector4) Creates a new Vector4 that contains a minimal values from the two vectors. 
Min(Vector4, Vector4, out Vector4) Creates a new Vector4 that contains a minimal values from the two vectors. 
Multiply(Vector4, float, out Vector4) Creates a new Vector4 that contains a multiplication of Vector4 and a scalar. 
Multiply(Vector4, Vector4) Creates a new Vector4 that contains a multiplication of two vectors. 
Multiply(Vector4, float) Creates a new Vector4 that contains a multiplication of Vector4 and a scalar. 
Multiply(Vector4, Vector4, out Vector4) Creates a new Vector4 that contains a multiplication of two vectors. 
Negate(Vector4) Creates a new Vector4 that contains the specified vector inversion. 
Negate(Vector4, out Vector4) Creates a new Vector4 that contains the specified vector inversion. 
Normalize(Vector4) Creates a new Vector4 that contains a normalized values from another vector. 
Normalize(Vector4, out Vector4) Creates a new Vector4 that contains a normalized values from another vector. 
Normalize() Turns this Vector4 to a unit vector with the same direction. 
Round(Vector4) Creates a new Vector4 that contains members from another vector rounded to the nearest integer value. 
Round() Round the members of this Vector4 to the nearest integer value. 
Round(Vector4, out Vector4) Creates a new Vector4 that contains members from another vector rounded to the nearest integer value. 
SmoothStep(Vector4, Vector4, float, out Vector4) Creates a new Vector4 that contains cubic interpolation of the specified vectors. 
SmoothStep(Vector4, Vector4, float) Creates a new Vector4 that contains cubic interpolation of the specified vectors. 
Subtract(Vector4, Vector4, out Vector4) Creates a new Vector4 that contains subtraction of on Vector4 from a another. 
Subtract(Vector4, Vector4) Creates a new Vector4 that contains subtraction of on Vector4 from a another. 
ToString Returns a System.String representation of this Vector4 in the format: {X:[X] Y:[Y] Z:[Z] W:[W]} (Overrides ValueType.ToString().)
Transform(Vector4[], int, Quaternion, Vector4[], int, int) Apply transformation on vectors within array of Vector4 by the specified Quaternion and places the results in an another array. 
Transform(Vector4[], Quaternion, Vector4[]) Apply transformation on all vectors within array of Vector4 by the specified Quaternion and places the results in an another array. 
Transform(Vector4[], Matrix, Vector4[]) Apply transformation on all vectors within array of Vector4 by the specified Matrix and places the results in an another array. 
Transform(Vector4[], int, Matrix, Vector4[], int, int) Apply transformation on vectors within array of Vector4 by the specified Matrix and places the results in an another array. 
Transform(Vector3, Quaternion, out Vector4) Creates a new Vector4 that contains a transformation of 3d-vector by the specified Quaternion
Transform(Vector4, Matrix, out Vector4) Creates a new Vector4 that contains a transformation of 4d-vector by the specified Matrix
Transform(Vector3, Matrix, out Vector4) Creates a new Vector4 that contains a transformation of 3d-vector by the specified Matrix
Transform(Vector2, Quaternion, out Vector4) Creates a new Vector4 that contains a transformation of 2d-vector by the specified Quaternion
Transform(Vector4, Quaternion) Creates a new Vector4 that contains a transformation of 4d-vector by the specified Quaternion
Transform(Vector4, Matrix) Creates a new Vector4 that contains a transformation of 4d-vector by the specified Matrix
Transform(Vector3, Quaternion) Creates a new Vector4 that contains a transformation of 3d-vector by the specified Quaternion
Transform(Vector3, Matrix) Creates a new Vector4 that contains a transformation of 3d-vector by the specified Matrix
Transform(Vector2, Quaternion) Creates a new Vector4 that contains a transformation of 2d-vector by the specified Quaternion
Transform(Vector2, Matrix) Creates a new Vector4 that contains a transformation of 2d-vector by the specified Matrix
Transform(Vector4, Quaternion, out Vector4) Creates a new Vector4 that contains a transformation of 4d-vector by the specified Quaternion
Transform(Vector2, Matrix, out Vector4) Creates a new Vector4 that contains a transformation of 2d-vector by the specified Matrix
Top
  Platforms Name Description
UnaryNegation Inverts values in the specified Vector4
Equality Compares whether two Vector4 instances are equal. 
Inequality Compares whether two Vector4 instances are not equal. 
Addition Adds two vectors. 
Subtraction Subtracts a Vector4 from a Vector4
Multiply(Vector4, Vector4) Multiplies the components of two vectors by each other. 
Multiply(Vector4, float) Multiplies the components of vector by a scalar. 
Multiply(float, Vector4) Multiplies the components of vector by a scalar. 
Division(Vector4, Vector4) Divides the components of a Vector4 by the components of another Vector4
Division(Vector4, float) Divides the components of a Vector4 by a scalar. 
Top
Supported in:

    
 Windows DirectX Desktop
    
 Linux Desktop
    
 Windows OpenGL Desktop
    
 Web