Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

Vector3 Struct

Definition

Namespace:
System.Numerics
Assemblies:
System.Numerics.dll, System.Numerics.Vectors.dll
Assemblies:
netstandard.dll, System.Numerics.Vectors.dll
Assembly:
System.Numerics.Vectors.dll
Assembly:
System.Numerics.dll
Assembly:
netstandard.dll
Source:
Vector3.cs
Source:
Vector3.cs
Source:
Vector3.cs
Source:
Vector3.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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 Vector3Implements IEquatable(Of Vector3), IFormattable
Inheritance
Implements

Remarks

TheVector3 structure provides support for hardware acceleration.

For matrix transformations, theVector2,Vector3, andVector4 instances are represented as rows: a vectorv is transformed by a matrixM withvM multiplication.

Constructors

NameDescription
Vector3(ReadOnlySpan<Single>)

Constructs a vector from the givenReadOnlySpan<T>. The span must contain at least 3 elements.

Vector3(Single, Single, Single)

Creates a vector whose elements have the specified values.

Vector3(Single)

Creates a newVector3 object whose three elements have the same value.

Vector3(Vector2, Single)

Creates a newVector3 object from the specifiedVector2 object and the specified value.

Fields

NameDescription
X

The X component of the vector.

Y

The Y component of the vector.

Z

The Z component of the vector.

Properties

NameDescription
AllBitsSet

Gets a vector where all bits are set to1.

E

Gets a vector whose elements are equal toE.

Epsilon

Gets a vector whose elements are equal toEpsilon.

Item[Int32]

Gets or sets the element at the specified index.

NaN

Gets a vector whose elements are equal toNaN.

NegativeInfinity

Gets a vector whose elements are equal toNegativeInfinity.

NegativeZero

Gets a vector whose elements are equal toNegativeZero.

One

Gets a vector whose 3 elements are equal to one.

Pi

Gets a vector whose elements are equal toPi.

PositiveInfinity

Gets a vector whose elements are equal toPositiveInfinity.

Tau

Gets a vector whose elements are equal toTau.

UnitX

Gets the vector (1,0,0).

UnitY

Gets the vector (0,1,0).

UnitZ

Gets the vector (0,0,1).

Zero

Gets a vector whose 3 elements are equal to zero.

Methods

NameDescription
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.

All(Vector3, Single)

Determines if all elements of a vector are equal to a given value.

AllWhereAllBitsSet(Vector3)

Determines if all elements of a vector have all their bits set.

AndNot(Vector3, Vector3)

Computes the bitwise-and of a given vector and the ones complement of another vector.

Any(Vector3, Single)

Determines if any elements of a vector are equal to a given value.

AnyWhereAllBitsSet(Vector3)

Determines if any elements of a vector have all their bits set.

BitwiseAnd(Vector3, Vector3)

Computes the bitwise-and of two vectors.

BitwiseOr(Vector3, Vector3)

Computes the bitwise-or of two vectors.

Clamp(Vector3, Vector3, Vector3)

Restricts a vector between a minimum and a maximum value.

ClampNative(Vector3, Vector3, Vector3)

Restricts a vector between a minimum and a maximum value using platform specific behavior forNaN andNegativeZero..

ConditionalSelect(Vector3, Vector3, Vector3)

Conditionally selects a value from two vectors on a bitwise basis.

CopySign(Vector3, Vector3)

Copies the per-element sign of a vector to the per-element sign of another vector.

CopyTo(Single[], Int32)

Copies the elements of the vector to a specified array starting at a specified index position.

CopyTo(Single[])

Copies the elements of the vector to a specified array.

CopyTo(Span<Single>)

Copies the vector to the givenSpan<T>. The length of the destination span must be at least 3.

Cos(Vector3)

Computes the cosine of each element in a vector.

Count(Vector3, Single)

Determines the number of elements in a vector that are equal to a given value.

CountWhereAllBitsSet(Vector3)

Determines the number of elements in a vector that have all their bits set.

Create(ReadOnlySpan<Single>)

Constructs a vector from the givenReadOnlySpan<T>. The span must contain at least 3 elements.

Create(Single, Single, Single)

Creates a vector whose elements have the specified values.

Create(Single)

Creates a newVector3 object whose three elements have the same value.

Create(Vector2, Single)

Creates a newVector3 object from the specifiedVector2 object and a Z component.

CreateScalar(Single)

Creates a vector withX initialized to the specified value and the remaining elements initialized to zero.

CreateScalarUnsafe(Single)

Creates a vector withX initialized to the specified value and the remaining elements left uninitialized.

Cross(Vector3, Vector3)

Computes the cross product of two vectors.

DegreesToRadians(Vector3)

Converts a given vector from degrees to radians.

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, Vector3)

Compares two vectors to determine if they are equal on a per-element basis.

Equals(Vector3)

Returns a value that indicates whether this instance and another vector are equal.

EqualsAll(Vector3, Vector3)

Compares two vectors to determine if all elements are equal.

EqualsAny(Vector3, Vector3)

Compares two vectors to determine if any elements are equal.

Exp(Vector3)

Computes the exponential of each element in a vector.

FusedMultiplyAdd(Vector3, Vector3, Vector3)

Computes (left *right) +addend, rounded as one ternary operation.

GetHashCode()

Returns the hash code for this instance.

GreaterThan(Vector3, Vector3)

Compares two vectors to determine which is greater on a per-element basis.

GreaterThanAll(Vector3, Vector3)

Compares two vectors to determine if all elements are greater.

GreaterThanAny(Vector3, Vector3)

Compares two vectors to determine if any elements are greater.

GreaterThanOrEqual(Vector3, Vector3)

Compares two vectors to determine which is greater or equal on a per-element basis.

GreaterThanOrEqualAll(Vector3, Vector3)

Compares two vectors to determine if all elements are greater or equal.

GreaterThanOrEqualAny(Vector3, Vector3)

Compares two vectors to determine if any elements are greater or equal.

Hypot(Vector3, Vector3)

Computes the hypotenuse given two vectors representing the lengths of the shorter sides in a right-angled triangle.

IndexOf(Vector3, Single)

Determines the index of the first element in a vector that is equal to a given value.

IndexOfWhereAllBitsSet(Vector3)

Determines the index of the first element in a vector that has all bits set.

IsEvenInteger(Vector3)

Determines which elements in a vector are even integral values.

IsFinite(Vector3)

Determines which elements in a vector are finite.

IsInfinity(Vector3)

Determines which elements in a vector are infinity.

IsInteger(Vector3)

Determines which elements in a vector are integral values.

IsNaN(Vector3)

Determines which elements in a vector are NaN.

IsNegative(Vector3)

Determines which elements in a vector represents negative real numbers.

IsNegativeInfinity(Vector3)

Determines which elements in a vector are negative infinity.

IsNormal(Vector3)

Determines which elements in a vector are normal.

IsOddInteger(Vector3)

Determines which elements in a vector are odd integral values.

IsPositive(Vector3)

Determines which elements in a vector represents positive real numbers.

IsPositiveInfinity(Vector3)

Determines which elements in a vector are positive infinity.

IsSubnormal(Vector3)

Determines which elements in a vector are subnormal.

IsZero(Vector3)

Determines which elements in a vector are zero.

LastIndexOf(Vector3, Single)

Determines the index of the last element in a vector that is equal to a given value.

LastIndexOfWhereAllBitsSet(Vector3)

Determines the index of the last element in a vector that has all bits set.

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.

Lerp(Vector3, Vector3, Vector3)

Performs a linear interpolation between two vectors based on the given weighting.

LessThan(Vector3, Vector3)

Compares two vectors to determine which is less on a per-element basis.

LessThanAll(Vector3, Vector3)

Compares two vectors to determine if all elements are less.

LessThanAny(Vector3, Vector3)

Compares two vectors to determine if any elements are less.

LessThanOrEqual(Vector3, Vector3)

Compares two vectors to determine which is less or equal on a per-element basis.

LessThanOrEqualAll(Vector3, Vector3)

Compares two vectors to determine if all elements are less or equal.

LessThanOrEqualAny(Vector3, Vector3)

Compares two vectors to determine if any elements are less or equal.

Load(Single*)

Loads a vector from the given source.

LoadAligned(Single*)

Loads a vector from the given aligned source.

LoadAlignedNonTemporal(Single*)

Loads a vector from the given aligned source.

LoadUnsafe(Single, UIntPtr)

Loads a vector from the given source and element offset.

LoadUnsafe(Single)

Loads a vector from the given source.

Log(Vector3)

Computes the log of each element in a vector.

Log2(Vector3)

Computes the log2 of each element in a vector.

Max(Vector3, Vector3)

Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.

MaxMagnitude(Vector3, Vector3)

Compares two vectors to compute which has the greater magnitude on a per-element basis.

MaxMagnitudeNumber(Vector3, Vector3)

Compares two vectors, on a per-element basis, to compute which has the greater magnitude and returning the other value if an input isNaN.

MaxNative(Vector3, Vector3)

Compare two vectors to determine which is greater on a per-element basis using platform specific behavior forNaN andNegativeZero.

MaxNumber(Vector3, Vector3)

Compares two vectors, on a per-element basis, to compute which is greater and returning the other value if an element isNaN.

Min(Vector3, Vector3)

Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.

MinMagnitude(Vector3, Vector3)

Compares two vectors to compute which has the lesser magnitude on a per-element basis.

MinMagnitudeNumber(Vector3, Vector3)

Compares two vectors, on a per-element basis, to compute which has the lesser magnitude and returning the other value if an input isNaN.

MinNative(Vector3, Vector3)

Compare two vectors to determine which is lesser on a per-element basis using platform specific behavior forNaN andNegativeZero.

MinNumber(Vector3, Vector3)

Compares two vectors, on a per-element basis, to compute which is lesser and returning the other value if an element isNaN.

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.

MultiplyAddEstimate(Vector3, Vector3, Vector3)

Computes an estimate of (left *right) +addend.

Negate(Vector3)

Negates a specified vector.

None(Vector3, Single)

Determines if no elements of a vector are equal to a given value.

NoneWhereAllBitsSet(Vector3)

Determines if no elements of a vector have all their bits set.

Normalize(Vector3)

Returns a vector with the same direction as the specified vector, but with a length of one.

OnesComplement(Vector3)

Computes the ones-complement of a vector.

RadiansToDegrees(Vector3)

Converts a given vector from radians to degrees.

Reflect(Vector3, Vector3)

Returns the reflection of a vector off a surface that has the specified normal.

Round(Vector3, MidpointRounding)

Rounds each element in a vector to the nearest integer using the specified rounding mode.

Round(Vector3)

Rounds each element in a vector to the nearest integer using the default rounding mode (ToEven).

Shuffle(Vector3, Byte, Byte, Byte)

Creates a new vector by selecting values from an input vector using a set of indices.

Sin(Vector3)

Computes the sine of each element in a vector.

SinCos(Vector3)

Computes the sine and cosine of each element in a vector.

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.

Sum(Vector3)

Computes the sum of all elements in a vector.

ToString()

Returns the string representation of the current instance using default formatting.

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.

ToString(String)

Returns the string representation of the current instance using the specified format string to format individual elements.

Transform(Vector3, Matrix4x4)

Transforms a vector by a specified 4x4 matrix.

Transform(Vector3, Quaternion)

Transforms a vector by the specified Quaternion rotation value.

TransformNormal(Vector3, Matrix4x4)

Transforms a vector normal by the given 4x4 matrix.

Truncate(Vector3)

Truncates each element in a vector.

TryCopyTo(Span<Single>)

Attempts to copy the vector to the givenSpan<T>. The length of the destination span must be at least 3.

Xor(Vector3, Vector3)

Computes the exclusive-or of two vectors.

Operators

NameDescription
Addition(Vector3, Vector3)

Adds two vectors together.

BitwiseAnd(Vector3, Vector3)

Computes the bitwise-and of two vectors.

BitwiseOr(Vector3, Vector3)

Computes the bitwise-or of two vectors.

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.

ExclusiveOr(Vector3, Vector3)

Computes the exclusive-or of two vectors.

Inequality(Vector3, Vector3)

Returns a value that indicates whether two specified vectors are not equal.

LeftShift(Vector3, Int32)

Shifts each element of a vector left by the specified amount.

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.

OnesComplement(Vector3)

Computes the ones-complement of a vector.

RightShift(Vector3, Int32)

Shifts (signed) each element of a vector right by the specified amount.

Subtraction(Vector3, Vector3)

Subtracts the second vector from the first.

UnaryNegation(Vector3)

Negates the specified vector.

UnaryPlus(Vector3)

Returns a given vector unchanged.

UnsignedRightShift(Vector3, Int32)

Shifts (unsigned) each element of a vector right by the specified amount.

Extension Methods

NameDescription
AsVector2(Vector3)

Reinterprets aVector3 as a newVector2.

AsVector4(Vector3)

Converts aVector3 to a newVector4 with the new elements zeroed.

AsVector4Unsafe(Vector3)

Converts aVector3 to a newVector4 with the new elements undefined.

ExtractMostSignificantBits(Vector3)

Extracts the most significant bit from each element in a vector.

GetElement(Vector3, Int32)

Gets the element at the specified index.

Store(Vector3, Single*)

Stores a vector at the given destination.

StoreAligned(Vector3, Single*)

Stores a vector at the given 8-byte aligned destination.

StoreAlignedNonTemporal(Vector3, Single*)

Stores a vector at the given 8-byte aligned destination.

StoreUnsafe(Vector3, Single, UIntPtr)

Stores a vector at the given destination.

StoreUnsafe(Vector3, Single)

Stores a vector at the given destination.

ToScalar(Vector3)

Converts the given vector to a scalar containing the value of the first element.

WithElement(Vector3, Int32, Single)

Creates a newVector128<T> with the element at the specified index set to the specified value and the remaining elements set to the same value as that in the given vector.

AsVector128(Vector3)

Reinterprets aVector3 as a newVector128<T>.

AsVector128Unsafe(Vector3)

Reinterprets aVector3 as a newVector128<T>, leaving the new elements undefined.

Applies to

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?