Struct Vector3
- Namespace
- Alis.Core.Aspect.Math.Vector
- Assembly
- Alis.dll
The vector
[Serializable]
public struct Vector3 : IEquatable<Vector3>, IFormattable, ISerializable
Implements
Inherited Members
Constructors
Vector3(float)
Creates a new Alis.Core.Aspect.Math.Vector.Vector3 object whose three elements have the same value.
private Vector3(float value)
Parameters
value
float-
The value to assign to all three elements.
Vector3(Vector2, float)
Initializes a new instance of the Alis.Core.Aspect.Math.Vector.Vector3 class
public Vector3(Vector2 value, float z)
Parameters
Vector3(float, float, float)
Creates a vector whose elements have the specified values.
public Vector3(float x, float y, float z)
Parameters
x
float-
The value to assign to the Alis.Core.Aspect.Math.Vector.Vector3.X field.
y
float-
The value to assign to the Alis.Core.Aspect.Math.Vector.Vector3.Y field.
z
float-
The value to assign to the Alis.Core.Aspect.Math.Vector.Vector3.Z field.
Fields
hashCode
The hash code
private readonly int hashCode
Field Value
Properties
One
Gets a vector whose 3 elements are equal to one.
public static Vector3 One { get; }
Property Value
UnitX
Gets the vector (1,0,0).
public static Vector3 UnitX { get; }
Property Value
UnitY
Gets the vector (0,1,0).
public static Vector3 UnitY { get; }
Property Value
UnitZ
Gets the vector (0,0,1).
public static Vector3 UnitZ { get; }
Property Value
X
The X component of the vector.
public float X { readonly get; set; }
Property Value
Y
The Y component of the vector.
public float Y { readonly get; set; }
Property Value
Z
The Z component of the vector.
public float Z { readonly get; set; }
Property Value
Zero
Gets a vector whose 3 elements are equal to zero.
public static Vector3 Zero { get; }
Property Value
Methods
Cross(Vector3, Vector3)
Computes the cross product of two vectors.
public static Vector3 Cross(Vector3 vector1, Vector3 vector2)
Parameters
Returns
- Vector3
-
The cross product.
Dot(Vector3, Vector3)
Returns the dot product of two vectors.
public static float Dot(Vector3 vector1, Vector3 vector2)
Parameters
Returns
- float
-
The dot product.
Equals(object)
Returns a value that indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object obj)
Parameters
obj
object-
The object to compare with the current instance.
Returns
- bool
-
true if the current instance and
obj
are equal; otherwise, false. Ifobj
is null, the method returns false.
Remarks
The current instance and obj
are equal if obj
is a
Alis.Core.Aspect.Math.Vector.Vector3 object and their corresponding elements are equal.
Equals(Vector3)
Returns a value that indicates whether this instance and another vector are equal.
public readonly bool Equals(Vector3 other)
Parameters
other
Vector3-
The other vector.
Returns
Remarks
Two vectors are equal if their Alis.Core.Aspect.Math.Vector.Vector3.X, Alis.Core.Aspect.Math.Vector.Vector3.Y, and Alis.Core.Aspect.Math.Vector.Vector3.Z elements are equal.
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
-
The hash code.
GetObjectData(SerializationInfo, StreamingContext)
Gets the object data using the specified info
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
info
SerializationInfo-
The info
context
StreamingContext-
The context
Length()
Returns the length of this vector object.
public readonly float Length()
Returns
- float
-
The vector's length.
LengthSquared()
Returns the length of the vector squared.
public readonly float LengthSquared()
Returns
- float
-
The vector's length squared.
Remarks
This operation offers better performance than a call to the Alis.Core.Aspect.Math.Vector.Vector3.Length method.
Normalize(Vector3)
Returns a vector with the same direction as the specified vector, but with a length of one.
public static Vector3 Normalize(Vector3 value)
Parameters
value
Vector3-
The vector to normalize.
Returns
- Vector3
-
The normalized vector.
ToString()
Returns the string representation of the current instance using default formatting.
public override readonly string ToString()
Returns
- string
-
The string representation of the current instance.
Remarks
This method returns a string in which each element of the vector is formatted using the "G" (general) format string and the formatting conventions of the current thread culture. The "<" and ">" characters are used to begin and end the string, and the current culture's System.Globalization.NumberFormatInfo.NumberGroupSeparator property followed by a space is used to separate each element.
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.
public readonly string ToString(string format, IFormatProvider formatProvider)
Parameters
format
string-
A standard or custom numeric format string that defines the format of individual elements.
formatProvider
IFormatProvider-
A format provider that supplies culture-specific formatting information.
Returns
- string
-
The string representation of the current instance.
Remarks
This method returns a string in which each element of the vector is formatted using format
and formatProvider
. The "<" and ">" characters are used to begin and end the string, and
the format provider's System.Globalization.NumberFormatInfo.NumberGroupSeparator property followed
by a space is used to separate each element.
Operators
operator +(Vector3, Vector3)
Adds two vectors together.
public static Vector3 operator +(Vector3 left, Vector3 right)
Parameters
Returns
- Vector3
-
The summed vector.
Remarks
The Alis.Core.Aspect.Math.Vector.Vector3.op_Addition(Alis.Core.Aspect.Math.Vector.Vector3,Alis.Core.Aspect.Math.Vector.Vector3) method defines the addition operation for Alis.Core.Aspect.Math.Vector.Vector3 objects.
operator /(Vector3, Vector3)
Divides the first vector by the second.
public static Vector3 operator /(Vector3 left, Vector3 right)
Parameters
Returns
- Vector3
-
The vector that results from dividing
left
byright
.
operator /(Vector3, float)
Divides the specified vector by a specified scalar value.
public static Vector3 operator /(Vector3 value1, float value2)
Parameters
Returns
- Vector3
-
The result of the division.
operator ==(Vector3, Vector3)
Returns a value that indicates whether each pair of elements in two specified vectors is equal.
public static bool operator ==(Vector3 left, Vector3 right)
Parameters
Returns
Remarks
Two Alis.Core.Aspect.Math.Vector.Vector3 objects are equal if each element in right
is equal to the
corresponding element in right
.
operator !=(Vector3, Vector3)
Returns a value that indicates whether two specified vectors are not equal.
public static bool operator !=(Vector3 left, Vector3 right)
Parameters
Returns
operator *(Vector3, Vector3)
Returns a new vector whose values are the product of each pair of elements in two specified vectors.
public static Vector3 operator *(Vector3 left, Vector3 right)
Parameters
Returns
- Vector3
-
The element-wise product vector.
operator *(Vector3, float)
Multiplies the specified vector by the specified scalar value.
public static Vector3 operator *(Vector3 left, float right)
Parameters
Returns
- Vector3
-
The scaled vector.
operator *(float, Vector3)
Multiplies the scalar value by the specified vector.
public static Vector3 operator *(float left, Vector3 right)
Parameters
Returns
- Vector3
-
The scaled vector.
operator -(Vector3, Vector3)
Subtracts the second vector from the first.
public static Vector3 operator -(Vector3 left, Vector3 right)
Parameters
Returns
- Vector3
-
The vector that results from subtracting
right
fromleft
.
Remarks
The Alis.Core.Aspect.Math.Vector.Vector3.op_Subtraction(Alis.Core.Aspect.Math.Vector.Vector3,Alis.Core.Aspect.Math.Vector.Vector3) method defines the subtraction operation for Alis.Core.Aspect.Math.Vector.Vector3 objects.
operator -(Vector3)
Negates the specified vector.
public static Vector3 operator -(Vector3 value)
Parameters
value
Vector3-
The vector to negate.
Returns
- Vector3
-
The negated vector.
Remarks
The Alis.Core.Aspect.Math.Vector.Vector3.op_UnaryNegation(Alis.Core.Aspect.Math.Vector.Vector3) method defines the unary negation operation for Alis.Core.Aspect.Math.Vector.Vector3 objects.