30 using System.Globalization;
31 using System.Runtime.InteropServices;
32 using System.ComponentModel;
34 namespace SiliconStudio.Core.Mathematics
39 [DataContract(
"float3")]
41 [StructLayout(LayoutKind.Sequential, Pack = 4)]
47 public static readonly
int SizeInBytes = Marshal.SizeOf(typeof(
Vector3));
137 throw new ArgumentNullException(
"values");
138 if (values.Length != 3)
139 throw new ArgumentOutOfRangeException(
"values",
"There must be three and only three input values for Vector3.");
149 public bool IsNormalized
151 get {
return Math.Abs((X * X) + (Y * Y) + (Z * Z) - 1f) < MathUtil.ZeroTolerance; }
161 public float this[
int index]
172 throw new ArgumentOutOfRangeException(
"index",
"Indices for Vector3 run from 0 to 2, inclusive.");
179 case 0: X = value;
break;
180 case 1: Y = value;
break;
181 case 2: Z = value;
break;
182 default:
throw new ArgumentOutOfRangeException(
"index",
"Indices for Vector3 run from 0 to 2, inclusive.");
197 return (
float)Math.Sqrt((X * X) + (Y * Y) + (Z * Z));
210 return (X * X) + (Y * Y) + (Z * Z);
218 float length = Length();
221 float inv = 1.0f / length;
232 public void Pow(
float exponent)
234 X = (float)Math.Pow(X, exponent);
235 Y = (float)Math.Pow(Y, exponent);
236 Z = (float)Math.Pow(Z, exponent);
245 return new float[] { X, Y, Z };
256 result =
new Vector3(left.X + right.X, left.Y + right.Y, left.Z + right.Z);
267 return new Vector3(left.
X + right.
X, left.
Y + right.
Y, left.
Z + right.
Z);
278 result =
new Vector3(left.X - right.X, left.Y - right.Y, left.Z - right.Z);
289 return new Vector3(left.
X - right.
X, left.
Y - right.
Y, left.
Z - right.
Z);
300 result =
new Vector3(value.X * scale, value.Y * scale, value.Z * scale);
311 return new Vector3(value.
X * scale, value.
Y * scale, value.
Z * scale);
322 result =
new Vector3(left.X * right.X, left.Y * right.Y, left.Z * right.Z);
333 return new Vector3(left.
X * right.
X, left.
Y * right.
Y, left.
Z * right.
Z);
344 result =
new Vector3(value.X / scale, value.Y / scale, value.Z / scale);
355 return new Vector3(value.
X / scale, value.
Y / scale, value.
Z / scale);
366 result =
new Vector3(left.X / right.X, left.Y / right.Y, left.Z / right.Z);
377 return new Vector3(left.
X / right.
X, left.
Y / right.
Y, left.
Z / right.
Z);
387 result =
new Vector3(-value.X, -value.Y, -value.Z);
397 return new Vector3(-value.
X, -value.
Y, -value.
Z);
411 result =
new Vector3((value1.X + (amount1 * (value2.X - value1.X))) + (amount2 * (value3.X - value1.X)),
412 (value1.Y + (amount1 * (value2.Y - value1.Y))) + (amount2 * (value3.Y - value1.Y)),
413 (value1.Z + (amount1 * (value2.Z - value1.Z))) + (amount2 * (value3.Z - value1.Z)));
428 Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out result);
442 x = (x > max.X) ? max.X : x;
443 x = (x < min.X) ? min.X : x;
446 y = (y > max.Y) ? max.Y : y;
447 y = (y < min.Y) ? min.Y :
y;
450 z = (z > max.Z) ? max.Z : z;
451 z = (z < min.Z) ? min.Z :
z;
466 Clamp(ref value, ref min, ref max, out result);
479 (left.Y * right.Z) - (left.Z * right.Y),
480 (left.Z * right.X) - (left.X * right.Z),
481 (left.X * right.Y) - (left.Y * right.X));
493 Cross(ref left, ref right, out result);
509 float x = value1.X - value2.X;
510 float y = value1.Y - value2.Y;
511 float z = value1.Z - value2.Z;
513 result = (float)Math.Sqrt((x * x) + (y * y) + (z * z));
528 float x = value1.X - value2.X;
529 float y = value1.Y - value2.Y;
530 float z = value1.Z - value2.Z;
532 return (
float)Math.Sqrt((x * x) + (y * y) + (z *
z));
550 float x = value1.X - value2.X;
551 float y = value1.Y - value2.Y;
552 float z = value1.Z - value2.Z;
554 result = (x * x) + (y * y) + (z *
z);
572 float x = value1.X - value2.X;
573 float y = value1.Y - value2.Y;
574 float z = value1.Z - value2.Z;
576 return (x * x) + (y *
y) + (z * z);
587 result = (left.X * right.X) + (left.Y * right.Y) + (left.Z * right.Z);
598 return (left.
X * right.
X) + (left.Y * right.Y) + (left.
Z * right.
Z);
637 result.X = start.X + ((end.X - start.X) * amount);
638 result.Y = start.Y + ((end.Y - start.Y) * amount);
639 result.Z = start.Z + ((end.Z - start.Z) * amount);
657 Lerp(ref start, ref end, amount, out result);
670 amount = (amount > 1.0f) ? 1.0f : ((amount < 0.0f) ? 0.0f : amount);
671 amount = (amount * amount) * (3.0f - (2.0f * amount));
673 result.X = start.X + ((end.X - start.X) * amount);
674 result.Y = start.Y + ((end.Y - start.Y) * amount);
675 result.Z = start.Z + ((end.Z - start.Z) * amount);
688 SmoothStep(ref start, ref end, amount, out result);
703 float squared = amount * amount;
704 float cubed = amount * squared;
705 float part1 = ((2.0f * cubed) - (3.0f * squared)) + 1.0f;
706 float part2 = (-2.0f * cubed) + (3.0f * squared);
707 float part3 = (cubed - (2.0f * squared)) + amount;
708 float part4 = cubed - squared;
710 result.X = (((value1.X * part1) + (value2.X * part2)) + (tangent1.X * part3)) + (tangent2.X * part4);
711 result.Y = (((value1.Y * part1) + (value2.Y * part2)) + (tangent1.Y * part3)) + (tangent2.Y * part4);
712 result.Z = (((value1.Z * part1) + (value2.Z * part2)) + (tangent1.Z * part3)) + (tangent2.Z * part4);
727 Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result);
742 float squared = amount * amount;
743 float cubed = amount * squared;
745 result.X = 0.5f * ((((2.0f * value2.X) + ((-value1.X + value3.X) * amount)) +
746 (((((2.0f * value1.X) - (5.0f * value2.X)) + (4.0f * value3.X)) - value4.X) * squared)) +
747 ((((-value1.X + (3.0f * value2.X)) - (3.0f * value3.X)) + value4.X) * cubed));
749 result.Y = 0.5f * ((((2.0f * value2.Y) + ((-value1.Y + value3.Y) * amount)) +
750 (((((2.0f * value1.Y) - (5.0f * value2.Y)) + (4.0f * value3.Y)) - value4.Y) * squared)) +
751 ((((-value1.Y + (3.0f * value2.Y)) - (3.0f * value3.Y)) + value4.Y) * cubed));
753 result.Z = 0.5f * ((((2.0f * value2.Z) + ((-value1.Z + value3.Z) * amount)) +
754 (((((2.0f * value1.Z) - (5.0f * value2.Z)) + (4.0f * value3.Z)) - value4.Z) * squared)) +
755 ((((-value1.Z + (3.0f * value2.Z)) - (3.0f * value3.Z)) + value4.Z) * cubed));
770 CatmullRom(ref value1, ref value2, ref value3, ref value4, amount, out result);
782 result.X = (left.X > right.X) ? left.X : right.X;
783 result.Y = (left.Y > right.Y) ? left.Y : right.Y;
784 result.Z = (left.Z > right.Z) ? left.Z : right.Z;
796 Max(ref left, ref right, out result);
808 result.X = (left.X < right.X) ? left.X : right.X;
809 result.Y = (left.Y < right.Y) ? left.Y : right.Y;
810 result.Z = (left.Z < right.Z) ? left.Z : right.Z;
822 Min(ref left, ref right, out result);
838 public static void Project(ref
Vector3 vector,
float x,
float y,
float width,
float height,
float minZ,
float maxZ, ref
Matrix worldViewProjection, out
Vector3 result)
841 TransformCoordinate(ref vector, ref worldViewProjection, out v);
843 result =
new Vector3(((1.0f + v.X) * 0.5f * width) + x, ((1.0f - v.Y) * 0.5f * height) + y, (v.Z * (maxZ - minZ)) + minZ);
861 Project(ref vector, x, y, width, height, minZ, maxZ, ref worldViewProjection, out result);
877 public static void Unproject(ref
Vector3 vector,
float x,
float y,
float width,
float height,
float minZ,
float maxZ, ref
Matrix worldViewProjection, out
Vector3 result)
881 Matrix.Invert(ref worldViewProjection, out matrix);
883 v.X = (((vector.X - x) / width) * 2.0f) - 1.0f;
884 v.Y = -((((vector.Y -
y) / height) * 2.0f) - 1.0f);
885 v.Z = (vector.Z - minZ) / (maxZ - minZ);
887 TransformCoordinate(ref v, ref matrix, out result);
905 Unproject(ref vector, x, y, width, height, minZ, maxZ, ref worldViewProjection, out result);
919 float dot = (vector.X * normal.X) + (vector.Y * normal.Y) + (vector.Z * normal.Z);
921 result.X = vector.X - ((2.0f * dot) * normal.X);
922 result.Y = vector.Y - ((2.0f * dot) * normal.Y);
923 result.Z = vector.Z - ((2.0f * dot) * normal.Z);
937 Reflect(ref vector, ref normal, out result);
967 throw new ArgumentNullException(
"source");
968 if (destination == null)
969 throw new ArgumentNullException(
"destination");
970 if (destination.
Length < source.Length)
971 throw new ArgumentOutOfRangeException(
"destination",
"The destination array must be of same length or larger length than the source array.");
973 for (
int i = 0; i < source.Length; ++i)
977 for (
int r = 0; r < i; ++r)
979 newvector -= (Vector3.Dot(destination[r], newvector) /
Vector3.
Dot(destination[r], destination[r])) * destination[r];
982 destination[i] = newvector;
1014 throw new ArgumentNullException(
"source");
1015 if (destination == null)
1016 throw new ArgumentNullException(
"destination");
1017 if (destination.
Length < source.Length)
1018 throw new ArgumentOutOfRangeException(
"destination",
"The destination array must be of same length or larger length than the source array.");
1020 for (
int i = 0; i < source.Length; ++i)
1022 Vector3 newvector = source[i];
1024 for (
int r = 0; r < i; ++r)
1026 newvector -= Vector3.Dot(destination[r], newvector) * destination[r];
1029 newvector.Normalize();
1030 destination[i] = newvector;
1042 float x = rotation.X + rotation.X;
1043 float y = rotation.Y + rotation.Y;
1044 float z = rotation.Z + rotation.Z;
1045 float wx = rotation.W * x;
1046 float wy = rotation.W *
y;
1047 float wz = rotation.W *
z;
1048 float xx = rotation.X * x;
1049 float xy = rotation.X *
y;
1050 float xz = rotation.X *
z;
1051 float yy = rotation.Y *
y;
1052 float yz = rotation.Y *
z;
1053 float zz = rotation.Z *
z;
1056 ((vector.X * ((1.0f - yy) - zz)) + (vector.Y * (xy - wz))) + (vector.Z * (xz + wy)),
1057 ((vector.X * (xy + wz)) + (vector.Y * ((1.0f - xx) - zz))) + (vector.Z * (yz - wx)),
1058 ((vector.X * (xz - wy)) + (vector.Y * (yz + wx))) + (vector.Z * ((1.0f - xx) - yy)));
1070 Transform(ref vector, ref rotation, out result);
1086 throw new ArgumentNullException(
"source");
1087 if (destination == null)
1088 throw new ArgumentNullException(
"destination");
1090 throw new ArgumentOutOfRangeException(
"destination",
"The destination array must be of same length or larger length than the source array.");
1092 float x = rotation.X + rotation.X;
1093 float y = rotation.Y + rotation.Y;
1094 float z = rotation.Z + rotation.Z;
1095 float wx = rotation.W * x;
1096 float wy = rotation.W *
y;
1097 float wz = rotation.W *
z;
1098 float xx = rotation.X * x;
1099 float xy = rotation.X *
y;
1100 float xz = rotation.X *
z;
1101 float yy = rotation.Y *
y;
1102 float yz = rotation.Y *
z;
1103 float zz = rotation.Z *
z;
1105 float num1 = ((1.0f - yy) - zz);
1106 float num2 = (xy - wz);
1107 float num3 = (xz + wy);
1108 float num4 = (xy + wz);
1109 float num5 = ((1.0f - xx) - zz);
1110 float num6 = (yz - wx);
1111 float num7 = (xz - wy);
1112 float num8 = (yz + wx);
1113 float num9 = ((1.0f - xx) - yy);
1115 for (
int i = 0; i < source.Length; ++i)
1118 ((source[i].X * num1) + (source[i].Y * num2)) + (source[i].Z * num3),
1119 ((source[i].X * num4) + (source[i].Y * num5)) + (source[i].Z * num6),
1120 ((source[i].X * num7) + (source[i].Y * num8)) + (source[i].Z * num9));
1133 (vector.X * transform.M11) + (vector.Y * transform.M21) + (vector.Z * transform.M31) + transform.M41,
1134 (vector.X * transform.M12) + (vector.Y * transform.M22) + (vector.Z * transform.M32) + transform.M42,
1135 (vector.X * transform.M13) + (vector.Y * transform.M23) + (vector.Z * transform.M33) + transform.M43,
1136 (vector.X * transform.M14) + (vector.Y * transform.M24) + (vector.Z * transform.M34) + transform.M44);
1148 Transform(ref vector, ref transform, out result);
1163 throw new ArgumentNullException(
"source");
1164 if (destination == null)
1165 throw new ArgumentNullException(
"destination");
1167 throw new ArgumentOutOfRangeException(
"destination",
"The destination array must be of same length or larger length than the source array.");
1169 for (
int i = 0; i < source.Length; ++i)
1171 Transform(ref source[i], ref transform, out destination[i]);
1191 vector.X = (coordinate.X * transform.M11) + (coordinate.Y * transform.M21) + (coordinate.Z * transform.M31) + transform.M41;
1192 vector.
Y = (coordinate.X * transform.M12) + (coordinate.Y * transform.M22) + (coordinate.Z * transform.M32) + transform.M42;
1193 vector.Z = (coordinate.X * transform.M13) + (coordinate.Y * transform.M23) + (coordinate.Z * transform.M33) + transform.M43;
1194 vector.
W = 1f / ((coordinate.X * transform.M14) + (coordinate.Y * transform.M24) + (coordinate.Z * transform.M34) + transform.M44);
1196 result =
new Vector3(vector.
X * vector.
W, vector.
Y * vector.
W, vector.
Z * vector.
W);
1215 TransformCoordinate(ref coordinate, ref transform, out result);
1238 throw new ArgumentNullException(
"source");
1239 if (destination == null)
1240 throw new ArgumentNullException(
"destination");
1242 throw new ArgumentOutOfRangeException(
"destination",
"The destination array must be of same length or larger length than the source array.");
1244 for (
int i = 0; i < source.Length; ++i)
1246 TransformCoordinate(ref source[i], ref transform, out destination[i]);
1266 (normal.X * transform.M11) + (normal.Y * transform.M21) + (normal.Z * transform.M31),
1267 (normal.X * transform.M12) + (normal.Y * transform.M22) + (normal.Z * transform.M32),
1268 (normal.X * transform.M13) + (normal.Y * transform.M23) + (normal.Z * transform.M33));
1287 TransformNormal(ref normal, ref transform, out result);
1310 throw new ArgumentNullException(
"source");
1311 if (destination == null)
1312 throw new ArgumentNullException(
"destination");
1314 throw new ArgumentOutOfRangeException(
"destination",
"The destination array must be of same length or larger length than the source array.");
1316 for (
int i = 0; i < source.Length; ++i)
1318 TransformNormal(ref source[i], ref transform, out destination[i]);
1330 return new Vector3(left.
X + right.
X, left.
Y + right.
Y, left.
Z + right.
Z);
1351 return new Vector3(left.
X - right.
X, left.
Y - right.
Y, left.
Z - right.
Z);
1362 return new Vector3(left.
X * right.
X, left.
Y * right.
Y, left.
Z * right.
Z);
1372 return new Vector3(-value.
X, -value.
Y, -value.
Z);
1383 return new Vector3(value.
X * scale, value.
Y * scale, value.
Z * scale);
1394 return new Vector3(value.
X * scale, value.
Y * scale, value.
Z * scale);
1405 return new Vector3(value.
X / scale, value.
Y / scale, value.
Z / scale);
1416 return left.Equals(right);
1427 return !left.Equals(right);
1447 return new Vector4(value, 0.0f);
1459 return NearEqual(ref left, ref right, ref epsilon);
1471 return MathUtil.WithinEpsilon(left.X, right.X, epsilon.X) &&
1473 MathUtil.WithinEpsilon(left.Z, right.Z, epsilon.Z);
1484 return string.Format(CultureInfo.CurrentCulture,
"X:{0} Y:{1} Z:{2}", X, Y, Z);
1499 return string.Format(CultureInfo.CurrentCulture,
"X:{0} Y:{1} Z:{2}", X.ToString(
format, CultureInfo.CurrentCulture),
1500 Y.ToString(format, CultureInfo.CurrentCulture), Z.ToString(
format, CultureInfo.CurrentCulture));
1512 return string.Format(formatProvider,
"X:{0} Y:{1} Z:{2}", X, Y, Z);
1526 return ToString(formatProvider);
1528 return string.Format(formatProvider,
"X:{0} Y:{1} Z:{2}", X.ToString(
format, formatProvider),
1529 Y.ToString(format, formatProvider), Z.ToString(
format, formatProvider));
1540 return X.GetHashCode() + Y.GetHashCode() + Z.GetHashCode();
1552 return ((
float)Math.Abs(other.
X - X) < MathUtil.ZeroTolerance &&
1553 (float)Math.Abs(other.
Y - Y) < MathUtil.ZeroTolerance &&
1554 (float)Math.Abs(other.
Z - Z) < MathUtil.ZeroTolerance);
1569 if (value.GetType() != GetType())
1572 return Equals((
Vector3)value);
1580 public static implicit
operator System.Windows.Media.Media3D.Vector3D(
Vector3 value)
1582 return new System.Windows.Media.Media3D.Vector3D(value.X, value.Y, value.Z);
1590 public static explicit operator Vector3(System.Windows.Media.Media3D.Vector3D value)
1592 return new Vector3((
float)value.X, (
float)value.Y, (
float)value.Z);
1602 public static implicit
operator Microsoft.Xna.Framework.Vector3(
Vector3 value)
1604 return new Microsoft.Xna.Framework.Vector3(value.X, value.Y, value.Z);
1612 public static implicit
operator Vector3(Microsoft.Xna.Framework.Vector3 value)
1614 return new Vector3(value.X, value.Y, value.Z);
static void Lerp(ref Vector3 start, ref Vector3 end, float amount, out Vector3 result)
Performs a linear interpolation between two vectors.
static Vector3 Clamp(Vector3 value, Vector3 min, Vector3 max)
Restricts a value to be within a specified range.
static void Cross(ref Vector3 left, ref Vector3 right, out Vector3 result)
Calculates the cross product of two vectors.
static Vector3 CatmullRom(Vector3 value1, Vector3 value2, Vector3 value3, Vector3 value4, float amount)
Performs a Catmull-Rom interpolation using the specified positions.
static void Max(ref Vector3 left, ref Vector3 right, out Vector3 result)
Returns a vector containing the smallest components of the specified vectors.
SiliconStudio.Paradox.Games.Mathematics.Vector2 Vector2
FbxDouble3 operator*(double factor, FbxDouble3 vector)
float Y
The Y component of the vector.
float W
The W component of the vector.
Represents a two dimensional mathematical vector.
static void Dot(ref Vector3 left, ref Vector3 right, out float result)
Calculates the dot product of two vectors.
static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result)
Performs a Hermite spline interpolation.
static Vector3 Unproject(Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, Matrix worldViewProjection)
Projects a 3D vector from screen space into object space.
static Vector3 Modulate(Vector3 left, Vector3 right)
Modulates a vector with another by performing component-wise multiplication.
static Vector3 TransformNormal(Vector3 normal, Matrix transform)
Performs a normal transformation using the given SiliconStudio.Core.Mathematics.Matrix.
static float Dot(Vector3 left, Vector3 right)
Calculates the dot product of two vectors.
float X
The X component of the vector.
static Vector3 Divide(Vector3 value, float scale)
Scales a vector by the given value.
static void Orthogonalize(Vector3[] destination, params Vector3[] source)
Orthogonalizes a list of vectors.
float[] ToArray()
Creates an array containing the elements of the vector.
static Vector3 Negate(Vector3 value)
Reverses the direction of a given vector.
_In_ size_t _In_ DXGI_FORMAT _In_ size_t _In_ float size_t y
static float Distance(Vector3 value1, Vector3 value2)
Calculates the distance between two vectors.
string ToString(IFormatProvider formatProvider)
Returns a System.String that represents this instance.
string ToString(string format)
Returns a System.String that represents this instance.
float X
The X component of the vector.
static void Subtract(ref Vector3 left, ref Vector3 right, out Vector3 result)
Subtracts two vectors.
static void Clamp(ref Vector3 value, ref Vector3 min, ref Vector3 max, out Vector3 result)
Restricts a value to be within a specified range.
const float ZeroTolerance
The value for which all absolute numbers smaller than are considered equal to zero.
Represents a three dimensional mathematical vector.
float Length()
Calculates the length of the vector.
static void Orthonormalize(Vector3[] destination, params Vector3[] source)
Orthonormalizes a list of vectors.
static Vector3 Subtract(Vector3 left, Vector3 right)
Subtracts two vectors.
static void Transform(Vector3[] source, ref Quaternion rotation, Vector3[] destination)
Transforms an array of vectors by the given SiliconStudio.Core.Mathematics.Quaternion rotation...
static void Demodulate(ref Vector3 left, ref Vector3 right, out Vector3 result)
Demodulates a vector with another by performing component-wise division.
static void Min(ref Vector3 left, ref Vector3 right, out Vector3 result)
Returns a vector containing the smallest components of the specified vectors.
bool Equals(Vector3 other)
Determines whether the specified SiliconStudio.Core.Mathematics.Vector3 is equal to this instance...
static void Transform(ref Vector3 vector, ref Matrix transform, out Vector4 result)
Transforms a 3D vector by the given SiliconStudio.Core.Mathematics.Matrix.
static Vector3 Hermite(Vector3 value1, Vector3 tangent1, Vector3 value2, Vector3 tangent2, float amount)
Performs a Hermite spline interpolation.
static void Unproject(ref Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, ref Matrix worldViewProjection, out Vector3 result)
Projects a 3D vector from screen space into object space.
static void Divide(ref Vector3 value, float scale, out Vector3 result)
Scales a vector by the given value.
void Pow(float exponent)
Raises the exponent for each components.
static bool WithinEpsilon(float a, float b, float epsilon)
Checks if a - b are almost equals within a float epsilon.
static void TransformNormal(ref Vector3 normal, ref Matrix transform, out Vector3 result)
Performs a normal transformation using the given SiliconStudio.Core.Mathematics.Matrix.
static float DistanceSquared(Vector3 value1, Vector3 value2)
Calculates the squared distance between two vectors.
static Vector3 Project(Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, Matrix worldViewProjection)
Projects a 3D vector from object space into screen space.
Vector3(Vector2 value, float z)
Initializes a new instance of the SiliconStudio.Core.Mathematics.Vector3 struct.
override string ToString()
Returns a System.String that represents this instance.
static Vector3 SmoothStep(Vector3 start, Vector3 end, float amount)
Performs a cubic interpolation between two vectors.
static Vector3 Lerp(Vector3 start, Vector3 end, float amount)
Performs a linear interpolation between two vectors.
static void Negate(ref Vector3 value, out Vector3 result)
Reverses the direction of a given vector.
Represents a four dimensional mathematical vector.
static Vector4 Transform(Vector3 vector, Matrix transform)
Transforms a 3D vector by the given SiliconStudio.Core.Mathematics.Matrix.
static void Add(ref Vector3 left, ref Vector3 right, out Vector3 result)
Adds two vectors.
override int GetHashCode()
Returns a hash code for this instance.
Represents a four dimensional mathematical quaternion.
static Vector3 TransformCoordinate(Vector3 coordinate, Matrix transform)
Performs a coordinate transformation using the given SiliconStudio.Core.Mathematics.Matrix.
static void Distance(ref Vector3 value1, ref Vector3 value2, out float result)
Calculates the distance between two vectors.
Vector3(float x, float y, float z)
Initializes a new instance of the SiliconStudio.Core.Mathematics.Vector3 struct.
static Vector3 Min(Vector3 left, Vector3 right)
Returns a vector containing the smallest components of the specified vectors.
static void Transform(ref Vector3 vector, ref Quaternion rotation, out Vector3 result)
Transforms a 3D vector by the given SiliconStudio.Core.Mathematics.Quaternion rotation.
static bool NearEqual(Vector3 left, Vector3 right, Vector3 epsilon)
Tests whether one 3D vector is near another 3D vector.
float Length()
Calculates the length of the vector.
static void CatmullRom(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, ref Vector3 value4, float amount, out Vector3 result)
Performs a Catmull-Rom interpolation using the specified positions.
float LengthSquared()
Calculates the squared length of the vector.
static void Transform(Vector3[] source, ref Matrix transform, Vector4[] destination)
Transforms an array of 3D vectors by the given SiliconStudio.Core.Mathematics.Matrix.
static void Multiply(ref Vector3 value, float scale, out Vector3 result)
Scales a vector by the given value.
static void Reflect(ref Vector3 vector, ref Vector3 normal, out Vector3 result)
Returns the reflection of a vector off a surface that has the specified normal.
static Vector3 Barycentric(Vector3 value1, Vector3 value2, Vector3 value3, float amount1, float amount2)
Returns a SiliconStudio.Core.Mathematics.Vector3 containing the 3D Cartesian coordinates of a point s...
float Y
The Y component of the vector.
Vector3(float value)
Initializes a new instance of the SiliconStudio.Core.Mathematics.Vector3 struct.
static Vector3 Normalize(Vector3 value)
Converts the vector into a unit vector.
static void DistanceSquared(ref Vector3 value1, ref Vector3 value2, out float result)
Calculates the squared distance between two vectors.
Vector3(float[] values)
Initializes a new instance of the SiliconStudio.Core.Mathematics.Vector3 struct.
static void Modulate(ref Vector3 left, ref Vector3 right, out Vector3 result)
Modulates a vector with another by performing component-wise multiplication.
string ToString(string format, IFormatProvider formatProvider)
Returns a System.String that represents this instance.
static Vector3 Reflect(Vector3 vector, Vector3 normal)
Returns the reflection of a vector off a surface that has the specified normal.
SiliconStudio.Core.Mathematics.Vector3 Vector3
static Vector3 Transform(Vector3 vector, Quaternion rotation)
Transforms a 3D vector by the given SiliconStudio.Core.Mathematics.Quaternion rotation.
_In_ size_t _In_ size_t _In_ DXGI_FORMAT format
float Z
The Z component of the vector.
override bool Equals(object value)
Determines whether the specified System.Object is equal to this instance.
static void Project(ref Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, ref Matrix worldViewProjection, out Vector3 result)
Projects a 3D vector from object space into screen space.
static Vector3 Add(Vector3 left, Vector3 right)
Adds two vectors.
void Normalize()
Converts the vector into a unit vector.
float Z
The Z component of the vector.
static void Barycentric(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, float amount1, float amount2, out Vector3 result)
Returns a SiliconStudio.Core.Mathematics.Vector3 containing the 3D Cartesian coordinates of a point s...
static void TransformCoordinate(ref Vector3 coordinate, ref Matrix transform, out Vector3 result)
Performs a coordinate transformation using the given SiliconStudio.Core.Mathematics.Matrix.
static bool NearEqual(ref Vector3 left, ref Vector3 right, ref Vector3 epsilon)
Tests whether one 3D vector is near another 3D vector.
static Vector3 Cross(Vector3 left, Vector3 right)
Calculates the cross product of two vectors.
static void Normalize(ref Vector3 value, out Vector3 result)
Converts the vector into a unit vector.
static void SmoothStep(ref Vector3 start, ref Vector3 end, float amount, out Vector3 result)
Performs a cubic interpolation between two vectors.
static Vector3 Multiply(Vector3 value, float scale)
Scales a vector by the given value.
static void TransformNormal(Vector3[] source, ref Matrix transform, Vector3[] destination)
Performs a normal transformation on an array of vectors using the given SiliconStudio.Core.Mathematics.Matrix.
DataStyle
Specifies the style used for textual serialization when an array/list or a dictionary/map must be ser...
static void TransformCoordinate(Vector3[] source, ref Matrix transform, Vector3[] destination)
Performs a coordinate transformation on an array of vectors using the given SiliconStudio.Core.Mathematics.Matrix.
_In_ size_t _In_ DXGI_FORMAT _In_ size_t _In_ float size_t size_t z
static Vector3 Max(Vector3 left, Vector3 right)
Returns a vector containing the largest components of the specified vectors.
static Vector3 Demodulate(Vector3 left, Vector3 right)
Demodulates a vector with another by performing component-wise division.
Represents a 4x4 mathematical matrix.