float Length { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Length property of the Vector4 struct represents the magnitude or length of the vector. It is a read-only property that calculates the Euclidean norm of the vector, which is the square root of the sum of the squares of its components (x, y, z, w).

Usage

To access the length of a Vector4 instance, simply use the Length property. This property is useful when you need to determine the magnitude of the vector, for example, to normalize it or to compare it with other vectors.

Example

Vector4 vector = new Vector4(3.0f, 4.0f, 0.0f, 0.0f);
float length = vector.Length;
// length will be 5.0f, as it is the hypotenuse of a 3-4-5 right triangle.