Slim up names

This commit is contained in:
Marc Hernandez 2019-06-26 10:07:25 -07:00
parent 1065aeec0b
commit 1bd126d578
26 changed files with 845 additions and 845 deletions

View File

@ -43,24 +43,24 @@ namespace math
/// <summary> /// <summary>
/// A <see cref="BoundingBox"/> which represents an empty space. /// A <see cref="BoundingBox"/> which represents an empty space.
/// </summary> /// </summary>
public static readonly BoundingBox Empty = new BoundingBox(new Vector3(float.MaxValue), new Vector3(float.MinValue)); public static readonly BoundingBox Empty = new BoundingBox(new Vec3(float.MaxValue), new Vec3(float.MinValue));
/// <summary> /// <summary>
/// The minimum point of the box. /// The minimum point of the box.
/// </summary> /// </summary>
public Vector3 Minimum; public Vec3 Minimum;
/// <summary> /// <summary>
/// The maximum point of the box. /// The maximum point of the box.
/// </summary> /// </summary>
public Vector3 Maximum; public Vec3 Maximum;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="math.BoundingBox"/> struct. /// Initializes a new instance of the <see cref="math.BoundingBox"/> struct.
/// </summary> /// </summary>
/// <param name="minimum">The minimum vertex of the bounding box.</param> /// <param name="minimum">The minimum vertex of the bounding box.</param>
/// <param name="maximum">The maximum vertex of the bounding box.</param> /// <param name="maximum">The maximum vertex of the bounding box.</param>
public BoundingBox(Vector3 minimum, Vector3 maximum) public BoundingBox(Vec3 minimum, Vec3 maximum)
{ {
this.Minimum = minimum; this.Minimum = minimum;
this.Maximum = maximum; this.Maximum = maximum;
@ -69,7 +69,7 @@ namespace math
/// <summary> /// <summary>
/// Gets the center of this bouding box. /// Gets the center of this bouding box.
/// </summary> /// </summary>
public Vector3 Center public Vec3 Center
{ {
get { return (Minimum + Maximum) / 2; } get { return (Minimum + Maximum) / 2; }
} }
@ -77,7 +77,7 @@ namespace math
/// <summary> /// <summary>
/// Gets the extent of this bouding box. /// Gets the extent of this bouding box.
/// </summary> /// </summary>
public Vector3 Extent public Vec3 Extent
{ {
get { return (Maximum - Minimum) / 2; } get { return (Maximum - Minimum) / 2; }
} }
@ -86,17 +86,17 @@ namespace math
/// Retrieves the eight corners of the bounding box. /// Retrieves the eight corners of the bounding box.
/// </summary> /// </summary>
/// <returns>An array of points representing the eight corners of the bounding box.</returns> /// <returns>An array of points representing the eight corners of the bounding box.</returns>
public Vector3[] GetCorners() public Vec3[] GetCorners()
{ {
Vector3[] results = new Vector3[8]; Vec3[] results = new Vec3[8];
results[0] = new Vector3(Minimum.X, Maximum.Y, Maximum.Z); results[0] = new Vec3(Minimum.X, Maximum.Y, Maximum.Z);
results[1] = new Vector3(Maximum.X, Maximum.Y, Maximum.Z); results[1] = new Vec3(Maximum.X, Maximum.Y, Maximum.Z);
results[2] = new Vector3(Maximum.X, Minimum.Y, Maximum.Z); results[2] = new Vec3(Maximum.X, Minimum.Y, Maximum.Z);
results[3] = new Vector3(Minimum.X, Minimum.Y, Maximum.Z); results[3] = new Vec3(Minimum.X, Minimum.Y, Maximum.Z);
results[4] = new Vector3(Minimum.X, Maximum.Y, Minimum.Z); results[4] = new Vec3(Minimum.X, Maximum.Y, Minimum.Z);
results[5] = new Vector3(Maximum.X, Maximum.Y, Minimum.Z); results[5] = new Vec3(Maximum.X, Maximum.Y, Minimum.Z);
results[6] = new Vector3(Maximum.X, Minimum.Y, Minimum.Z); results[6] = new Vec3(Maximum.X, Minimum.Y, Minimum.Z);
results[7] = new Vector3(Minimum.X, Minimum.Y, Minimum.Z); results[7] = new Vec3(Minimum.X, Minimum.Y, Minimum.Z);
return results; return results;
} }
@ -128,9 +128,9 @@ namespace math
/// </summary> /// </summary>
/// <param name="ray">The ray to test.</param> /// <param name="ray">The ray to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Ray ray, out Vector3 point) public bool Intersects(ref Ray ray, out Vec3 point)
{ {
return CollisionHelper.RayIntersectsBox(ref ray, ref this, out point); return CollisionHelper.RayIntersectsBox(ref ray, ref this, out point);
} }
@ -184,7 +184,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>The type of containment the two objects have.</returns> /// <returns>The type of containment the two objects have.</returns>
public ContainmentType Contains(ref Vector3 point) public ContainmentType Contains(ref Vec3 point)
{ {
return CollisionHelper.BoxContainsPoint(ref this, ref point); return CollisionHelper.BoxContainsPoint(ref this, ref point);
} }
@ -229,18 +229,18 @@ namespace math
/// <param name="points">The points that will be contained by the box.</param> /// <param name="points">The points that will be contained by the box.</param>
/// <param name="result">When the method completes, contains the newly constructed bounding box.</param> /// <param name="result">When the method completes, contains the newly constructed bounding box.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="points"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown when <paramref name="points"/> is <c>null</c>.</exception>
public static void FromPoints(Vector3[] points, out BoundingBox result) public static void FromPoints(Vec3[] points, out BoundingBox result)
{ {
if (points == null) if (points == null)
throw new ArgumentNullException("points"); throw new ArgumentNullException("points");
Vector3 min = new Vector3(float.MaxValue); Vec3 min = new Vec3(float.MaxValue);
Vector3 max = new Vector3(float.MinValue); Vec3 max = new Vec3(float.MinValue);
for (int i = 0; i < points.Length; ++i) for (int i = 0; i < points.Length; ++i)
{ {
Vector3.Min(ref min, ref points[i], out min); Vec3.Min(ref min, ref points[i], out min);
Vector3.Max(ref max, ref points[i], out max); Vec3.Max(ref max, ref points[i], out max);
} }
result = new BoundingBox(min, max); result = new BoundingBox(min, max);
@ -252,18 +252,18 @@ namespace math
/// <param name="points">The points that will be contained by the box.</param> /// <param name="points">The points that will be contained by the box.</param>
/// <returns>The newly constructed bounding box.</returns> /// <returns>The newly constructed bounding box.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="points"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown when <paramref name="points"/> is <c>null</c>.</exception>
public static BoundingBox FromPoints(Vector3[] points) public static BoundingBox FromPoints(Vec3[] points)
{ {
if (points == null) if (points == null)
throw new ArgumentNullException("points"); throw new ArgumentNullException("points");
Vector3 min = new Vector3(float.MaxValue); Vec3 min = new Vec3(float.MaxValue);
Vector3 max = new Vector3(float.MinValue); Vec3 max = new Vec3(float.MinValue);
for (int i = 0; i < points.Length; ++i) for (int i = 0; i < points.Length; ++i)
{ {
Vector3.Min(ref min, ref points[i], out min); Vec3.Min(ref min, ref points[i], out min);
Vector3.Max(ref max, ref points[i], out max); Vec3.Max(ref max, ref points[i], out max);
} }
return new BoundingBox(min, max); return new BoundingBox(min, max);
@ -276,8 +276,8 @@ namespace math
/// <param name="result">When the method completes, contains the newly constructed bounding box.</param> /// <param name="result">When the method completes, contains the newly constructed bounding box.</param>
public static void FromSphere(ref BoundingSphere sphere, out BoundingBox result) public static void FromSphere(ref BoundingSphere sphere, out BoundingBox result)
{ {
result.Minimum = new Vector3(sphere.Center.X - sphere.Radius, sphere.Center.Y - sphere.Radius, sphere.Center.Z - sphere.Radius); result.Minimum = new Vec3(sphere.Center.X - sphere.Radius, sphere.Center.Y - sphere.Radius, sphere.Center.Z - sphere.Radius);
result.Maximum = new Vector3(sphere.Center.X + sphere.Radius, sphere.Center.Y + sphere.Radius, sphere.Center.Z + sphere.Radius); result.Maximum = new Vec3(sphere.Center.X + sphere.Radius, sphere.Center.Y + sphere.Radius, sphere.Center.Z + sphere.Radius);
} }
/// <summary> /// <summary>
@ -288,8 +288,8 @@ namespace math
public static BoundingBox FromSphere(BoundingSphere sphere) public static BoundingBox FromSphere(BoundingSphere sphere)
{ {
BoundingBox box; BoundingBox box;
box.Minimum = new Vector3(sphere.Center.X - sphere.Radius, sphere.Center.Y - sphere.Radius, sphere.Center.Z - sphere.Radius); box.Minimum = new Vec3(sphere.Center.X - sphere.Radius, sphere.Center.Y - sphere.Radius, sphere.Center.Z - sphere.Radius);
box.Maximum = new Vector3(sphere.Center.X + sphere.Radius, sphere.Center.Y + sphere.Radius, sphere.Center.Z + sphere.Radius); box.Maximum = new Vec3(sphere.Center.X + sphere.Radius, sphere.Center.Y + sphere.Radius, sphere.Center.Z + sphere.Radius);
return box; return box;
} }
@ -312,10 +312,10 @@ namespace math
/// <param name="value1">The box to merge.</param> /// <param name="value1">The box to merge.</param>
/// <param name="value2">The point to merge.</param> /// <param name="value2">The point to merge.</param>
/// <param name="result">When the method completes, contains the newly constructed bounding box.</param> /// <param name="result">When the method completes, contains the newly constructed bounding box.</param>
public static void Merge(ref BoundingBox value1, ref Vector3 value2, out BoundingBox result) public static void Merge(ref BoundingBox value1, ref Vec3 value2, out BoundingBox result)
{ {
Vector3.Min(ref value1.Minimum, ref value2, out result.Minimum); Vec3.Min(ref value1.Minimum, ref value2, out result.Minimum);
Vector3.Max(ref value1.Maximum, ref value2, out result.Maximum); Vec3.Max(ref value1.Maximum, ref value2, out result.Maximum);
} }
/// <summary> /// <summary>
@ -326,8 +326,8 @@ namespace math
/// <param name="result">When the method completes, contains the newly constructed bounding box.</param> /// <param name="result">When the method completes, contains the newly constructed bounding box.</param>
public static void Merge(ref BoundingBox value1, ref BoundingBox value2, out BoundingBox result) public static void Merge(ref BoundingBox value1, ref BoundingBox value2, out BoundingBox result)
{ {
Vector3.Min(ref value1.Minimum, ref value2.Minimum, out result.Minimum); Vec3.Min(ref value1.Minimum, ref value2.Minimum, out result.Minimum);
Vector3.Max(ref value1.Maximum, ref value2.Maximum, out result.Maximum); Vec3.Max(ref value1.Maximum, ref value2.Maximum, out result.Maximum);
} }
/// <summary> /// <summary>
@ -339,8 +339,8 @@ namespace math
public static BoundingBox Merge(BoundingBox value1, BoundingBox value2) public static BoundingBox Merge(BoundingBox value1, BoundingBox value2)
{ {
BoundingBox box; BoundingBox box;
Vector3.Min(ref value1.Minimum, ref value2.Minimum, out box.Minimum); Vec3.Min(ref value1.Minimum, ref value2.Minimum, out box.Minimum);
Vector3.Max(ref value1.Maximum, ref value2.Maximum, out box.Maximum); Vec3.Max(ref value1.Maximum, ref value2.Maximum, out box.Maximum);
return box; return box;
} }
@ -434,11 +434,11 @@ namespace math
} }
/// <summary> /// <summary>
/// Determines whether the specified <see cref="math.Vector4"/> is equal to this instance. /// Determines whether the specified <see cref="math.Vec4"/> is equal to this instance.
/// </summary> /// </summary>
/// <param name="value">The <see cref="math.Vector4"/> to compare with this instance.</param> /// <param name="value">The <see cref="math.Vec4"/> to compare with this instance.</param>
/// <returns> /// <returns>
/// <c>true</c> if the specified <see cref="math.Vector4"/> is equal to this instance; otherwise, <c>false</c>. /// <c>true</c> if the specified <see cref="math.Vec4"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns> /// </returns>
public bool Equals(BoundingBox value) public bool Equals(BoundingBox value)
{ {

View File

@ -22,12 +22,12 @@ namespace math
/// <summary> /// <summary>
/// The center of this bounding box. /// The center of this bounding box.
/// </summary> /// </summary>
public Vector3 Center; public Vec3 Center;
/// <summary> /// <summary>
/// The extent of this bounding box. /// The extent of this bounding box.
/// </summary> /// </summary>
public Vector3 Extent; public Vec3 Extent;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="math.BoundingBoxExt" /> struct. /// Initializes a new instance of the <see cref="math.BoundingBoxExt" /> struct.
@ -44,7 +44,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="minimum">The minimum vertex of the bounding box.</param> /// <param name="minimum">The minimum vertex of the bounding box.</param>
/// <param name="maximum">The maximum vertex of the bounding box.</param> /// <param name="maximum">The maximum vertex of the bounding box.</param>
public BoundingBoxExt(Vector3 minimum, Vector3 maximum) public BoundingBoxExt(Vec3 minimum, Vec3 maximum)
{ {
this.Center = (minimum + maximum) / 2; this.Center = (minimum + maximum) / 2;
this.Extent = (maximum - minimum) / 2; this.Extent = (maximum - minimum) / 2;
@ -54,7 +54,7 @@ namespace math
/// Gets the minimum. /// Gets the minimum.
/// </summary> /// </summary>
/// <value>The minimum.</value> /// <value>The minimum.</value>
public Vector3 Minimum public Vec3 Minimum
{ {
get get
{ {
@ -66,7 +66,7 @@ namespace math
/// Gets the maximum. /// Gets the maximum.
/// </summary> /// </summary>
/// <value>The maximum.</value> /// <value>The maximum.</value>
public Vector3 Maximum public Vec3 Maximum
{ {
get get
{ {
@ -85,7 +85,7 @@ namespace math
var center = Center; var center = Center;
var extent = Extent; var extent = Extent;
Vector3.TransformCoordinate(ref center, ref world, out Center); Vec3.TransformCoordinate(ref center, ref world, out Center);
// Update world matrix into absolute form // Update world matrix into absolute form
unsafe unsafe
@ -100,7 +100,7 @@ namespace math
} }
} }
Vector3.TransformNormal(ref extent, ref world, out Extent); Vec3.TransformNormal(ref extent, ref world, out Extent);
} }
/// <summary> /// <summary>
@ -112,8 +112,8 @@ namespace math
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Merge(ref BoundingBoxExt value1, ref BoundingBoxExt value2, out BoundingBoxExt result) public static void Merge(ref BoundingBoxExt value1, ref BoundingBoxExt value2, out BoundingBoxExt result)
{ {
var maximum = Vector3.Max(value1.Maximum, value2.Maximum); var maximum = Vec3.Max(value1.Maximum, value2.Maximum);
var minimum = Vector3.Min(value1.Minimum, value2.Minimum); var minimum = Vec3.Min(value1.Minimum, value2.Minimum);
result.Center = (minimum + maximum) / 2; result.Center = (minimum + maximum) / 2;
result.Extent = (maximum - minimum) / 2; result.Extent = (maximum - minimum) / 2;

View File

@ -48,7 +48,7 @@ namespace math
/// <summary> /// <summary>
/// The center of the sphere in three dimensional space. /// The center of the sphere in three dimensional space.
/// </summary> /// </summary>
public Vector3 Center; public Vec3 Center;
/// <summary> /// <summary>
/// The radious of the sphere. /// The radious of the sphere.
@ -60,7 +60,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="center">The center of the sphere in three dimensional space.</param> /// <param name="center">The center of the sphere in three dimensional space.</param>
/// <param name="radius">The radius of the sphere.</param> /// <param name="radius">The radius of the sphere.</param>
public BoundingSphere(Vector3 center, float radius) public BoundingSphere(Vec3 center, float radius)
{ {
this.Center = center; this.Center = center;
this.Radius = radius; this.Radius = radius;
@ -94,9 +94,9 @@ namespace math
/// </summary> /// </summary>
/// <param name="ray">The ray to test.</param> /// <param name="ray">The ray to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Ray ray, out Vector3 point) public bool Intersects(ref Ray ray, out Vec3 point)
{ {
return CollisionHelper.RayIntersectsSphere(ref ray, ref this, out point); return CollisionHelper.RayIntersectsSphere(ref ray, ref this, out point);
} }
@ -118,7 +118,7 @@ namespace math
/// <param name="vertex2">The second vertex of the triagnle to test.</param> /// <param name="vertex2">The second vertex of the triagnle to test.</param>
/// <param name="vertex3">The third vertex of the triangle to test.</param> /// <param name="vertex3">The third vertex of the triangle to test.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3) public bool Intersects(ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3)
{ {
return CollisionHelper.SphereIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3); return CollisionHelper.SphereIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3);
} }
@ -148,7 +148,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>The type of containment the two objects have.</returns> /// <returns>The type of containment the two objects have.</returns>
public ContainmentType Contains(ref Vector3 point) public ContainmentType Contains(ref Vec3 point)
{ {
return CollisionHelper.SphereContainsPoint(ref this, ref point); return CollisionHelper.SphereContainsPoint(ref this, ref point);
} }
@ -160,7 +160,7 @@ namespace math
/// <param name="vertex2">The second vertex of the triagnle to test.</param> /// <param name="vertex2">The second vertex of the triagnle to test.</param>
/// <param name="vertex3">The third vertex of the triangle to test.</param> /// <param name="vertex3">The third vertex of the triangle to test.</param>
/// <returns>The type of containment the two objects have.</returns> /// <returns>The type of containment the two objects have.</returns>
public ContainmentType Contains(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3) public ContainmentType Contains(ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3)
{ {
return CollisionHelper.SphereContainsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3); return CollisionHelper.SphereContainsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3);
} }
@ -190,12 +190,12 @@ namespace math
/// </summary> /// </summary>
/// <param name="points">The points that will be contained by the sphere.</param> /// <param name="points">The points that will be contained by the sphere.</param>
/// <param name="result">When the method completes, contains the newly constructed bounding sphere.</param> /// <param name="result">When the method completes, contains the newly constructed bounding sphere.</param>
public static unsafe void FromPoints(Vector3[] points, out BoundingSphere result) public static unsafe void FromPoints(Vec3[] points, out BoundingSphere result)
{ {
if (points == null) throw new ArgumentNullException("points"); if (points == null) throw new ArgumentNullException("points");
fixed (void* pointsPtr = points) fixed (void* pointsPtr = points)
{ {
FromPoints((IntPtr)pointsPtr, 0, points.Length, lib.Util.SizeOf<Vector3>(), out result); FromPoints((IntPtr)pointsPtr, 0, points.Length, lib.Util.SizeOf<Vec3>(), out result);
} }
} }
@ -217,11 +217,11 @@ namespace math
var startPoint = (byte*)vertexBufferPtr + vertexPositionOffsetInBytes; var startPoint = (byte*)vertexBufferPtr + vertexPositionOffsetInBytes;
//Find the center of all points. //Find the center of all points.
Vector3 center = Vector3.Zero; Vec3 center = Vec3.Zero;
var nextPoint = startPoint; var nextPoint = startPoint;
for (int i = 0; i < vertexCount; ++i) for (int i = 0; i < vertexCount; ++i)
{ {
Vector3.Add(ref *(Vector3*)nextPoint, ref center, out center); Vec3.Add(ref *(Vec3*)nextPoint, ref center, out center);
nextPoint += vertexStride; nextPoint += vertexStride;
} }
@ -236,7 +236,7 @@ namespace math
//We are doing a relative distance comparasin to find the maximum distance //We are doing a relative distance comparasin to find the maximum distance
//from the center of our sphere. //from the center of our sphere.
float distance; float distance;
Vector3.DistanceSquared(ref center, ref *(Vector3*)nextPoint, out distance); Vec3.DistanceSquared(ref center, ref *(Vec3*)nextPoint, out distance);
if (distance > radius) if (distance > radius)
radius = distance; radius = distance;
@ -256,7 +256,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="points">The points that will be contained by the sphere.</param> /// <param name="points">The points that will be contained by the sphere.</param>
/// <returns>The newly constructed bounding sphere.</returns> /// <returns>The newly constructed bounding sphere.</returns>
public static BoundingSphere FromPoints(Vector3[] points) public static BoundingSphere FromPoints(Vec3[] points)
{ {
BoundingSphere result; BoundingSphere result;
FromPoints(points, out result); FromPoints(points, out result);
@ -270,7 +270,7 @@ namespace math
/// <param name="result">When the method completes, the newly constructed bounding sphere.</param> /// <param name="result">When the method completes, the newly constructed bounding sphere.</param>
public static void FromBox(ref BoundingBox box, out BoundingSphere result) public static void FromBox(ref BoundingBox box, out BoundingSphere result)
{ {
Vector3.Lerp(ref box.Minimum, ref box.Maximum, 0.5f, out result.Center); Vec3.Lerp(ref box.Minimum, ref box.Maximum, 0.5f, out result.Center);
float x = box.Minimum.X - box.Maximum.X; float x = box.Minimum.X - box.Maximum.X;
float y = box.Minimum.Y - box.Maximum.Y; float y = box.Minimum.Y - box.Maximum.Y;
@ -300,7 +300,7 @@ namespace math
/// <param name="result">The transformed bounding sphere.</param> /// <param name="result">The transformed bounding sphere.</param>
public static void Transform(ref BoundingSphere value, ref Matrix transform, out BoundingSphere result) public static void Transform(ref BoundingSphere value, ref Matrix transform, out BoundingSphere result)
{ {
Vector3.TransformCoordinate(ref value.Center, ref transform, out result.Center); Vec3.TransformCoordinate(ref value.Center, ref transform, out result.Center);
var majorAxisLengthSquared = Math.Max( var majorAxisLengthSquared = Math.Max(
(transform.M11 * transform.M11) + (transform.M12 * transform.M12) + (transform.M13 * transform.M13), Math.Max( (transform.M11 * transform.M11) + (transform.M12 * transform.M12) + (transform.M13 * transform.M13), Math.Max(
@ -331,7 +331,7 @@ namespace math
return; return;
} }
Vector3 difference = value2.Center - value1.Center; Vec3 difference = value2.Center - value1.Center;
float length = difference.Length(); float length = difference.Length();
float radius = value1.Radius; float radius = value1.Radius;
@ -352,7 +352,7 @@ namespace math
} }
} }
Vector3 vector = difference * (1.0f / length); Vec3 vector = difference * (1.0f / length);
float min = Math.Min(-radius, length - radius2); float min = Math.Min(-radius, length - radius2);
float max = (Math.Max(radius, length + radius2) - min) * 0.5f; float max = (Math.Max(radius, length + radius2) - min) * 0.5f;
@ -463,11 +463,11 @@ namespace math
} }
/// <summary> /// <summary>
/// Determines whether the specified <see cref="math.Vector4"/> is equal to this instance. /// Determines whether the specified <see cref="math.Vec4"/> is equal to this instance.
/// </summary> /// </summary>
/// <param name="value">The <see cref="math.Vector4"/> to compare with this instance.</param> /// <param name="value">The <see cref="math.Vec4"/> to compare with this instance.</param>
/// <returns> /// <returns>
/// <c>true</c> if the specified <see cref="math.Vector4"/> is equal to this instance; otherwise, <c>false</c>. /// <c>true</c> if the specified <see cref="math.Vec4"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns> /// </returns>
public bool Equals(BoundingSphere value) public bool Equals(BoundingSphere value)
{ {

View File

@ -67,18 +67,18 @@ namespace math
/// <param name="vertex2">The second vertex to test.</param> /// <param name="vertex2">The second vertex to test.</param>
/// <param name="vertex3">The third vertex to test.</param> /// <param name="vertex3">The third vertex to test.</param>
/// <param name="result">When the method completes, contains the closest point between the two objects.</param> /// <param name="result">When the method completes, contains the closest point between the two objects.</param>
public static void ClosestPointPointTriangle(ref Vector3 point, ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3, out Vector3 result) public static void ClosestPointPointTriangle(ref Vec3 point, ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3, out Vec3 result)
{ {
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 136 //Reference: Page 136
//Check if P in vertex region outside A //Check if P in vertex region outside A
Vector3 ab = vertex2 - vertex1; Vec3 ab = vertex2 - vertex1;
Vector3 ac = vertex3 - vertex1; Vec3 ac = vertex3 - vertex1;
Vector3 ap = point - vertex1; Vec3 ap = point - vertex1;
float d1 = Vector3.Dot(ab, ap); float d1 = Vec3.Dot(ab, ap);
float d2 = Vector3.Dot(ac, ap); float d2 = Vec3.Dot(ac, ap);
if (d1 <= 0.0f && d2 <= 0.0f) if (d1 <= 0.0f && d2 <= 0.0f)
{ {
result = vertex1; //Barycentric coordinates (1,0,0) result = vertex1; //Barycentric coordinates (1,0,0)
@ -86,9 +86,9 @@ namespace math
} }
//Check if P in vertex region outside B //Check if P in vertex region outside B
Vector3 bp = point - vertex2; Vec3 bp = point - vertex2;
float d3 = Vector3.Dot(ab, bp); float d3 = Vec3.Dot(ab, bp);
float d4 = Vector3.Dot(ac, bp); float d4 = Vec3.Dot(ac, bp);
if (d3 >= 0.0f && d4 <= d3) if (d3 >= 0.0f && d4 <= d3)
{ {
result = vertex2; // barycentric coordinates (0,1,0) result = vertex2; // barycentric coordinates (0,1,0)
@ -105,9 +105,9 @@ namespace math
} }
//Check if P in vertex region outside C //Check if P in vertex region outside C
Vector3 cp = point - vertex3; Vec3 cp = point - vertex3;
float d5 = Vector3.Dot(ab, cp); float d5 = Vec3.Dot(ab, cp);
float d6 = Vector3.Dot(ac, cp); float d6 = Vec3.Dot(ac, cp);
if (d6 >= 0.0f && d5 <= d6) if (d6 >= 0.0f && d5 <= d6)
{ {
result = vertex3; //Barycentric coordinates (0,0,1) result = vertex3; //Barycentric coordinates (0,0,1)
@ -145,13 +145,13 @@ namespace math
/// <param name="plane">The plane to test.</param> /// <param name="plane">The plane to test.</param>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <param name="result">When the method completes, contains the closest point between the two objects.</param> /// <param name="result">When the method completes, contains the closest point between the two objects.</param>
public static void ClosestPointPlanePoint(ref Plane plane, ref Vector3 point, out Vector3 result) public static void ClosestPointPlanePoint(ref Plane plane, ref Vec3 point, out Vec3 result)
{ {
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 126 //Reference: Page 126
float dot; float dot;
Vector3.Dot(ref plane.Normal, ref point, out dot); Vec3.Dot(ref plane.Normal, ref point, out dot);
float t = dot - plane.D; float t = dot - plane.D;
result = point - (t * plane.Normal); result = point - (t * plane.Normal);
@ -163,14 +163,14 @@ namespace math
/// <param name="box">The box to test.</param> /// <param name="box">The box to test.</param>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <param name="result">When the method completes, contains the closest point between the two objects.</param> /// <param name="result">When the method completes, contains the closest point between the two objects.</param>
public static void ClosestPointBoxPoint(ref BoundingBox box, ref Vector3 point, out Vector3 result) public static void ClosestPointBoxPoint(ref BoundingBox box, ref Vec3 point, out Vec3 result)
{ {
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 130 //Reference: Page 130
Vector3 temp; Vec3 temp;
Vector3.Max(ref point, ref box.Minimum, out temp); Vec3.Max(ref point, ref box.Minimum, out temp);
Vector3.Min(ref temp, ref box.Maximum, out result); Vec3.Min(ref temp, ref box.Maximum, out result);
} }
/// <summary> /// <summary>
@ -179,14 +179,14 @@ namespace math
/// <param name="sphere">The bounding sphere.</param> /// <param name="sphere">The bounding sphere.</param>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <param name="result">When the method completes, contains the closest point between the two objects; /// <param name="result">When the method completes, contains the closest point between the two objects;
/// or, if the point is directly in the center of the sphere, contains <see cref="math.Vector3.Zero"/>.</param> /// or, if the point is directly in the center of the sphere, contains <see cref="math.Vec3.Zero"/>.</param>
public static void ClosestPointSpherePoint(ref BoundingSphere sphere, ref Vector3 point, out Vector3 result) public static void ClosestPointSpherePoint(ref BoundingSphere sphere, ref Vec3 point, out Vec3 result)
{ {
//Source: Jorgy343 //Source: Jorgy343
//Reference: None //Reference: None
//Get the unit direction from the sphere's center to the point. //Get the unit direction from the sphere's center to the point.
Vector3.Subtract(ref point, ref sphere.Center, out result); Vec3.Subtract(ref point, ref sphere.Center, out result);
result.Normalize(); result.Normalize();
//Multiply the unit direction by the sphere's radius to get a vector //Multiply the unit direction by the sphere's radius to get a vector
@ -203,19 +203,19 @@ namespace math
/// <param name="sphere1">The first sphere to test.</param> /// <param name="sphere1">The first sphere to test.</param>
/// <param name="sphere2">The second sphere to test.</param> /// <param name="sphere2">The second sphere to test.</param>
/// <param name="result">When the method completes, contains the closest point between the two objects; /// <param name="result">When the method completes, contains the closest point between the two objects;
/// or, if the point is directly in the center of the sphere, contains <see cref="math.Vector3.Zero"/>.</param> /// or, if the point is directly in the center of the sphere, contains <see cref="math.Vec3.Zero"/>.</param>
/// <remarks> /// <remarks>
/// If the two spheres are overlapping, but not directly ontop of each other, the closest point /// If the two spheres are overlapping, but not directly ontop of each other, the closest point
/// is the 'closest' point of intersection. This can also be considered is the deepest point of /// is the 'closest' point of intersection. This can also be considered is the deepest point of
/// intersection. /// intersection.
/// </remarks> /// </remarks>
public static void ClosestPointSphereSphere(ref BoundingSphere sphere1, ref BoundingSphere sphere2, out Vector3 result) public static void ClosestPointSphereSphere(ref BoundingSphere sphere1, ref BoundingSphere sphere2, out Vec3 result)
{ {
//Source: Jorgy343 //Source: Jorgy343
//Reference: None //Reference: None
//Get the unit direction from the first sphere's center to the second sphere's center. //Get the unit direction from the first sphere's center to the second sphere's center.
Vector3.Subtract(ref sphere2.Center, ref sphere1.Center, out result); Vec3.Subtract(ref sphere2.Center, ref sphere1.Center, out result);
result.Normalize(); result.Normalize();
//Multiply the unit direction by the first sphere's radius to get a vector //Multiply the unit direction by the first sphere's radius to get a vector
@ -232,13 +232,13 @@ namespace math
/// <param name="plane">The plane to test.</param> /// <param name="plane">The plane to test.</param>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>The distance between the two objects.</returns> /// <returns>The distance between the two objects.</returns>
public static float DistancePlanePoint(ref Plane plane, ref Vector3 point) public static float DistancePlanePoint(ref Plane plane, ref Vec3 point)
{ {
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 127 //Reference: Page 127
float dot; float dot;
Vector3.Dot(ref plane.Normal, ref point, out dot); Vec3.Dot(ref plane.Normal, ref point, out dot);
return dot - plane.D; return dot - plane.D;
} }
@ -248,7 +248,7 @@ namespace math
/// <param name="box">The box to test.</param> /// <param name="box">The box to test.</param>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>The distance between the two objects.</returns> /// <returns>The distance between the two objects.</returns>
public static float DistanceBoxPoint(ref BoundingBox box, ref Vector3 point) public static float DistanceBoxPoint(ref BoundingBox box, ref Vec3 point)
{ {
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 131 //Reference: Page 131
@ -331,13 +331,13 @@ namespace math
/// <param name="sphere">The sphere to test.</param> /// <param name="sphere">The sphere to test.</param>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>The distance between the two objects.</returns> /// <returns>The distance between the two objects.</returns>
public static float DistanceSpherePoint(ref BoundingSphere sphere, ref Vector3 point) public static float DistanceSpherePoint(ref BoundingSphere sphere, ref Vec3 point)
{ {
//Source: Jorgy343 //Source: Jorgy343
//Reference: None //Reference: None
float distance; float distance;
Vector3.Distance(ref sphere.Center, ref point, out distance); Vec3.Distance(ref sphere.Center, ref point, out distance);
distance -= sphere.Radius; distance -= sphere.Radius;
return Math.Max(distance, 0f); return Math.Max(distance, 0f);
@ -355,7 +355,7 @@ namespace math
//Reference: None //Reference: None
float distance; float distance;
Vector3.Distance(ref sphere1.Center, ref sphere2.Center, out distance); Vec3.Distance(ref sphere1.Center, ref sphere2.Center, out distance);
distance -= sphere1.Radius + sphere2.Radius; distance -= sphere1.Radius + sphere2.Radius;
return Math.Max(distance, 0f); return Math.Max(distance, 0f);
@ -367,18 +367,18 @@ namespace math
/// <param name="ray">The ray to test.</param> /// <param name="ray">The ray to test.</param>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>Whether the two objects intersect.</returns> /// <returns>Whether the two objects intersect.</returns>
public static bool RayIntersectsPoint(ref Ray ray, ref Vector3 point) public static bool RayIntersectsPoint(ref Ray ray, ref Vec3 point)
{ {
//Source: RayIntersectsSphere //Source: RayIntersectsSphere
//Reference: None //Reference: None
Vector3 m; Vec3 m;
Vector3.Subtract(ref ray.Position, ref point, out m); Vec3.Subtract(ref ray.Position, ref point, out m);
//Same thing as RayIntersectsSphere except that the radius of the sphere (point) //Same thing as RayIntersectsSphere except that the radius of the sphere (point)
//is the epsilon for zero. //is the epsilon for zero.
float b = Vector3.Dot(m, ray.Direction); float b = Vec3.Dot(m, ray.Direction);
float c = Vector3.Dot(m, m) - MathUtil.ZeroTolerance; float c = Vec3.Dot(m, m) - MathUtil.ZeroTolerance;
if (c > 0f && b > 0f) if (c > 0f && b > 0f)
return false; return false;
@ -397,7 +397,7 @@ namespace math
/// <param name="ray1">The first ray to test.</param> /// <param name="ray1">The first ray to test.</param>
/// <param name="ray2">The second ray to test.</param> /// <param name="ray2">The second ray to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersect.</returns> /// <returns>Whether the two objects intersect.</returns>
/// <remarks> /// <remarks>
/// This method performs a ray vs ray intersection test based on the following formula /// This method performs a ray vs ray intersection test based on the following formula
@ -409,14 +409,14 @@ namespace math
/// of the second ray, det denotes the determinant of a matrix, x denotes the cross /// of the second ray, det denotes the determinant of a matrix, x denotes the cross
/// product, [ ] denotes a matrix, and || || denotes the length or magnitude of a vector. /// product, [ ] denotes a matrix, and || || denotes the length or magnitude of a vector.
/// </remarks> /// </remarks>
public static bool RayIntersectsRay(ref Ray ray1, ref Ray ray2, out Vector3 point) public static bool RayIntersectsRay(ref Ray ray1, ref Ray ray2, out Vec3 point)
{ {
//Source: Real-Time Rendering, Third Edition //Source: Real-Time Rendering, Third Edition
//Reference: Page 780 //Reference: Page 780
Vector3 cross; Vec3 cross;
Vector3.Cross(ref ray1.Direction, ref ray2.Direction, out cross); Vec3.Cross(ref ray1.Direction, ref ray2.Direction, out cross);
float denominator = cross.Length(); float denominator = cross.Length();
//Lines are parallel. //Lines are parallel.
@ -427,7 +427,7 @@ namespace math
Math.Abs(ray2.Position.Y - ray1.Position.Y) < MathUtil.ZeroTolerance && Math.Abs(ray2.Position.Y - ray1.Position.Y) < MathUtil.ZeroTolerance &&
Math.Abs(ray2.Position.Z - ray1.Position.Z) < MathUtil.ZeroTolerance) Math.Abs(ray2.Position.Z - ray1.Position.Z) < MathUtil.ZeroTolerance)
{ {
point = Vector3.Zero; point = Vec3.Zero;
return true; return true;
} }
} }
@ -473,15 +473,15 @@ namespace math
float t = dett / denominator; float t = dett / denominator;
//The points of intersection. //The points of intersection.
Vector3 point1 = ray1.Position + (s * ray1.Direction); Vec3 point1 = ray1.Position + (s * ray1.Direction);
Vector3 point2 = ray2.Position + (t * ray2.Direction); Vec3 point2 = ray2.Position + (t * ray2.Direction);
//If the points are not equal, no intersection has occurred. //If the points are not equal, no intersection has occurred.
if (Math.Abs(point2.X - point1.X) > MathUtil.ZeroTolerance || if (Math.Abs(point2.X - point1.X) > MathUtil.ZeroTolerance ||
Math.Abs(point2.Y - point1.Y) > MathUtil.ZeroTolerance || Math.Abs(point2.Y - point1.Y) > MathUtil.ZeroTolerance ||
Math.Abs(point2.Z - point1.Z) > MathUtil.ZeroTolerance) Math.Abs(point2.Z - point1.Z) > MathUtil.ZeroTolerance)
{ {
point = Vector3.Zero; point = Vec3.Zero;
return false; return false;
} }
@ -503,7 +503,7 @@ namespace math
//Reference: Page 175 //Reference: Page 175
float direction; float direction;
Vector3.Dot(ref plane.Normal, ref ray.Direction, out direction); Vec3.Dot(ref plane.Normal, ref ray.Direction, out direction);
if (Math.Abs(direction) < MathUtil.ZeroTolerance) if (Math.Abs(direction) < MathUtil.ZeroTolerance)
{ {
@ -512,7 +512,7 @@ namespace math
} }
float position; float position;
Vector3.Dot(ref plane.Normal, ref ray.Position, out position); Vec3.Dot(ref plane.Normal, ref ray.Position, out position);
distance = (-plane.D - position) / direction; distance = (-plane.D - position) / direction;
if (distance < 0f) if (distance < 0f)
@ -535,9 +535,9 @@ namespace math
/// <param name="ray">The ray to test.</param> /// <param name="ray">The ray to test.</param>
/// <param name="plane">The plane to test</param> /// <param name="plane">The plane to test</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public static bool RayIntersectsPlane(ref Ray ray, ref Plane plane, out Vector3 point) public static bool RayIntersectsPlane(ref Ray ray, ref Plane plane, out Vec3 point)
{ {
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 175 //Reference: Page 175
@ -545,7 +545,7 @@ namespace math
float distance; float distance;
if (!RayIntersectsPlane(ref ray, ref plane, out distance)) if (!RayIntersectsPlane(ref ray, ref plane, out distance))
{ {
point = Vector3.Zero; point = Vec3.Zero;
return false; return false;
} }
@ -570,13 +570,13 @@ namespace math
/// the ray, no intersection is assumed to have happened. In both cases of assumptions, /// the ray, no intersection is assumed to have happened. In both cases of assumptions,
/// this method returns false. /// this method returns false.
/// </remarks> /// </remarks>
public static bool RayIntersectsTriangle(ref Ray ray, ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3, out float distance) public static bool RayIntersectsTriangle(ref Ray ray, ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3, out float distance)
{ {
//Source: Fast Minimum Storage Ray / Triangle Intersection //Source: Fast Minimum Storage Ray / Triangle Intersection
//Reference: http://www.cs.virginia.edu/~gfx/Courses/2003/ImageSynthesis/papers/Acceleration/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf //Reference: http://www.cs.virginia.edu/~gfx/Courses/2003/ImageSynthesis/papers/Acceleration/Fast%20MinimumStorage%20RayTriangle%20Intersection.pdf
//Compute vectors along two edges of the triangle. //Compute vectors along two edges of the triangle.
Vector3 edge1, edge2; Vec3 edge1, edge2;
//Edge 1 //Edge 1
edge1.X = vertex2.X - vertex1.X; edge1.X = vertex2.X - vertex1.X;
@ -589,7 +589,7 @@ namespace math
edge2.Z = vertex3.Z - vertex1.Z; edge2.Z = vertex3.Z - vertex1.Z;
//Cross product of ray direction and edge2 - first part of determinant. //Cross product of ray direction and edge2 - first part of determinant.
Vector3 directioncrossedge2; Vec3 directioncrossedge2;
directioncrossedge2.X = (ray.Direction.Y * edge2.Z) - (ray.Direction.Z * edge2.Y); directioncrossedge2.X = (ray.Direction.Y * edge2.Z) - (ray.Direction.Z * edge2.Y);
directioncrossedge2.Y = (ray.Direction.Z * edge2.X) - (ray.Direction.X * edge2.Z); directioncrossedge2.Y = (ray.Direction.Z * edge2.X) - (ray.Direction.X * edge2.Z);
directioncrossedge2.Z = (ray.Direction.X * edge2.Y) - (ray.Direction.Y * edge2.X); directioncrossedge2.Z = (ray.Direction.X * edge2.Y) - (ray.Direction.Y * edge2.X);
@ -611,7 +611,7 @@ namespace math
float inversedeterminant = 1.0f / determinant; float inversedeterminant = 1.0f / determinant;
//Calculate the U parameter of the intersection point. //Calculate the U parameter of the intersection point.
Vector3 distanceVector; Vec3 distanceVector;
distanceVector.X = ray.Position.X - vertex1.X; distanceVector.X = ray.Position.X - vertex1.X;
distanceVector.Y = ray.Position.Y - vertex1.Y; distanceVector.Y = ray.Position.Y - vertex1.Y;
distanceVector.Z = ray.Position.Z - vertex1.Z; distanceVector.Z = ray.Position.Z - vertex1.Z;
@ -628,7 +628,7 @@ namespace math
} }
//Calculate the V parameter of the intersection point. //Calculate the V parameter of the intersection point.
Vector3 distancecrossedge1; Vec3 distancecrossedge1;
distancecrossedge1.X = (distanceVector.Y * edge1.Z) - (distanceVector.Z * edge1.Y); distancecrossedge1.X = (distanceVector.Y * edge1.Z) - (distanceVector.Z * edge1.Y);
distancecrossedge1.Y = (distanceVector.Z * edge1.X) - (distanceVector.X * edge1.Z); distancecrossedge1.Y = (distanceVector.Z * edge1.X) - (distanceVector.X * edge1.Z);
distancecrossedge1.Z = (distanceVector.X * edge1.Y) - (distanceVector.Y * edge1.X); distancecrossedge1.Z = (distanceVector.X * edge1.Y) - (distanceVector.Y * edge1.X);
@ -668,14 +668,14 @@ namespace math
/// <param name="vertex2">The second vertex of the triangle to test.</param> /// <param name="vertex2">The second vertex of the triangle to test.</param>
/// <param name="vertex3">The third vertex of the triangle to test.</param> /// <param name="vertex3">The third vertex of the triangle to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public static bool RayIntersectsTriangle(ref Ray ray, ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3, out Vector3 point) public static bool RayIntersectsTriangle(ref Ray ray, ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3, out Vec3 point)
{ {
float distance; float distance;
if (!RayIntersectsTriangle(ref ray, ref vertex1, ref vertex2, ref vertex3, out distance)) if (!RayIntersectsTriangle(ref ray, ref vertex1, ref vertex2, ref vertex3, out distance))
{ {
point = Vector3.Zero; point = Vec3.Zero;
return false; return false;
} }
@ -692,7 +692,7 @@ namespace math
/// <param name="normalAxis">The index of axis defining the normal of the rectangle in the world. This value should be 0, 1 or 2</param> /// <param name="normalAxis">The index of axis defining the normal of the rectangle in the world. This value should be 0, 1 or 2</param>
/// <param name="intersectionPoint">The position of the intersection point in the world</param> /// <param name="intersectionPoint">The position of the intersection point in the world</param>
/// <returns><value>true</value> if the ray and rectangle intersects.</returns> /// <returns><value>true</value> if the ray and rectangle intersects.</returns>
public static bool RayIntersectsRectangle(ref Ray ray, ref Matrix rectangleWorldMatrix, ref Vector3 rectangleSize, int normalAxis, out Vector3 intersectionPoint) public static bool RayIntersectsRectangle(ref Ray ray, ref Matrix rectangleWorldMatrix, ref Vec3 rectangleSize, int normalAxis, out Vec3 intersectionPoint)
{ {
bool intersects; bool intersects;
@ -716,10 +716,10 @@ namespace math
throw new ArgumentOutOfRangeException("normalAxis"); throw new ArgumentOutOfRangeException("normalAxis");
} }
var rectanglePosition = new Vector3(rectangleWorldMatrix.M41, rectangleWorldMatrix.M42, rectangleWorldMatrix.M43); var rectanglePosition = new Vec3(rectangleWorldMatrix.M41, rectangleWorldMatrix.M42, rectangleWorldMatrix.M43);
var normalRowStart = normalAxis << 2; var normalRowStart = normalAxis << 2;
var plane = new Plane(rectanglePosition, new Vector3(rectangleWorldMatrix[normalRowStart], rectangleWorldMatrix[normalRowStart + 1], rectangleWorldMatrix[normalRowStart + 2])); var plane = new Plane(rectanglePosition, new Vec3(rectangleWorldMatrix[normalRowStart], rectangleWorldMatrix[normalRowStart + 1], rectangleWorldMatrix[normalRowStart + 2]));
// early exist the planes were parallels // early exist the planes were parallels
if (!plane.Intersects(ref ray, out intersectionPoint)) if (!plane.Intersects(ref ray, out intersectionPoint))
@ -752,17 +752,17 @@ namespace math
var normalSign = Math.Sign(plane.Normal[normalTestIndex]); var normalSign = Math.Sign(plane.Normal[normalTestIndex]);
// the base vector // the base vector
var base1 = rectangleSize[testAxis1] * new Vector3(rectangleWorldMatrix[(testAxis1 << 2)], rectangleWorldMatrix[(testAxis1 << 2) + 1], rectangleWorldMatrix[(testAxis1 << 2) + 2]) / 2; var base1 = rectangleSize[testAxis1] * new Vec3(rectangleWorldMatrix[(testAxis1 << 2)], rectangleWorldMatrix[(testAxis1 << 2) + 1], rectangleWorldMatrix[(testAxis1 << 2) + 2]) / 2;
var base2 = rectangleSize[testAxis2] * new Vector3(rectangleWorldMatrix[(testAxis2 << 2)], rectangleWorldMatrix[(testAxis2 << 2) + 1], rectangleWorldMatrix[(testAxis2 << 2) + 2]) / 2; var base2 = rectangleSize[testAxis2] * new Vec3(rectangleWorldMatrix[(testAxis2 << 2)], rectangleWorldMatrix[(testAxis2 << 2) + 1], rectangleWorldMatrix[(testAxis2 << 2) + 2]) / 2;
// build the first triangle and perform the test // build the first triangle and perform the test
var v1 = -base1 - base2 - intersectionInRectangle; var v1 = -base1 - base2 - intersectionInRectangle;
var v2 = +base1 - base2 - intersectionInRectangle; var v2 = +base1 - base2 - intersectionInRectangle;
var v3 = +base1 + base2 - intersectionInRectangle; var v3 = +base1 + base2 - intersectionInRectangle;
intersects = Math.Sign(Vector3.Cross(v1, v2)[normalTestIndex]) == normalSign && intersects = Math.Sign(Vec3.Cross(v1, v2)[normalTestIndex]) == normalSign &&
Math.Sign(Vector3.Cross(v2, v3)[normalTestIndex]) == normalSign && Math.Sign(Vec3.Cross(v2, v3)[normalTestIndex]) == normalSign &&
Math.Sign(Vector3.Cross(v3, v1)[normalTestIndex]) == normalSign; Math.Sign(Vec3.Cross(v3, v1)[normalTestIndex]) == normalSign;
// early exit on success // early exit on success
if (intersects) if (intersects)
@ -773,9 +773,9 @@ namespace math
v2 = +base1 + base2 - intersectionInRectangle; v2 = +base1 + base2 - intersectionInRectangle;
v3 = -base1 + base2 - intersectionInRectangle; v3 = -base1 + base2 - intersectionInRectangle;
intersects = Math.Sign(Vector3.Cross(v1, v2)[normalTestIndex]) == normalSign && intersects = Math.Sign(Vec3.Cross(v1, v2)[normalTestIndex]) == normalSign &&
Math.Sign(Vector3.Cross(v2, v3)[normalTestIndex]) == normalSign && Math.Sign(Vec3.Cross(v2, v3)[normalTestIndex]) == normalSign &&
Math.Sign(Vector3.Cross(v3, v1)[normalTestIndex]) == normalSign; Math.Sign(Vec3.Cross(v3, v1)[normalTestIndex]) == normalSign;
} }
return intersects; return intersects;
@ -899,14 +899,14 @@ namespace math
/// <param name="ray">The ray to test.</param> /// <param name="ray">The ray to test.</param>
/// <param name="box">The box to test.</param> /// <param name="box">The box to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public static bool RayIntersectsBox(ref Ray ray, ref BoundingBox box, out Vector3 point) public static bool RayIntersectsBox(ref Ray ray, ref BoundingBox box, out Vec3 point)
{ {
float distance; float distance;
if (!RayIntersectsBox(ref ray, ref box, out distance)) if (!RayIntersectsBox(ref ray, ref box, out distance))
{ {
point = Vector3.Zero; point = Vec3.Zero;
return false; return false;
} }
@ -927,11 +927,11 @@ namespace math
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 177 //Reference: Page 177
Vector3 m; Vec3 m;
Vector3.Subtract(ref ray.Position, ref sphere.Center, out m); Vec3.Subtract(ref ray.Position, ref sphere.Center, out m);
float b = Vector3.Dot(m, ray.Direction); float b = Vec3.Dot(m, ray.Direction);
float c = Vector3.Dot(m, m) - (sphere.Radius * sphere.Radius); float c = Vec3.Dot(m, m) - (sphere.Radius * sphere.Radius);
if (c > 0f && b > 0f) if (c > 0f && b > 0f)
{ {
@ -961,14 +961,14 @@ namespace math
/// <param name="ray">The ray to test.</param> /// <param name="ray">The ray to test.</param>
/// <param name="sphere">The sphere to test.</param> /// <param name="sphere">The sphere to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public static bool RayIntersectsSphere(ref Ray ray, ref BoundingSphere sphere, out Vector3 point) public static bool RayIntersectsSphere(ref Ray ray, ref BoundingSphere sphere, out Vec3 point)
{ {
float distance; float distance;
if (!RayIntersectsSphere(ref ray, ref sphere, out distance)) if (!RayIntersectsSphere(ref ray, ref sphere, out distance))
{ {
point = Vector3.Zero; point = Vec3.Zero;
return false; return false;
} }
@ -982,10 +982,10 @@ namespace math
/// <param name="plane">The plane to test.</param> /// <param name="plane">The plane to test.</param>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public static PlaneIntersectionType PlaneIntersectsPoint(ref Plane plane, ref Vector3 point) public static PlaneIntersectionType PlaneIntersectsPoint(ref Plane plane, ref Vec3 point)
{ {
float distance; float distance;
Vector3.Dot(ref plane.Normal, ref point, out distance); Vec3.Dot(ref plane.Normal, ref point, out distance);
distance += plane.D; distance += plane.D;
if (distance > 0f) if (distance > 0f)
@ -1005,13 +1005,13 @@ namespace math
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public static bool PlaneIntersectsPlane(ref Plane plane1, ref Plane plane2) public static bool PlaneIntersectsPlane(ref Plane plane1, ref Plane plane2)
{ {
Vector3 direction; Vec3 direction;
Vector3.Cross(ref plane1.Normal, ref plane2.Normal, out direction); Vec3.Cross(ref plane1.Normal, ref plane2.Normal, out direction);
//If direction is the zero vector, the planes are parallel and possibly //If direction is the zero vector, the planes are parallel and possibly
//coincident. It is not an intersection. The dot product will tell us. //coincident. It is not an intersection. The dot product will tell us.
float denominator; float denominator;
Vector3.Dot(ref direction, ref direction, out denominator); Vec3.Dot(ref direction, ref direction, out denominator);
if (Math.Abs(denominator) < MathUtil.ZeroTolerance) if (Math.Abs(denominator) < MathUtil.ZeroTolerance)
return false; return false;
@ -1037,13 +1037,13 @@ namespace math
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 207 //Reference: Page 207
Vector3 direction; Vec3 direction;
Vector3.Cross(ref plane1.Normal, ref plane2.Normal, out direction); Vec3.Cross(ref plane1.Normal, ref plane2.Normal, out direction);
//If direction is the zero vector, the planes are parallel and possibly //If direction is the zero vector, the planes are parallel and possibly
//coincident. It is not an intersection. The dot product will tell us. //coincident. It is not an intersection. The dot product will tell us.
float denominator; float denominator;
Vector3.Dot(ref direction, ref direction, out denominator); Vec3.Dot(ref direction, ref direction, out denominator);
//We assume the planes are normalized, therefore the denominator //We assume the planes are normalized, therefore the denominator
//only serves as a parallel and coincident check. Otherwise we need //only serves as a parallel and coincident check. Otherwise we need
@ -1054,9 +1054,9 @@ namespace math
return false; return false;
} }
Vector3 point; Vec3 point;
Vector3 temp = plane1.D * plane2.Normal - plane2.D * plane1.Normal; Vec3 temp = plane1.D * plane2.Normal - plane2.D * plane1.Normal;
Vector3.Cross(ref temp, ref direction, out point); Vec3.Cross(ref temp, ref direction, out point);
line.Position = point; line.Position = point;
line.Direction = direction; line.Direction = direction;
@ -1073,7 +1073,7 @@ namespace math
/// <param name="vertex2">The second vertex of the triagnle to test.</param> /// <param name="vertex2">The second vertex of the triagnle to test.</param>
/// <param name="vertex3">The third vertex of the triangle to test.</param> /// <param name="vertex3">The third vertex of the triangle to test.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public static PlaneIntersectionType PlaneIntersectsTriangle(ref Plane plane, ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3) public static PlaneIntersectionType PlaneIntersectsTriangle(ref Plane plane, ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3)
{ {
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 207 //Reference: Page 207
@ -1102,8 +1102,8 @@ namespace math
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 161 //Reference: Page 161
Vector3 min; Vec3 min;
Vector3 max; Vec3 max;
max.X = (plane.Normal.X >= 0.0f) ? box.Minimum.X : box.Maximum.X; max.X = (plane.Normal.X >= 0.0f) ? box.Minimum.X : box.Maximum.X;
max.Y = (plane.Normal.Y >= 0.0f) ? box.Minimum.Y : box.Maximum.Y; max.Y = (plane.Normal.Y >= 0.0f) ? box.Minimum.Y : box.Maximum.Y;
@ -1113,12 +1113,12 @@ namespace math
min.Z = (plane.Normal.Z >= 0.0f) ? box.Maximum.Z : box.Minimum.Z; min.Z = (plane.Normal.Z >= 0.0f) ? box.Maximum.Z : box.Minimum.Z;
float distance; float distance;
Vector3.Dot(ref plane.Normal, ref max, out distance); Vec3.Dot(ref plane.Normal, ref max, out distance);
if (distance + plane.D > 0.0f) if (distance + plane.D > 0.0f)
return PlaneIntersectionType.Front; return PlaneIntersectionType.Front;
distance = Vector3.Dot(plane.Normal, min); distance = Vec3.Dot(plane.Normal, min);
if (distance + plane.D < 0.0f) if (distance + plane.D < 0.0f)
return PlaneIntersectionType.Back; return PlaneIntersectionType.Back;
@ -1138,7 +1138,7 @@ namespace math
//Reference: Page 160 //Reference: Page 160
float distance; float distance;
Vector3.Dot(ref plane.Normal, ref sphere.Center, out distance); Vec3.Dot(ref plane.Normal, ref sphere.Center, out distance);
distance += plane.D; distance += plane.D;
if (distance > sphere.Radius) if (distance > sphere.Radius)
@ -1205,9 +1205,9 @@ namespace math
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 166 //Reference: Page 166
Vector3 vector; Vec3 vector;
Vector3.Clamp(ref sphere.Center, ref box.Minimum, ref box.Maximum, out vector); Vec3.Clamp(ref sphere.Center, ref box.Minimum, ref box.Maximum, out vector);
float distance = Vector3.DistanceSquared(sphere.Center, vector); float distance = Vec3.DistanceSquared(sphere.Center, vector);
return distance <= sphere.Radius * sphere.Radius; return distance <= sphere.Radius * sphere.Radius;
} }
@ -1220,17 +1220,17 @@ namespace math
/// <param name="vertex2">The second vertex of the triagnle to test.</param> /// <param name="vertex2">The second vertex of the triagnle to test.</param>
/// <param name="vertex3">The third vertex of the triangle to test.</param> /// <param name="vertex3">The third vertex of the triangle to test.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public static bool SphereIntersectsTriangle(ref BoundingSphere sphere, ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3) public static bool SphereIntersectsTriangle(ref BoundingSphere sphere, ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3)
{ {
//Source: Real-Time Collision Detection by Christer Ericson //Source: Real-Time Collision Detection by Christer Ericson
//Reference: Page 167 //Reference: Page 167
Vector3 point; Vec3 point;
ClosestPointPointTriangle(ref sphere.Center, ref vertex1, ref vertex2, ref vertex3, out point); ClosestPointPointTriangle(ref sphere.Center, ref vertex1, ref vertex2, ref vertex3, out point);
Vector3 v = point - sphere.Center; Vec3 v = point - sphere.Center;
float dot; float dot;
Vector3.Dot(ref v, ref v, out dot); Vec3.Dot(ref v, ref v, out dot);
return dot <= sphere.Radius * sphere.Radius; return dot <= sphere.Radius * sphere.Radius;
} }
@ -1244,7 +1244,7 @@ namespace math
public static bool SphereIntersectsSphere(ref BoundingSphere sphere1, ref BoundingSphere sphere2) public static bool SphereIntersectsSphere(ref BoundingSphere sphere1, ref BoundingSphere sphere2)
{ {
float radiisum = sphere1.Radius + sphere2.Radius; float radiisum = sphere1.Radius + sphere2.Radius;
return Vector3.DistanceSquared(sphere1.Center, sphere2.Center) <= radiisum * radiisum; return Vec3.DistanceSquared(sphere1.Center, sphere2.Center) <= radiisum * radiisum;
} }
/// <summary> /// <summary>
@ -1253,7 +1253,7 @@ namespace math
/// <param name="box">The box to test.</param> /// <param name="box">The box to test.</param>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>The type of containment the two objects have.</returns> /// <returns>The type of containment the two objects have.</returns>
public static ContainmentType BoxContainsPoint(ref BoundingBox box, ref Vector3 point) public static ContainmentType BoxContainsPoint(ref BoundingBox box, ref Vec3 point)
{ {
if (box.Minimum.X <= point.X && box.Maximum.X >= point.X && if (box.Minimum.X <= point.X && box.Maximum.X >= point.X &&
box.Minimum.Y <= point.Y && box.Maximum.Y >= point.Y && box.Minimum.Y <= point.Y && box.Maximum.Y >= point.Y &&
@ -1325,9 +1325,9 @@ namespace math
/// <returns>The type of containment the two objects have.</returns> /// <returns>The type of containment the two objects have.</returns>
public static ContainmentType BoxContainsSphere(ref BoundingBox box, ref BoundingSphere sphere) public static ContainmentType BoxContainsSphere(ref BoundingBox box, ref BoundingSphere sphere)
{ {
Vector3 vector; Vec3 vector;
Vector3.Clamp(ref sphere.Center, ref box.Minimum, ref box.Maximum, out vector); Vec3.Clamp(ref sphere.Center, ref box.Minimum, ref box.Maximum, out vector);
float distance = Vector3.DistanceSquared(sphere.Center, vector); float distance = Vec3.DistanceSquared(sphere.Center, vector);
if (distance > sphere.Radius * sphere.Radius) if (distance > sphere.Radius * sphere.Radius)
return ContainmentType.Disjoint; return ContainmentType.Disjoint;
@ -1348,9 +1348,9 @@ namespace math
/// <param name="sphere">The sphere to test.</param> /// <param name="sphere">The sphere to test.</param>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>The type of containment the two objects have.</returns> /// <returns>The type of containment the two objects have.</returns>
public static ContainmentType SphereContainsPoint(ref BoundingSphere sphere, ref Vector3 point) public static ContainmentType SphereContainsPoint(ref BoundingSphere sphere, ref Vec3 point)
{ {
if (Vector3.DistanceSquared(point, sphere.Center) <= sphere.Radius * sphere.Radius) if (Vec3.DistanceSquared(point, sphere.Center) <= sphere.Radius * sphere.Radius)
return ContainmentType.Contains; return ContainmentType.Contains;
return ContainmentType.Disjoint; return ContainmentType.Disjoint;
@ -1364,7 +1364,7 @@ namespace math
/// <param name="vertex2">The second vertex of the triagnle to test.</param> /// <param name="vertex2">The second vertex of the triagnle to test.</param>
/// <param name="vertex3">The third vertex of the triangle to test.</param> /// <param name="vertex3">The third vertex of the triangle to test.</param>
/// <returns>The type of containment the two objects have.</returns> /// <returns>The type of containment the two objects have.</returns>
public static ContainmentType SphereContainsTriangle(ref BoundingSphere sphere, ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3) public static ContainmentType SphereContainsTriangle(ref BoundingSphere sphere, ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3)
{ {
//Source: Jorgy343 //Source: Jorgy343
//Reference: None //Reference: None
@ -1390,7 +1390,7 @@ namespace math
/// <returns>The type of containment the two objects have.</returns> /// <returns>The type of containment the two objects have.</returns>
public static ContainmentType SphereContainsBox(ref BoundingSphere sphere, ref BoundingBox box) public static ContainmentType SphereContainsBox(ref BoundingSphere sphere, ref BoundingBox box)
{ {
Vector3 vector; Vec3 vector;
if (!BoxIntersectsSphere(ref box, ref sphere)) if (!BoxIntersectsSphere(ref box, ref sphere))
return ContainmentType.Disjoint; return ContainmentType.Disjoint;
@ -1463,7 +1463,7 @@ namespace math
/// <returns>The type of containment the two objects have.</returns> /// <returns>The type of containment the two objects have.</returns>
public static ContainmentType SphereContainsSphere(ref BoundingSphere sphere1, ref BoundingSphere sphere2) public static ContainmentType SphereContainsSphere(ref BoundingSphere sphere1, ref BoundingSphere sphere2)
{ {
float distance = Vector3.Distance(sphere1.Center, sphere2.Center); float distance = Vec3.Distance(sphere1.Center, sphere2.Center);
if (sphere1.Radius + sphere2.Radius < distance) if (sphere1.Radius + sphere2.Radius < distance)
return ContainmentType.Disjoint; return ContainmentType.Disjoint;
@ -1491,7 +1491,7 @@ namespace math
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
{ {
// Previous code: // Previous code:
if (Vector3.Dot(boundingBoxExt.Center, plane->Normal) if (Vec3.Dot(boundingBoxExt.Center, plane->Normal)
+ boundingBoxExt.Extent.X * Math.Abs(plane->Normal.X) + boundingBoxExt.Extent.X * Math.Abs(plane->Normal.X)
+ boundingBoxExt.Extent.Y * Math.Abs(plane->Normal.Y) + boundingBoxExt.Extent.Y * Math.Abs(plane->Normal.Y)
+ boundingBoxExt.Extent.Z * Math.Abs(plane->Normal.Z) + boundingBoxExt.Extent.Z * Math.Abs(plane->Normal.Z)

View File

@ -119,7 +119,7 @@ namespace math
/// Initializes a new instance of the <see cref="Color"/> struct. /// Initializes a new instance of the <see cref="Color"/> struct.
/// </summary> /// </summary>
/// <param name="value">The red, green, blue, and alpha components of the color.</param> /// <param name="value">The red, green, blue, and alpha components of the color.</param>
public Color(Vector4 value) public Color(Vec4 value)
{ {
R = ToByte(value.X); R = ToByte(value.X);
G = ToByte(value.Y); G = ToByte(value.Y);
@ -132,7 +132,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="value">The red, green, and blue components of the color.</param> /// <param name="value">The red, green, and blue components of the color.</param>
/// <param name="alpha">The alpha component of the color.</param> /// <param name="alpha">The alpha component of the color.</param>
public Color(Vector3 value, float alpha) public Color(Vec3 value, float alpha)
{ {
R = ToByte(value.X); R = ToByte(value.X);
G = ToByte(value.Y); G = ToByte(value.Y);
@ -144,7 +144,7 @@ namespace math
/// Initializes a new instance of the <see cref="Color"/> struct. Alpha is set to 255. /// Initializes a new instance of the <see cref="Color"/> struct. Alpha is set to 255.
/// </summary> /// </summary>
/// <param name="value">The red, green, and blue components of the color.</param> /// <param name="value">The red, green, and blue components of the color.</param>
public Color(Vector3 value) public Color(Vec3 value)
{ {
R = ToByte(value.X); R = ToByte(value.X);
G = ToByte(value.Y); G = ToByte(value.Y);
@ -309,9 +309,9 @@ namespace math
/// Converts the color into a three component vector. /// Converts the color into a three component vector.
/// </summary> /// </summary>
/// <returns>A three component vector containing the red, green, and blue components of the color.</returns> /// <returns>A three component vector containing the red, green, and blue components of the color.</returns>
public Vector3 ToVector3() public Vec3 ToVector3()
{ {
return new Vector3(R / 255.0f, G / 255.0f, B / 255.0f); return new Vec3(R / 255.0f, G / 255.0f, B / 255.0f);
} }
/// <summary> /// <summary>
@ -327,9 +327,9 @@ namespace math
/// Converts the color into a four component vector. /// Converts the color into a four component vector.
/// </summary> /// </summary>
/// <returns>A four component vector containing all four color components.</returns> /// <returns>A four component vector containing all four color components.</returns>
public Vector4 ToVector4() public Vec4 ToVector4()
{ {
return new Vector4(R / 255.0f, G / 255.0f, B / 255.0f, A / 255.0f); return new Vec4(R / 255.0f, G / 255.0f, B / 255.0f, A / 255.0f);
} }
/// <summary> /// <summary>
@ -965,23 +965,23 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Color"/> to <see cref="Vector3"/>. /// Performs an explicit conversion from <see cref="Color"/> to <see cref="Vec3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(Color value) public static explicit operator Vec3(Color value)
{ {
return new Vector3(value.R / 255.0f, value.G / 255.0f, value.B / 255.0f); return new Vec3(value.R / 255.0f, value.G / 255.0f, value.B / 255.0f);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Color"/> to <see cref="Vector4"/>. /// Performs an explicit conversion from <see cref="Color"/> to <see cref="Vec4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector4(Color value) public static explicit operator Vec4(Color value)
{ {
return new Vector4(value.R / 255.0f, value.G / 255.0f, value.B / 255.0f, value.A / 255.0f); return new Vec4(value.R / 255.0f, value.G / 255.0f, value.B / 255.0f, value.A / 255.0f);
} }
/// <summary> /// <summary>
@ -1004,11 +1004,11 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Vector3"/> to <see cref="Color"/>. /// Performs an explicit conversion from <see cref="Vec3"/> to <see cref="Color"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Color(Vector3 value) public static explicit operator Color(Vec3 value)
{ {
return new Color(value.X, value.Y, value.Z, 1.0f); return new Color(value.X, value.Y, value.Z, 1.0f);
} }
@ -1024,11 +1024,11 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Vector4"/> to <see cref="Color"/>. /// Performs an explicit conversion from <see cref="Vec4"/> to <see cref="Color"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Color(Vector4 value) public static explicit operator Color(Vec4 value)
{ {
return new Color(value.X, value.Y, value.Z, value.W); return new Color(value.X, value.Y, value.Z, value.W);
} }

View File

@ -87,7 +87,7 @@ namespace math
/// Initializes a new instance of the <see cref="Color3"/> struct. /// Initializes a new instance of the <see cref="Color3"/> struct.
/// </summary> /// </summary>
/// <param name="value">The red, green, and blue components of the color.</param> /// <param name="value">The red, green, and blue components of the color.</param>
public Color3(Vector3 value) public Color3(Vec3 value)
{ {
R = value.X; R = value.X;
G = value.Y; G = value.Y;
@ -204,9 +204,9 @@ namespace math
/// Converts the color into a three component vector. /// Converts the color into a three component vector.
/// </summary> /// </summary>
/// <returns>A three component vector containing the red, green, and blue components of the color.</returns> /// <returns>A three component vector containing the red, green, and blue components of the color.</returns>
public Vector3 ToVector3() public Vec3 ToVector3()
{ {
return new Vector3(R, G, B); return new Vec3(R, G, B);
} }
/// <summary> /// <summary>
@ -684,21 +684,21 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Color3"/> to <see cref="math.Vector3"/>. /// Performs an explicit conversion from <see cref="Color3"/> to <see cref="math.Vec3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(Color3 value) public static explicit operator Vec3(Color3 value)
{ {
return new Vector3(value.R, value.G, value.B); return new Vec3(value.R, value.G, value.B);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="math.Vector3"/> to <see cref="Color3"/>. /// Performs an explicit conversion from <see cref="math.Vec3"/> to <see cref="Color3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Color3(Vector3 value) public static explicit operator Color3(Vec3 value)
{ {
return new Color3(value.X, value.Y, value.Z); return new Color3(value.X, value.Y, value.Z);
} }

View File

@ -105,7 +105,7 @@ namespace math
/// Initializes a new instance of the <see cref="Color4"/> struct. /// Initializes a new instance of the <see cref="Color4"/> struct.
/// </summary> /// </summary>
/// <param name="value">The red, green, blue, and alpha components of the color.</param> /// <param name="value">The red, green, blue, and alpha components of the color.</param>
public Color4(Vector4 value) public Color4(Vec4 value)
{ {
R = value.X; R = value.X;
G = value.Y; G = value.Y;
@ -118,7 +118,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="value">The red, green, and blue components of the color.</param> /// <param name="value">The red, green, and blue components of the color.</param>
/// <param name="alpha">The alpha component of the color.</param> /// <param name="alpha">The alpha component of the color.</param>
public Color4(Vector3 value, float alpha) public Color4(Vec3 value, float alpha)
{ {
R = value.X; R = value.X;
G = value.Y; G = value.Y;
@ -306,18 +306,18 @@ namespace math
/// Converts the color into a three component vector. /// Converts the color into a three component vector.
/// </summary> /// </summary>
/// <returns>A three component vector containing the red, green, and blue components of the color.</returns> /// <returns>A three component vector containing the red, green, and blue components of the color.</returns>
public Vector3 ToVector3() public Vec3 ToVector3()
{ {
return new Vector3(R, G, B); return new Vec3(R, G, B);
} }
/// <summary> /// <summary>
/// Converts the color into a four component vector. /// Converts the color into a four component vector.
/// </summary> /// </summary>
/// <returns>A four component vector containing all four color components.</returns> /// <returns>A four component vector containing all four color components.</returns>
public Vector4 ToVector4() public Vec4 ToVector4()
{ {
return new Vector4(R, G, B, A); return new Vec4(R, G, B, A);
} }
/// <summary> /// <summary>
@ -808,47 +808,47 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Color4"/> to <see cref="Vector3"/>. /// Performs an explicit conversion from <see cref="Color4"/> to <see cref="Vec3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(Color4 value) public static explicit operator Vec3(Color4 value)
{ {
return new Vector3(value.R, value.G, value.B); return new Vec3(value.R, value.G, value.B);
} }
/// <summary> /// <summary>
/// Performs an implicit conversion from <see cref="Color4"/> to <see cref="Vector4"/>. /// Performs an implicit conversion from <see cref="Color4"/> to <see cref="Vec4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static implicit operator Vector4(Color4 value) public static implicit operator Vec4(Color4 value)
{ {
return new Vector4(value.R, value.G, value.B, value.A); return new Vec4(value.R, value.G, value.B, value.A);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Vector3"/> to <see cref="Color4"/>. /// Performs an explicit conversion from <see cref="Vec3"/> to <see cref="Color4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Color4(Vector3 value) public static explicit operator Color4(Vec3 value)
{ {
return new Color4(value.X, value.Y, value.Z, 1.0f); return new Color4(value.X, value.Y, value.Z, 1.0f);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Vector4"/> to <see cref="Color4"/>. /// Performs an explicit conversion from <see cref="Vec4"/> to <see cref="Color4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Color4(Vector4 value) public static explicit operator Color4(Vec4 value)
{ {
return new Color4(value.X, value.Y, value.Z, value.W); return new Color4(value.X, value.Y, value.Z, value.W);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Vector3"/> to <see cref="Color4"/>. /// Performs an explicit conversion from <see cref="Vec3"/> to <see cref="Color4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
@ -858,7 +858,7 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Vector4"/> to <see cref="Color4"/>. /// Performs an explicit conversion from <see cref="Vec4"/> to <see cref="Color4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>

View File

@ -93,7 +93,7 @@ namespace math
/// Initializes a new instance of the <see cref="ColorBGRA"/> struct. /// Initializes a new instance of the <see cref="ColorBGRA"/> struct.
/// </summary> /// </summary>
/// <param name="value">The red, green, blue, and alpha components of the color.</param> /// <param name="value">The red, green, blue, and alpha components of the color.</param>
public ColorBGRA(Vector4 value) public ColorBGRA(Vec4 value)
{ {
R = ToByte(value.X); R = ToByte(value.X);
G = ToByte(value.Y); G = ToByte(value.Y);
@ -106,7 +106,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="value">The red, green, and blue components of the color.</param> /// <param name="value">The red, green, and blue components of the color.</param>
/// <param name="alpha">The alpha component of the color.</param> /// <param name="alpha">The alpha component of the color.</param>
public ColorBGRA(Vector3 value, float alpha) public ColorBGRA(Vec3 value, float alpha)
{ {
R = ToByte(value.X); R = ToByte(value.X);
G = ToByte(value.Y); G = ToByte(value.Y);
@ -243,9 +243,9 @@ namespace math
/// Converts the color into a three component vector. /// Converts the color into a three component vector.
/// </summary> /// </summary>
/// <returns>A three component vector containing the red, green, and blue components of the color.</returns> /// <returns>A three component vector containing the red, green, and blue components of the color.</returns>
public Vector3 ToVector3() public Vec3 ToVector3()
{ {
return new Vector3(R / 255.0f, G / 255.0f, B / 255.0f); return new Vec3(R / 255.0f, G / 255.0f, B / 255.0f);
} }
/// <summary> /// <summary>
@ -261,9 +261,9 @@ namespace math
/// Converts the color into a four component vector. /// Converts the color into a four component vector.
/// </summary> /// </summary>
/// <returns>A four component vector containing all four color components.</returns> /// <returns>A four component vector containing all four color components.</returns>
public Vector4 ToVector4() public Vec4 ToVector4()
{ {
return new Vector4(R / 255.0f, G / 255.0f, B / 255.0f, A / 255.0f); return new Vec4(R / 255.0f, G / 255.0f, B / 255.0f, A / 255.0f);
} }
/// <summary> /// <summary>
@ -879,23 +879,23 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="ColorBGRA"/> to <see cref="Vector3"/>. /// Performs an explicit conversion from <see cref="ColorBGRA"/> to <see cref="Vec3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(ColorBGRA value) public static explicit operator Vec3(ColorBGRA value)
{ {
return new Vector3(value.R / 255.0f, value.G / 255.0f, value.B / 255.0f); return new Vec3(value.R / 255.0f, value.G / 255.0f, value.B / 255.0f);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="ColorBGRA"/> to <see cref="Vector4"/>. /// Performs an explicit conversion from <see cref="ColorBGRA"/> to <see cref="Vec4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector4(ColorBGRA value) public static explicit operator Vec4(ColorBGRA value)
{ {
return new Vector4(value.R / 255.0f, value.G / 255.0f, value.B / 255.0f, value.A / 255.0f); return new Vec4(value.R / 255.0f, value.G / 255.0f, value.B / 255.0f, value.A / 255.0f);
} }
/// <summary> /// <summary>
@ -909,11 +909,11 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Vector3"/> to <see cref="ColorBGRA"/>. /// Performs an explicit conversion from <see cref="Vec3"/> to <see cref="ColorBGRA"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator ColorBGRA(Vector3 value) public static explicit operator ColorBGRA(Vec3 value)
{ {
return new ColorBGRA(value.X / 255.0f, value.Y / 255.0f, value.Z / 255.0f, 1.0f); return new ColorBGRA(value.X / 255.0f, value.Y / 255.0f, value.Z / 255.0f, 1.0f);
} }
@ -929,11 +929,11 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Vector4"/> to <see cref="ColorBGRA"/>. /// Performs an explicit conversion from <see cref="Vec4"/> to <see cref="ColorBGRA"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator ColorBGRA(Vector4 value) public static explicit operator ColorBGRA(Vec4 value)
{ {
return new ColorBGRA(value.X, value.Y, value.Z, value.W); return new ColorBGRA(value.X, value.Y, value.Z, value.W);
} }

View File

@ -124,7 +124,7 @@ namespace math
/// Initializes a new instance of the <see cref="math.Double3"/> struct. /// Initializes a new instance of the <see cref="math.Double3"/> struct.
/// </summary> /// </summary>
/// <param name="v">The Vector3 to construct the Double3 from.</param> /// <param name="v">The Vector3 to construct the Double3 from.</param>
public Double3(Vector3 v) public Double3(Vec3 v)
{ {
X = v.X; X = v.X;
Y = v.Y; Y = v.Y;
@ -1351,7 +1351,7 @@ namespace math
/// <returns>The equivation yaw/pitch/roll rotation</returns> /// <returns>The equivation yaw/pitch/roll rotation</returns>
public static Double3 RotationYawPitchRoll(Quaternion quaternion) public static Double3 RotationYawPitchRoll(Quaternion quaternion)
{ {
Vector3 yawPitchRoll; Vec3 yawPitchRoll;
Quaternion.RotationYawPitchRoll(ref quaternion, out yawPitchRoll.X, out yawPitchRoll.Y, out yawPitchRoll.Z); Quaternion.RotationYawPitchRoll(ref quaternion, out yawPitchRoll.X, out yawPitchRoll.Y, out yawPitchRoll.Z);
return yawPitchRoll; return yawPitchRoll;
} }
@ -1363,7 +1363,7 @@ namespace math
/// <param name="yawPitchRoll">The equivation yaw/pitch/roll rotation</param> /// <param name="yawPitchRoll">The equivation yaw/pitch/roll rotation</param>
public static void RotationYawPitchRoll(ref Quaternion quaternion, out Double3 yawPitchRoll) public static void RotationYawPitchRoll(ref Quaternion quaternion, out Double3 yawPitchRoll)
{ {
Vector3 yawPitchRollV; Vec3 yawPitchRollV;
Quaternion.RotationYawPitchRoll(ref quaternion, out yawPitchRollV.X, out yawPitchRollV.Y, out yawPitchRollV.Z); Quaternion.RotationYawPitchRoll(ref quaternion, out yawPitchRollV.X, out yawPitchRollV.Y, out yawPitchRollV.Z);
yawPitchRoll = yawPitchRollV; yawPitchRoll = yawPitchRollV;
} }
@ -1533,21 +1533,21 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="math.Double3"/> to <see cref="math.Vector3"/>. /// Performs an explicit conversion from <see cref="math.Double3"/> to <see cref="math.Vec3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(Double3 value) public static explicit operator Vec3(Double3 value)
{ {
return new Vector3((float)value.X, (float)value.Y, (float)value.Z); return new Vec3((float)value.X, (float)value.Y, (float)value.Z);
} }
/// <summary> /// <summary>
/// Performs an implicit conversion from <see cref="math.Vector3"/> to <see cref="math.Double3"/>. /// Performs an implicit conversion from <see cref="math.Vec3"/> to <see cref="math.Double3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static implicit operator Double3(Vector3 value) public static implicit operator Double3(Vec3 value)
{ {
return new Double3(value); return new Double3(value);
} }

View File

@ -154,7 +154,7 @@ namespace math
/// Initializes a new instance of the <see cref="math.Double4"/> struct. /// Initializes a new instance of the <see cref="math.Double4"/> struct.
/// </summary> /// </summary>
/// <param name="v">The Vector4 to construct the Double4 from.</param> /// <param name="v">The Vector4 to construct the Double4 from.</param>
public Double4(Vector4 v) public Double4(Vec4 v)
{ {
X = v.X; X = v.X;
Y = v.Y; Y = v.Y;
@ -1230,21 +1230,21 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="math.Double4"/> to <see cref="math.Vector4"/>. /// Performs an explicit conversion from <see cref="math.Double4"/> to <see cref="math.Vec4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector4(Double4 value) public static explicit operator Vec4(Double4 value)
{ {
return new Vector4((float)value.X, (float)value.Y, (float)value.Z, (float)value.W); return new Vec4((float)value.X, (float)value.Y, (float)value.Z, (float)value.W);
} }
/// <summary> /// <summary>
/// Performs an implicit conversion from <see cref="math.Vector4"/> to <see cref="math.Double4"/>. /// Performs an implicit conversion from <see cref="math.Vec4"/> to <see cref="math.Double4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static implicit operator Double4(Vector4 value) public static implicit operator Double4(Vec4 value)
{ {
return new Double4(value); return new Double4(value);
} }

View File

@ -161,23 +161,23 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Vector3"/> to <see cref="Half3"/>. /// Performs an explicit conversion from <see cref="Vec3"/> to <see cref="Half3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Half3(Vector3 value) public static explicit operator Half3(Vec3 value)
{ {
return new Half3((Half)value.X, (Half)value.Y, (Half)value.Z); return new Half3((Half)value.X, (Half)value.Y, (Half)value.Z);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Half3"/> to <see cref="Vector3"/>. /// Performs an explicit conversion from <see cref="Half3"/> to <see cref="Vec3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(Half3 value) public static explicit operator Vec3(Half3 value)
{ {
return new Vector3(value.X, value.Y, value.Z); return new Vec3(value.X, value.Y, value.Z);
} }
/// <summary> /// <summary>

View File

@ -147,23 +147,23 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Vector4"/> to <see cref="Half4"/>. /// Performs an explicit conversion from <see cref="Vec4"/> to <see cref="Half4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Half4(Vector4 value) public static explicit operator Half4(Vec4 value)
{ {
return new Half4((Half)value.X, (Half)value.Y, (Half)value.Z, (Half)value.W); return new Half4((Half)value.X, (Half)value.Y, (Half)value.Z, (Half)value.W);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Half4"/> to <see cref="Vector4"/>. /// Performs an explicit conversion from <see cref="Half4"/> to <see cref="Vec4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector4(Half4 value) public static explicit operator Vec4(Half4 value)
{ {
return new Vector4(value.X, value.Y, value.Z, value.W); return new Vec4(value.X, value.Y, value.Z, value.W);
} }
/// <summary> /// <summary>

View File

@ -613,13 +613,13 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="math.Int2"/> to <see cref="Vector4"/>. /// Performs an explicit conversion from <see cref="math.Int2"/> to <see cref="Vec4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector4(Int2 value) public static explicit operator Vec4(Int2 value)
{ {
return new Vector4(value.X, value.Y, 0, 0); return new Vec4(value.X, value.Y, 0, 0);
} }
/// <summary> /// <summary>

View File

@ -641,23 +641,23 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Int3"/> to <see cref="Vector3"/>. /// Performs an explicit conversion from <see cref="Int3"/> to <see cref="Vec3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(Int3 value) public static explicit operator Vec3(Int3 value)
{ {
return new Vector3(value.X, value.Y, value.Z); return new Vec3(value.X, value.Y, value.Z);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="Int3"/> to <see cref="Vector4"/>. /// Performs an explicit conversion from <see cref="Int3"/> to <see cref="Vec4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector4(Int3 value) public static explicit operator Vec4(Int3 value)
{ {
return new Vector4(value.X, value.Y, value.Z, 0); return new Vec4(value.X, value.Y, value.Z, 0);
} }
/// <summary> /// <summary>

View File

@ -557,23 +557,23 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref = "Int4" /> to <see cref = "Vector3" />. /// Performs an explicit conversion from <see cref = "Int4" /> to <see cref = "Vec3" />.
/// </summary> /// </summary>
/// <param name = "value">The value.</param> /// <param name = "value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(Int4 value) public static explicit operator Vec3(Int4 value)
{ {
return new Vector3(value.X, value.Y, value.Z); return new Vec3(value.X, value.Y, value.Z);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref = "Int4" /> to <see cref = "Vector4" />. /// Performs an explicit conversion from <see cref = "Int4" /> to <see cref = "Vec4" />.
/// </summary> /// </summary>
/// <param name = "value">The value.</param> /// <param name = "value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector4(Int4 value) public static explicit operator Vec4(Int4 value)
{ {
return new Vector4(value.X, value.Y, value.Z, value.W); return new Vec4(value.X, value.Y, value.Z, value.W);
} }
/// <summary> /// <summary>

View File

@ -626,11 +626,11 @@ namespace math
/// <param name="value">The vector to snap.</param> /// <param name="value">The vector to snap.</param>
/// <param name="gap">The interval gap.</param> /// <param name="gap">The interval gap.</param>
/// <returns>A vector which components are snapped to the nearest interval.</returns> /// <returns>A vector which components are snapped to the nearest interval.</returns>
public static Vector3 Snap(Vector3 value, float gap) public static Vec3 Snap(Vec3 value, float gap)
{ {
if (gap == 0) if (gap == 0)
return value; return value;
return new Vector3( return new Vec3(
(float)Math.Round((value.X / gap), MidpointRounding.AwayFromZero) * gap, (float)Math.Round((value.X / gap), MidpointRounding.AwayFromZero) * gap,
(float)Math.Round((value.Y / gap), MidpointRounding.AwayFromZero) * gap, (float)Math.Round((value.Y / gap), MidpointRounding.AwayFromZero) * gap,
(float)Math.Round((value.Z / gap), MidpointRounding.AwayFromZero) * gap); (float)Math.Round((value.Z / gap), MidpointRounding.AwayFromZero) * gap);
@ -642,11 +642,11 @@ namespace math
/// <param name="value">The vector to snap.</param> /// <param name="value">The vector to snap.</param>
/// <param name="gap">The interval gap.</param> /// <param name="gap">The interval gap.</param>
/// <returns>A vector which components are snapped to the nearest interval.</returns> /// <returns>A vector which components are snapped to the nearest interval.</returns>
public static Vector4 Snap(Vector4 value, float gap) public static Vec4 Snap(Vec4 value, float gap)
{ {
if (gap == 0) if (gap == 0)
return value; return value;
return new Vector4( return new Vec4(
(float)Math.Round((value.X / gap), MidpointRounding.AwayFromZero) * gap, (float)Math.Round((value.X / gap), MidpointRounding.AwayFromZero) * gap,
(float)Math.Round((value.Y / gap), MidpointRounding.AwayFromZero) * gap, (float)Math.Round((value.Y / gap), MidpointRounding.AwayFromZero) * gap,
(float)Math.Round((value.Z / gap), MidpointRounding.AwayFromZero) * gap, (float)Math.Round((value.Z / gap), MidpointRounding.AwayFromZero) * gap,

View File

@ -219,9 +219,9 @@ namespace math
/// Gets or sets the first row in the matrix; that is M11, M12, M13, and M14. /// Gets or sets the first row in the matrix; that is M11, M12, M13, and M14.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector4 Row1 public Vec4 Row1
{ {
get { return new Vector4(M11, M12, M13, M14); } get { return new Vec4(M11, M12, M13, M14); }
set { M11 = value.X; M12 = value.Y; M13 = value.Z; M14 = value.W; } set { M11 = value.X; M12 = value.Y; M13 = value.Z; M14 = value.W; }
} }
@ -229,9 +229,9 @@ namespace math
/// Gets or sets the second row in the matrix; that is M21, M22, M23, and M24. /// Gets or sets the second row in the matrix; that is M21, M22, M23, and M24.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector4 Row2 public Vec4 Row2
{ {
get { return new Vector4(M21, M22, M23, M24); } get { return new Vec4(M21, M22, M23, M24); }
set { M21 = value.X; M22 = value.Y; M23 = value.Z; M24 = value.W; } set { M21 = value.X; M22 = value.Y; M23 = value.Z; M24 = value.W; }
} }
@ -239,9 +239,9 @@ namespace math
/// Gets or sets the third row in the matrix; that is M31, M32, M33, and M34. /// Gets or sets the third row in the matrix; that is M31, M32, M33, and M34.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector4 Row3 public Vec4 Row3
{ {
get { return new Vector4(M31, M32, M33, M34); } get { return new Vec4(M31, M32, M33, M34); }
set { M31 = value.X; M32 = value.Y; M33 = value.Z; M34 = value.W; } set { M31 = value.X; M32 = value.Y; M33 = value.Z; M34 = value.W; }
} }
@ -249,9 +249,9 @@ namespace math
/// Gets or sets the fourth row in the matrix; that is M41, M42, M43, and M44. /// Gets or sets the fourth row in the matrix; that is M41, M42, M43, and M44.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector4 Row4 public Vec4 Row4
{ {
get { return new Vector4(M41, M42, M43, M44); } get { return new Vec4(M41, M42, M43, M44); }
set { M41 = value.X; M42 = value.Y; M43 = value.Z; M44 = value.W; } set { M41 = value.X; M42 = value.Y; M43 = value.Z; M44 = value.W; }
} }
@ -259,9 +259,9 @@ namespace math
/// Gets or sets the first column in the matrix; that is M11, M21, M31, and M41. /// Gets or sets the first column in the matrix; that is M11, M21, M31, and M41.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector4 Column1 public Vec4 Column1
{ {
get { return new Vector4(M11, M21, M31, M41); } get { return new Vec4(M11, M21, M31, M41); }
set { M11 = value.X; M21 = value.Y; M31 = value.Z; M41 = value.W; } set { M11 = value.X; M21 = value.Y; M31 = value.Z; M41 = value.W; }
} }
@ -269,9 +269,9 @@ namespace math
/// Gets or sets the second column in the matrix; that is M12, M22, M32, and M42. /// Gets or sets the second column in the matrix; that is M12, M22, M32, and M42.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector4 Column2 public Vec4 Column2
{ {
get { return new Vector4(M12, M22, M32, M42); } get { return new Vec4(M12, M22, M32, M42); }
set { M12 = value.X; M22 = value.Y; M32 = value.Z; M42 = value.W; } set { M12 = value.X; M22 = value.Y; M32 = value.Z; M42 = value.W; }
} }
@ -279,9 +279,9 @@ namespace math
/// Gets or sets the third column in the matrix; that is M13, M23, M33, and M43. /// Gets or sets the third column in the matrix; that is M13, M23, M33, and M43.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector4 Column3 public Vec4 Column3
{ {
get { return new Vector4(M13, M23, M33, M43); } get { return new Vec4(M13, M23, M33, M43); }
set { M13 = value.X; M23 = value.Y; M33 = value.Z; M43 = value.W; } set { M13 = value.X; M23 = value.Y; M33 = value.Z; M43 = value.W; }
} }
@ -289,9 +289,9 @@ namespace math
/// Gets or sets the fourth column in the matrix; that is M14, M24, M34, and M44. /// Gets or sets the fourth column in the matrix; that is M14, M24, M34, and M44.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector4 Column4 public Vec4 Column4
{ {
get { return new Vector4(M14, M24, M34, M44); } get { return new Vec4(M14, M24, M34, M44); }
set { M14 = value.X; M24 = value.Y; M34 = value.Z; M44 = value.W; } set { M14 = value.X; M24 = value.Y; M34 = value.Z; M44 = value.W; }
} }
@ -299,9 +299,9 @@ namespace math
/// Gets or sets the translation of the matrix; that is M41, M42, and M43. /// Gets or sets the translation of the matrix; that is M41, M42, and M43.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector3 TranslationVector public Vec3 TranslationVector
{ {
get { return new Vector3(M41, M42, M43); } get { return new Vec3(M41, M42, M43); }
set { M41 = value.X; M42 = value.Y; M43 = value.Z; } set { M41 = value.X; M42 = value.Y; M43 = value.Z; }
} }
@ -310,69 +310,69 @@ namespace math
/// </summary> /// </summary>
/// <remarks>This property does not do any computation and will return a correct scale vector only if the matrix is a scale matrix.</remarks> /// <remarks>This property does not do any computation and will return a correct scale vector only if the matrix is a scale matrix.</remarks>
[DataMemberIgnore] [DataMemberIgnore]
public Vector3 ScaleVector public Vec3 ScaleVector
{ {
get { return new Vector3(M11, M22, M33); } get { return new Vec3(M11, M22, M33); }
set { M11 = value.X; M22 = value.Y; M33 = value.Z; } set { M11 = value.X; M22 = value.Y; M33 = value.Z; }
} }
/// <summary> /// <summary>
/// Gets or sets the up <see cref="Vector3"/> of the matrix; that is M21, M22, and M23. /// Gets or sets the up <see cref="Vec3"/> of the matrix; that is M21, M22, and M23.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector3 Up public Vec3 Up
{ {
get { return new Vector3(M21, M22, M23); } get { return new Vec3(M21, M22, M23); }
set { M21 = value.X; M22 = value.Y; M23 = value.Z; } set { M21 = value.X; M22 = value.Y; M23 = value.Z; }
} }
/// <summary> /// <summary>
/// Gets or sets the down <see cref="Vector3"/> of the matrix; that is -M21, -M22, and -M23. /// Gets or sets the down <see cref="Vec3"/> of the matrix; that is -M21, -M22, and -M23.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector3 Down public Vec3 Down
{ {
get { return new Vector3(-M21, -M22, -M23); } get { return new Vec3(-M21, -M22, -M23); }
set { M21 = -value.X; M22 = -value.Y; M23 = -value.Z; } set { M21 = -value.X; M22 = -value.Y; M23 = -value.Z; }
} }
/// <summary> /// <summary>
/// Gets or sets the right <see cref="Vector3"/> of the matrix; that is M11, M12, and M13. /// Gets or sets the right <see cref="Vec3"/> of the matrix; that is M11, M12, and M13.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector3 Right public Vec3 Right
{ {
get { return new Vector3(M11, M12, M13); } get { return new Vec3(M11, M12, M13); }
set { M11 = value.X; M12 = value.Y; M13 = value.Z; } set { M11 = value.X; M12 = value.Y; M13 = value.Z; }
} }
/// <summary> /// <summary>
/// Gets or sets the left <see cref="Vector3"/> of the matrix; that is -M11, -M12, and -M13. /// Gets or sets the left <see cref="Vec3"/> of the matrix; that is -M11, -M12, and -M13.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector3 Left public Vec3 Left
{ {
get { return new Vector3(-M11, -M12, -M13); } get { return new Vec3(-M11, -M12, -M13); }
set { M11 = -value.X; M12 = -value.Y; M13 = -value.Z; } set { M11 = -value.X; M12 = -value.Y; M13 = -value.Z; }
} }
/// <summary> /// <summary>
/// Gets or sets the forward <see cref="Vector3"/> of the matrix; that is -M31, -M32, and -M33. /// Gets or sets the forward <see cref="Vec3"/> of the matrix; that is -M31, -M32, and -M33.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector3 Forward public Vec3 Forward
{ {
get { return new Vector3(-M31, -M32, -M33); } get { return new Vec3(-M31, -M32, -M33); }
set { M31 = -value.X; M32 = -value.Y; M33 = -value.Z; } set { M31 = -value.X; M32 = -value.Y; M33 = -value.Z; }
} }
/// <summary> /// <summary>
/// Gets or sets the backward <see cref="Vector3"/> of the matrix; that is M31, M32, and M33. /// Gets or sets the backward <see cref="Vec3"/> of the matrix; that is M31, M32, and M33.
/// </summary> /// </summary>
[DataMemberIgnore] [DataMemberIgnore]
public Vector3 Backward public Vec3 Backward
{ {
get { return new Vector3(M31, M32, M33); } get { return new Vec3(M31, M32, M33); }
set { M31 = value.X; M32 = value.Y; M33 = value.Z; } set { M31 = value.X; M32 = value.Y; M33 = value.Z; }
} }
@ -573,19 +573,19 @@ namespace math
Q.Transpose(); Q.Transpose();
R = new Matrix(); R = new Matrix();
R.M11 = Vector4.Dot(Q.Column1, Column1); R.M11 = Vec4.Dot(Q.Column1, Column1);
R.M12 = Vector4.Dot(Q.Column1, Column2); R.M12 = Vec4.Dot(Q.Column1, Column2);
R.M13 = Vector4.Dot(Q.Column1, Column3); R.M13 = Vec4.Dot(Q.Column1, Column3);
R.M14 = Vector4.Dot(Q.Column1, Column4); R.M14 = Vec4.Dot(Q.Column1, Column4);
R.M22 = Vector4.Dot(Q.Column2, Column2); R.M22 = Vec4.Dot(Q.Column2, Column2);
R.M23 = Vector4.Dot(Q.Column2, Column3); R.M23 = Vec4.Dot(Q.Column2, Column3);
R.M24 = Vector4.Dot(Q.Column2, Column4); R.M24 = Vec4.Dot(Q.Column2, Column4);
R.M33 = Vector4.Dot(Q.Column3, Column3); R.M33 = Vec4.Dot(Q.Column3, Column3);
R.M34 = Vector4.Dot(Q.Column3, Column4); R.M34 = Vec4.Dot(Q.Column3, Column4);
R.M44 = Vector4.Dot(Q.Column4, Column4); R.M44 = Vec4.Dot(Q.Column4, Column4);
} }
/// <summary> /// <summary>
@ -598,19 +598,19 @@ namespace math
Orthonormalize(ref this, out Q); Orthonormalize(ref this, out Q);
L = new Matrix(); L = new Matrix();
L.M11 = Vector4.Dot(Q.Row1, Row1); L.M11 = Vec4.Dot(Q.Row1, Row1);
L.M21 = Vector4.Dot(Q.Row1, Row2); L.M21 = Vec4.Dot(Q.Row1, Row2);
L.M22 = Vector4.Dot(Q.Row2, Row2); L.M22 = Vec4.Dot(Q.Row2, Row2);
L.M31 = Vector4.Dot(Q.Row1, Row3); L.M31 = Vec4.Dot(Q.Row1, Row3);
L.M32 = Vector4.Dot(Q.Row2, Row3); L.M32 = Vec4.Dot(Q.Row2, Row3);
L.M33 = Vector4.Dot(Q.Row3, Row3); L.M33 = Vec4.Dot(Q.Row3, Row3);
L.M41 = Vector4.Dot(Q.Row1, Row4); L.M41 = Vec4.Dot(Q.Row1, Row4);
L.M42 = Vector4.Dot(Q.Row2, Row4); L.M42 = Vec4.Dot(Q.Row2, Row4);
L.M43 = Vector4.Dot(Q.Row3, Row4); L.M43 = Vec4.Dot(Q.Row3, Row4);
L.M44 = Vector4.Dot(Q.Row4, Row4); L.M44 = Vec4.Dot(Q.Row4, Row4);
} }
/// <summary> /// <summary>
@ -642,7 +642,7 @@ namespace math
/// Matrix.RotationX(rotation.X) * Matrix.RotationY(rotation.Y) * Matrix.RotationZ(rotation.Z) should represent the same rotation. /// Matrix.RotationX(rotation.X) * Matrix.RotationY(rotation.Y) * Matrix.RotationZ(rotation.Z) should represent the same rotation.
/// </summary> /// </summary>
/// <param name="rotation">The vector containing the 3 rotations angles to be applied in order.</param> /// <param name="rotation">The vector containing the 3 rotations angles to be applied in order.</param>
public void DecomposeXYZ(out Vector3 rotation) public void DecomposeXYZ(out Vec3 rotation)
{ {
rotation.Y = (float)Math.Asin(-M13); rotation.Y = (float)Math.Asin(-M13);
double test = Math.Cos(rotation.Y); double test = Math.Cos(rotation.Y);
@ -665,7 +665,7 @@ namespace math
/// <param name="translation">When the method completes, contains the translation component of the decomposed matrix.</param> /// <param name="translation">When the method completes, contains the translation component of the decomposed matrix.</param>
/// <returns><c>true</c> if a rotation exist for this matrix, <c>false</c> otherwise.</returns> /// <returns><c>true</c> if a rotation exist for this matrix, <c>false</c> otherwise.</returns>
/// <remarks>This method is designed to decompose an SRT transformation matrix only.</remarks> /// <remarks>This method is designed to decompose an SRT transformation matrix only.</remarks>
public bool Decompose(out Vector3 scale, out Vector3 translation) public bool Decompose(out Vec3 scale, out Vec3 translation)
{ {
//Source: Unknown //Source: Unknown
//References: http://www.gamedev.net/community/forums/topic.asp?topic_id=441695 //References: http://www.gamedev.net/community/forums/topic.asp?topic_id=441695
@ -700,7 +700,7 @@ namespace math
/// <remarks> /// <remarks>
/// This method is designed to decompose an SRT transformation matrix only. /// This method is designed to decompose an SRT transformation matrix only.
/// </remarks> /// </remarks>
public bool Decompose(out Vector3 scale, out Quaternion rotation, out Vector3 translation) public bool Decompose(out Vec3 scale, out Quaternion rotation, out Vec3 translation)
{ {
Matrix rotationMatrix; Matrix rotationMatrix;
Decompose(out scale, out rotationMatrix, out translation); Decompose(out scale, out rotationMatrix, out translation);
@ -717,7 +717,7 @@ namespace math
/// <remarks> /// <remarks>
/// This method is designed to decompose an SRT transformation matrix only. /// This method is designed to decompose an SRT transformation matrix only.
/// </remarks> /// </remarks>
public bool Decompose(out Vector3 scale, out Matrix rotation, out Vector3 translation) public bool Decompose(out Vec3 scale, out Matrix rotation, out Vec3 translation)
{ {
//Source: Unknown //Source: Unknown
//References: http://www.gamedev.net/community/forums/topic.asp?topic_id=441695 //References: http://www.gamedev.net/community/forums/topic.asp?topic_id=441695
@ -742,9 +742,9 @@ namespace math
} }
// Calculate an perfect orthonormal matrix (no reflections) // Calculate an perfect orthonormal matrix (no reflections)
var at = new Vector3(M31 / scale.Z, M32 / scale.Z, M33 / scale.Z); var at = new Vec3(M31 / scale.Z, M32 / scale.Z, M33 / scale.Z);
var up = Vector3.Cross(at, new Vector3(M11 / scale.X, M12 / scale.X, M13 / scale.X)); var up = Vec3.Cross(at, new Vec3(M11 / scale.X, M12 / scale.X, M13 / scale.X));
var right = Vector3.Cross(up, at); var right = Vec3.Cross(up, at);
rotation = Identity; rotation = Identity;
rotation.Right = right; rotation.Right = right;
@ -752,9 +752,9 @@ namespace math
rotation.Backward = at; rotation.Backward = at;
// In case of reflexions // In case of reflexions
scale.X = Vector3.Dot(right, Right) > 0.0f ? scale.X : -scale.X; scale.X = Vec3.Dot(right, Right) > 0.0f ? scale.X : -scale.X;
scale.Y = Vector3.Dot(up, Up) > 0.0f ? scale.Y : -scale.Y; scale.Y = Vec3.Dot(up, Up) > 0.0f ? scale.Y : -scale.Y;
scale.Z = Vector3.Dot(at, Backward) > 0.0f ? scale.Z : -scale.Z; scale.Z = Vec3.Dot(at, Backward) > 0.0f ? scale.Z : -scale.Z;
return true; return true;
} }
@ -1449,14 +1449,14 @@ namespace math
//By separating the above algorithm into multiple lines, we actually increase accuracy. //By separating the above algorithm into multiple lines, we actually increase accuracy.
result = value; result = value;
result.Row2 = result.Row2 - (Vector4.Dot(result.Row1, result.Row2) / Vector4.Dot(result.Row1, result.Row1)) * result.Row1; result.Row2 = result.Row2 - (Vec4.Dot(result.Row1, result.Row2) / Vec4.Dot(result.Row1, result.Row1)) * result.Row1;
result.Row3 = result.Row3 - (Vector4.Dot(result.Row1, result.Row3) / Vector4.Dot(result.Row1, result.Row1)) * result.Row1; result.Row3 = result.Row3 - (Vec4.Dot(result.Row1, result.Row3) / Vec4.Dot(result.Row1, result.Row1)) * result.Row1;
result.Row3 = result.Row3 - (Vector4.Dot(result.Row2, result.Row3) / Vector4.Dot(result.Row2, result.Row2)) * result.Row2; result.Row3 = result.Row3 - (Vec4.Dot(result.Row2, result.Row3) / Vec4.Dot(result.Row2, result.Row2)) * result.Row2;
result.Row4 = result.Row4 - (Vector4.Dot(result.Row1, result.Row4) / Vector4.Dot(result.Row1, result.Row1)) * result.Row1; result.Row4 = result.Row4 - (Vec4.Dot(result.Row1, result.Row4) / Vec4.Dot(result.Row1, result.Row1)) * result.Row1;
result.Row4 = result.Row4 - (Vector4.Dot(result.Row2, result.Row4) / Vector4.Dot(result.Row2, result.Row2)) * result.Row2; result.Row4 = result.Row4 - (Vec4.Dot(result.Row2, result.Row4) / Vec4.Dot(result.Row2, result.Row2)) * result.Row2;
result.Row4 = result.Row4 - (Vector4.Dot(result.Row3, result.Row4) / Vector4.Dot(result.Row3, result.Row3)) * result.Row3; result.Row4 = result.Row4 - (Vec4.Dot(result.Row3, result.Row4) / Vec4.Dot(result.Row3, result.Row3)) * result.Row3;
} }
/// <summary> /// <summary>
@ -1513,19 +1513,19 @@ namespace math
//By separating the above algorithm into multiple lines, we actually increase accuracy. //By separating the above algorithm into multiple lines, we actually increase accuracy.
result = value; result = value;
result.Row1 = Vector4.Normalize(result.Row1); result.Row1 = Vec4.Normalize(result.Row1);
result.Row2 = result.Row2 - Vector4.Dot(result.Row1, result.Row2) * result.Row1; result.Row2 = result.Row2 - Vec4.Dot(result.Row1, result.Row2) * result.Row1;
result.Row2 = Vector4.Normalize(result.Row2); result.Row2 = Vec4.Normalize(result.Row2);
result.Row3 = result.Row3 - Vector4.Dot(result.Row1, result.Row3) * result.Row1; result.Row3 = result.Row3 - Vec4.Dot(result.Row1, result.Row3) * result.Row1;
result.Row3 = result.Row3 - Vector4.Dot(result.Row2, result.Row3) * result.Row2; result.Row3 = result.Row3 - Vec4.Dot(result.Row2, result.Row3) * result.Row2;
result.Row3 = Vector4.Normalize(result.Row3); result.Row3 = Vec4.Normalize(result.Row3);
result.Row4 = result.Row4 - Vector4.Dot(result.Row1, result.Row4) * result.Row1; result.Row4 = result.Row4 - Vec4.Dot(result.Row1, result.Row4) * result.Row1;
result.Row4 = result.Row4 - Vector4.Dot(result.Row2, result.Row4) * result.Row2; result.Row4 = result.Row4 - Vec4.Dot(result.Row2, result.Row4) * result.Row2;
result.Row4 = result.Row4 - Vector4.Dot(result.Row3, result.Row4) * result.Row3; result.Row4 = result.Row4 - Vec4.Dot(result.Row3, result.Row4) * result.Row3;
result.Row4 = Vector4.Normalize(result.Row4); result.Row4 = Vec4.Normalize(result.Row4);
} }
/// <summary> /// <summary>
@ -1808,7 +1808,7 @@ namespace math
/// the <paramref name="augmentResult"/> will contain the solution for the system. It is up to the user /// the <paramref name="augmentResult"/> will contain the solution for the system. It is up to the user
/// to analyze both the input and the result to determine if a solution really exists.</para> /// to analyze both the input and the result to determine if a solution really exists.</para>
/// </remarks> /// </remarks>
public static void ReducedRowEchelonForm(ref Matrix value, ref Vector4 augment, out Matrix result, out Vector4 augmentResult) public static void ReducedRowEchelonForm(ref Matrix value, ref Vec4 augment, out Matrix result, out Vec4 augmentResult)
{ {
//Source: http://rosettacode.org //Source: http://rosettacode.org
//Reference: http://rosettacode.org/wiki/Reduced_row_echelon_form //Reference: http://rosettacode.org/wiki/Reduced_row_echelon_form
@ -1924,11 +1924,11 @@ namespace math
/// <param name="cameraUpVector">The up vector of the camera.</param> /// <param name="cameraUpVector">The up vector of the camera.</param>
/// <param name="cameraForwardVector">The forward vector of the camera.</param> /// <param name="cameraForwardVector">The forward vector of the camera.</param>
/// <param name="result">When the method completes, contains the created billboard matrix.</param> /// <param name="result">When the method completes, contains the created billboard matrix.</param>
public static void Billboard(ref Vector3 objectPosition, ref Vector3 cameraPosition, ref Vector3 cameraUpVector, ref Vector3 cameraForwardVector, out Matrix result) public static void Billboard(ref Vec3 objectPosition, ref Vec3 cameraPosition, ref Vec3 cameraUpVector, ref Vec3 cameraForwardVector, out Matrix result)
{ {
Vector3 crossed; Vec3 crossed;
Vector3 final; Vec3 final;
Vector3 difference = objectPosition - cameraPosition; Vec3 difference = objectPosition - cameraPosition;
float lengthSq = difference.LengthSquared(); float lengthSq = difference.LengthSquared();
if (lengthSq < MathUtil.ZeroTolerance) if (lengthSq < MathUtil.ZeroTolerance)
@ -1936,9 +1936,9 @@ namespace math
else else
difference *= (float)(1.0 / Math.Sqrt(lengthSq)); difference *= (float)(1.0 / Math.Sqrt(lengthSq));
Vector3.Cross(ref cameraUpVector, ref difference, out crossed); Vec3.Cross(ref cameraUpVector, ref difference, out crossed);
crossed.Normalize(); crossed.Normalize();
Vector3.Cross(ref difference, ref crossed, out final); Vec3.Cross(ref difference, ref crossed, out final);
result.M11 = crossed.X; result.M11 = crossed.X;
result.M12 = crossed.Y; result.M12 = crossed.Y;
@ -1966,7 +1966,7 @@ namespace math
/// <param name="cameraUpVector">The up vector of the camera.</param> /// <param name="cameraUpVector">The up vector of the camera.</param>
/// <param name="cameraForwardVector">The forward vector of the camera.</param> /// <param name="cameraForwardVector">The forward vector of the camera.</param>
/// <returns>The created billboard matrix.</returns> /// <returns>The created billboard matrix.</returns>
public static Matrix Billboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3 cameraForwardVector) public static Matrix Billboard(Vec3 objectPosition, Vec3 cameraPosition, Vec3 cameraUpVector, Vec3 cameraForwardVector)
{ {
Matrix result; Matrix result;
Billboard(ref objectPosition, ref cameraPosition, ref cameraUpVector, ref cameraForwardVector, out result); Billboard(ref objectPosition, ref cameraPosition, ref cameraUpVector, ref cameraForwardVector, out result);
@ -1980,21 +1980,21 @@ namespace math
/// <param name="target">The camera look-at target.</param> /// <param name="target">The camera look-at target.</param>
/// <param name="up">The camera's up vector.</param> /// <param name="up">The camera's up vector.</param>
/// <param name="result">When the method completes, contains the created look-at matrix.</param> /// <param name="result">When the method completes, contains the created look-at matrix.</param>
public static void LookAtLH(ref Vector3 eye, ref Vector3 target, ref Vector3 up, out Matrix result) public static void LookAtLH(ref Vec3 eye, ref Vec3 target, ref Vec3 up, out Matrix result)
{ {
Vector3 xaxis, yaxis, zaxis; Vec3 xaxis, yaxis, zaxis;
Vector3.Subtract(ref target, ref eye, out zaxis); zaxis.Normalize(); Vec3.Subtract(ref target, ref eye, out zaxis); zaxis.Normalize();
Vector3.Cross(ref up, ref zaxis, out xaxis); xaxis.Normalize(); Vec3.Cross(ref up, ref zaxis, out xaxis); xaxis.Normalize();
Vector3.Cross(ref zaxis, ref xaxis, out yaxis); Vec3.Cross(ref zaxis, ref xaxis, out yaxis);
result = Matrix.Identity; result = Matrix.Identity;
result.M11 = xaxis.X; result.M21 = xaxis.Y; result.M31 = xaxis.Z; result.M11 = xaxis.X; result.M21 = xaxis.Y; result.M31 = xaxis.Z;
result.M12 = yaxis.X; result.M22 = yaxis.Y; result.M32 = yaxis.Z; result.M12 = yaxis.X; result.M22 = yaxis.Y; result.M32 = yaxis.Z;
result.M13 = zaxis.X; result.M23 = zaxis.Y; result.M33 = zaxis.Z; result.M13 = zaxis.X; result.M23 = zaxis.Y; result.M33 = zaxis.Z;
Vector3.Dot(ref xaxis, ref eye, out result.M41); Vec3.Dot(ref xaxis, ref eye, out result.M41);
Vector3.Dot(ref yaxis, ref eye, out result.M42); Vec3.Dot(ref yaxis, ref eye, out result.M42);
Vector3.Dot(ref zaxis, ref eye, out result.M43); Vec3.Dot(ref zaxis, ref eye, out result.M43);
result.M41 = -result.M41; result.M41 = -result.M41;
result.M42 = -result.M42; result.M42 = -result.M42;
@ -2008,7 +2008,7 @@ namespace math
/// <param name="target">The camera look-at target.</param> /// <param name="target">The camera look-at target.</param>
/// <param name="up">The camera's up vector.</param> /// <param name="up">The camera's up vector.</param>
/// <returns>The created look-at matrix.</returns> /// <returns>The created look-at matrix.</returns>
public static Matrix LookAtLH(Vector3 eye, Vector3 target, Vector3 up) public static Matrix LookAtLH(Vec3 eye, Vec3 target, Vec3 up)
{ {
Matrix result; Matrix result;
LookAtLH(ref eye, ref target, ref up, out result); LookAtLH(ref eye, ref target, ref up, out result);
@ -2022,21 +2022,21 @@ namespace math
/// <param name="target">The camera look-at target.</param> /// <param name="target">The camera look-at target.</param>
/// <param name="up">The camera's up vector.</param> /// <param name="up">The camera's up vector.</param>
/// <param name="result">When the method completes, contains the created look-at matrix.</param> /// <param name="result">When the method completes, contains the created look-at matrix.</param>
public static void LookAtRH(ref Vector3 eye, ref Vector3 target, ref Vector3 up, out Matrix result) public static void LookAtRH(ref Vec3 eye, ref Vec3 target, ref Vec3 up, out Matrix result)
{ {
Vector3 xaxis, yaxis, zaxis; Vec3 xaxis, yaxis, zaxis;
Vector3.Subtract(ref eye, ref target, out zaxis); zaxis.Normalize(); Vec3.Subtract(ref eye, ref target, out zaxis); zaxis.Normalize();
Vector3.Cross(ref up, ref zaxis, out xaxis); xaxis.Normalize(); Vec3.Cross(ref up, ref zaxis, out xaxis); xaxis.Normalize();
Vector3.Cross(ref zaxis, ref xaxis, out yaxis); Vec3.Cross(ref zaxis, ref xaxis, out yaxis);
result = Matrix.Identity; result = Matrix.Identity;
result.M11 = xaxis.X; result.M21 = xaxis.Y; result.M31 = xaxis.Z; result.M11 = xaxis.X; result.M21 = xaxis.Y; result.M31 = xaxis.Z;
result.M12 = yaxis.X; result.M22 = yaxis.Y; result.M32 = yaxis.Z; result.M12 = yaxis.X; result.M22 = yaxis.Y; result.M32 = yaxis.Z;
result.M13 = zaxis.X; result.M23 = zaxis.Y; result.M33 = zaxis.Z; result.M13 = zaxis.X; result.M23 = zaxis.Y; result.M33 = zaxis.Z;
Vector3.Dot(ref xaxis, ref eye, out result.M41); Vec3.Dot(ref xaxis, ref eye, out result.M41);
Vector3.Dot(ref yaxis, ref eye, out result.M42); Vec3.Dot(ref yaxis, ref eye, out result.M42);
Vector3.Dot(ref zaxis, ref eye, out result.M43); Vec3.Dot(ref zaxis, ref eye, out result.M43);
result.M41 = -result.M41; result.M41 = -result.M41;
result.M42 = -result.M42; result.M42 = -result.M42;
@ -2050,7 +2050,7 @@ namespace math
/// <param name="target">The camera look-at target.</param> /// <param name="target">The camera look-at target.</param>
/// <param name="up">The camera's up vector.</param> /// <param name="up">The camera's up vector.</param>
/// <returns>The created look-at matrix.</returns> /// <returns>The created look-at matrix.</returns>
public static Matrix LookAtRH(Vector3 eye, Vector3 target, Vector3 up) public static Matrix LookAtRH(Vec3 eye, Vec3 target, Vec3 up)
{ {
Matrix result; Matrix result;
LookAtRH(ref eye, ref target, ref up, out result); LookAtRH(ref eye, ref target, ref up, out result);
@ -2450,7 +2450,7 @@ namespace math
/// W component is 1, the light is a point light.</param> /// W component is 1, the light is a point light.</param>
/// <param name="plane">The plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized.</param> /// <param name="plane">The plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized.</param>
/// <param name="result">When the method completes, contains the shadow matrix.</param> /// <param name="result">When the method completes, contains the shadow matrix.</param>
public static void Shadow(ref Vector4 light, ref Plane plane, out Matrix result) public static void Shadow(ref Vec4 light, ref Plane plane, out Matrix result)
{ {
float dot = (plane.Normal.X * light.X) + (plane.Normal.Y * light.Y) + (plane.Normal.Z * light.Z) + (plane.D * light.W); float dot = (plane.Normal.X * light.X) + (plane.Normal.Y * light.Y) + (plane.Normal.Z * light.Z) + (plane.D * light.W);
float x = -plane.Normal.X; float x = -plane.Normal.X;
@ -2483,7 +2483,7 @@ namespace math
/// W component is 1, the light is a point light.</param> /// W component is 1, the light is a point light.</param>
/// <param name="plane">The plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized.</param> /// <param name="plane">The plane onto which to project the geometry as a shadow. This parameter is assumed to be normalized.</param>
/// <returns>The shadow matrix.</returns> /// <returns>The shadow matrix.</returns>
public static Matrix Shadow(Vector4 light, Plane plane) public static Matrix Shadow(Vec4 light, Plane plane)
{ {
Matrix result; Matrix result;
Shadow(ref light, ref plane, out result); Shadow(ref light, ref plane, out result);
@ -2495,7 +2495,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="scale">Scaling factor for all three axes.</param> /// <param name="scale">Scaling factor for all three axes.</param>
/// <param name="result">When the method completes, contains the created scaling matrix.</param> /// <param name="result">When the method completes, contains the created scaling matrix.</param>
public static void Scaling(ref Vector3 scale, out Matrix result) public static void Scaling(ref Vec3 scale, out Matrix result)
{ {
Scaling(scale.X, scale.Y, scale.Z, out result); Scaling(scale.X, scale.Y, scale.Z, out result);
} }
@ -2505,7 +2505,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="scale">Scaling factor for all three axes.</param> /// <param name="scale">Scaling factor for all three axes.</param>
/// <returns>The created scaling matrix.</returns> /// <returns>The created scaling matrix.</returns>
public static Matrix Scaling(Vector3 scale) public static Matrix Scaling(Vec3 scale)
{ {
Matrix result; Matrix result;
Scaling(ref scale, out result); Scaling(ref scale, out result);
@ -2657,7 +2657,7 @@ namespace math
/// <param name="axis">The axis around which to rotate. This parameter is assumed to be normalized.</param> /// <param name="axis">The axis around which to rotate. This parameter is assumed to be normalized.</param>
/// <param name="angle">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.</param> /// <param name="angle">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.</param>
/// <param name="result">When the method completes, contains the created rotation matrix.</param> /// <param name="result">When the method completes, contains the created rotation matrix.</param>
public static void RotationAxis(ref Vector3 axis, float angle, out Matrix result) public static void RotationAxis(ref Vec3 axis, float angle, out Matrix result)
{ {
float x = axis.X; float x = axis.X;
float y = axis.Y; float y = axis.Y;
@ -2689,7 +2689,7 @@ namespace math
/// <param name="axis">The axis around which to rotate. This parameter is assumed to be normalized.</param> /// <param name="axis">The axis around which to rotate. This parameter is assumed to be normalized.</param>
/// <param name="angle">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.</param> /// <param name="angle">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.</param>
/// <returns>The created rotation matrix.</returns> /// <returns>The created rotation matrix.</returns>
public static Matrix RotationAxis(Vector3 axis, float angle) public static Matrix RotationAxis(Vec3 axis, float angle)
{ {
Matrix result; Matrix result;
RotationAxis(ref axis, angle, out result); RotationAxis(ref axis, angle, out result);
@ -2732,7 +2732,7 @@ namespace math
/// <param name="rotation">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.</param> /// <param name="rotation">Angle of rotation in radians. Angles are measured clockwise when looking along the rotation axis toward the origin.</param>
/// <param name="translation">The translation.</param> /// <param name="translation">The translation.</param>
/// <param name="result">When the method completes, contains the created rotation matrix.</param> /// <param name="result">When the method completes, contains the created rotation matrix.</param>
public static void Transformation(ref Vector3 scaling, ref Quaternion rotation, ref Vector3 translation, out Matrix result) public static void Transformation(ref Vec3 scaling, ref Quaternion rotation, ref Vec3 translation, out Matrix result)
{ {
// Equivalent to: // Equivalent to:
//result = //result =
@ -2839,7 +2839,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="value">The offset for all three coordinate planes.</param> /// <param name="value">The offset for all three coordinate planes.</param>
/// <param name="result">When the method completes, contains the created translation matrix.</param> /// <param name="result">When the method completes, contains the created translation matrix.</param>
public static void Translation(ref Vector3 value, out Matrix result) public static void Translation(ref Vec3 value, out Matrix result)
{ {
Translation(value.X, value.Y, value.Z, out result); Translation(value.X, value.Y, value.Z, out result);
} }
@ -2849,7 +2849,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="value">The offset for all three coordinate planes.</param> /// <param name="value">The offset for all three coordinate planes.</param>
/// <returns>The created translation matrix.</returns> /// <returns>The created translation matrix.</returns>
public static Matrix Translation(Vector3 value) public static Matrix Translation(Vec3 value)
{ {
Matrix result; Matrix result;
Translation(ref value, out result); Translation(ref value, out result);
@ -2892,7 +2892,7 @@ namespace math
/// <param name="rotation">The rotation of the transformation.</param> /// <param name="rotation">The rotation of the transformation.</param>
/// <param name="translation">The translation factor of the transformation.</param> /// <param name="translation">The translation factor of the transformation.</param>
/// <param name="result">When the method completes, contains the created affine transformation matrix.</param> /// <param name="result">When the method completes, contains the created affine transformation matrix.</param>
public static void AffineTransformation(float scaling, ref Quaternion rotation, ref Vector3 translation, out Matrix result) public static void AffineTransformation(float scaling, ref Quaternion rotation, ref Vec3 translation, out Matrix result)
{ {
result = Scaling(scaling) * RotationQuaternion(rotation) * Translation(translation); result = Scaling(scaling) * RotationQuaternion(rotation) * Translation(translation);
} }
@ -2904,7 +2904,7 @@ namespace math
/// <param name="rotation">The rotation of the transformation.</param> /// <param name="rotation">The rotation of the transformation.</param>
/// <param name="translation">The translation factor of the transformation.</param> /// <param name="translation">The translation factor of the transformation.</param>
/// <returns>The created affine transformation matrix.</returns> /// <returns>The created affine transformation matrix.</returns>
public static Matrix AffineTransformation(float scaling, Quaternion rotation, Vector3 translation) public static Matrix AffineTransformation(float scaling, Quaternion rotation, Vec3 translation)
{ {
Matrix result; Matrix result;
AffineTransformation(scaling, ref rotation, ref translation, out result); AffineTransformation(scaling, ref rotation, ref translation, out result);
@ -2919,7 +2919,7 @@ namespace math
/// <param name="rotation">The rotation of the transformation.</param> /// <param name="rotation">The rotation of the transformation.</param>
/// <param name="translation">The translation factor of the transformation.</param> /// <param name="translation">The translation factor of the transformation.</param>
/// <param name="result">When the method completes, contains the created affine transformation matrix.</param> /// <param name="result">When the method completes, contains the created affine transformation matrix.</param>
public static void AffineTransformation(float scaling, ref Vector3 rotationCenter, ref Quaternion rotation, ref Vector3 translation, out Matrix result) public static void AffineTransformation(float scaling, ref Vec3 rotationCenter, ref Quaternion rotation, ref Vec3 translation, out Matrix result)
{ {
result = Scaling(scaling) * Translation(-rotationCenter) * RotationQuaternion(rotation) * result = Scaling(scaling) * Translation(-rotationCenter) * RotationQuaternion(rotation) *
Translation(rotationCenter) * Translation(translation); Translation(rotationCenter) * Translation(translation);
@ -2933,7 +2933,7 @@ namespace math
/// <param name="rotation">The rotation of the transformation.</param> /// <param name="rotation">The rotation of the transformation.</param>
/// <param name="translation">The translation factor of the transformation.</param> /// <param name="translation">The translation factor of the transformation.</param>
/// <returns>The created affine transformation matrix.</returns> /// <returns>The created affine transformation matrix.</returns>
public static Matrix AffineTransformation(float scaling, Vector3 rotationCenter, Quaternion rotation, Vector3 translation) public static Matrix AffineTransformation(float scaling, Vec3 rotationCenter, Quaternion rotation, Vec3 translation)
{ {
Matrix result; Matrix result;
AffineTransformation(scaling, ref rotationCenter, ref rotation, ref translation, out result); AffineTransformation(scaling, ref rotationCenter, ref rotation, ref translation, out result);
@ -2949,7 +2949,7 @@ namespace math
/// <param name="result">When the method completes, contains the created affine transformation matrix.</param> /// <param name="result">When the method completes, contains the created affine transformation matrix.</param>
public static void AffineTransformation2D(float scaling, float rotation, ref Vec2 translation, out Matrix result) public static void AffineTransformation2D(float scaling, float rotation, ref Vec2 translation, out Matrix result)
{ {
result = Scaling(scaling, scaling, 1.0f) * RotationZ(rotation) * Translation((Vector3)translation); result = Scaling(scaling, scaling, 1.0f) * RotationZ(rotation) * Translation((Vec3)translation);
} }
/// <summary> /// <summary>
@ -2976,8 +2976,8 @@ namespace math
/// <param name="result">When the method completes, contains the created affine transformation matrix.</param> /// <param name="result">When the method completes, contains the created affine transformation matrix.</param>
public static void AffineTransformation2D(float scaling, ref Vec2 rotationCenter, float rotation, ref Vec2 translation, out Matrix result) public static void AffineTransformation2D(float scaling, ref Vec2 rotationCenter, float rotation, ref Vec2 translation, out Matrix result)
{ {
result = Scaling(scaling, scaling, 1.0f) * Translation((Vector3)(-rotationCenter)) * RotationZ(rotation) * result = Scaling(scaling, scaling, 1.0f) * Translation((Vec3)(-rotationCenter)) * RotationZ(rotation) *
Translation((Vector3)rotationCenter) * Translation((Vector3)translation); Translation((Vec3)rotationCenter) * Translation((Vec3)translation);
} }
/// <summary> /// <summary>
@ -3005,7 +3005,7 @@ namespace math
/// <param name="rotation">The rotation of the transformation.</param> /// <param name="rotation">The rotation of the transformation.</param>
/// <param name="translation">The translation factor of the transformation.</param> /// <param name="translation">The translation factor of the transformation.</param>
/// <param name="result">When the method completes, contains the created transformation matrix.</param> /// <param name="result">When the method completes, contains the created transformation matrix.</param>
public static void Transformation(ref Vector3 scalingCenter, ref Quaternion scalingRotation, ref Vector3 scaling, ref Vector3 rotationCenter, ref Quaternion rotation, ref Vector3 translation, out Matrix result) public static void Transformation(ref Vec3 scalingCenter, ref Quaternion scalingRotation, ref Vec3 scaling, ref Vec3 rotationCenter, ref Quaternion rotation, ref Vec3 translation, out Matrix result)
{ {
Matrix sr = RotationQuaternion(scalingRotation); Matrix sr = RotationQuaternion(scalingRotation);
@ -3023,7 +3023,7 @@ namespace math
/// <param name="rotation">The rotation of the transformation.</param> /// <param name="rotation">The rotation of the transformation.</param>
/// <param name="translation">The translation factor of the transformation.</param> /// <param name="translation">The translation factor of the transformation.</param>
/// <returns>The created transformation matrix.</returns> /// <returns>The created transformation matrix.</returns>
public static Matrix Transformation(Vector3 scalingCenter, Quaternion scalingRotation, Vector3 scaling, Vector3 rotationCenter, Quaternion rotation, Vector3 translation) public static Matrix Transformation(Vec3 scalingCenter, Quaternion scalingRotation, Vec3 scaling, Vec3 rotationCenter, Quaternion rotation, Vec3 translation)
{ {
Matrix result; Matrix result;
Transformation(ref scalingCenter, ref scalingRotation, ref scaling, ref rotationCenter, ref rotation, ref translation, out result); Transformation(ref scalingCenter, ref scalingRotation, ref scaling, ref rotationCenter, ref rotation, ref translation, out result);
@ -3042,8 +3042,8 @@ namespace math
/// <param name="result">When the method completes, contains the created transformation matrix.</param> /// <param name="result">When the method completes, contains the created transformation matrix.</param>
public static void Transformation2D(ref Vec2 scalingCenter, float scalingRotation, ref Vec2 scaling, ref Vec2 rotationCenter, float rotation, ref Vec2 translation, out Matrix result) public static void Transformation2D(ref Vec2 scalingCenter, float scalingRotation, ref Vec2 scaling, ref Vec2 rotationCenter, float rotation, ref Vec2 translation, out Matrix result)
{ {
result = Translation((Vector3)(-scalingCenter)) * RotationZ(-scalingRotation) * Scaling((Vector3)scaling) * RotationZ(scalingRotation) * Translation((Vector3)scalingCenter) * result = Translation((Vec3)(-scalingCenter)) * RotationZ(-scalingRotation) * Scaling((Vec3)scaling) * RotationZ(scalingRotation) * Translation((Vec3)scalingCenter) *
Translation((Vector3)(-rotationCenter)) * RotationZ(rotation) * Translation((Vector3)rotationCenter) * Translation((Vector3)translation); Translation((Vec3)(-rotationCenter)) * RotationZ(rotation) * Translation((Vec3)rotationCenter) * Translation((Vec3)translation);
result.M33 = 1f; result.M33 = 1f;
result.M44 = 1f; result.M44 = 1f;

View File

@ -43,7 +43,7 @@ namespace math
/// <summary> /// <summary>
/// The normal vector of the plane. /// The normal vector of the plane.
/// </summary> /// </summary>
public Vector3 Normal; public Vec3 Normal;
/// <summary> /// <summary>
/// The distance of the plane along its normal from the origin. /// The distance of the plane along its normal from the origin.
@ -79,10 +79,10 @@ namespace math
/// </summary> /// </summary>
/// <param name="point">Any point that lies along the plane.</param> /// <param name="point">Any point that lies along the plane.</param>
/// <param name="normal">The normal vector to the plane.</param> /// <param name="normal">The normal vector to the plane.</param>
public Plane(Vector3 point, Vector3 normal) public Plane(Vec3 point, Vec3 normal)
{ {
this.Normal = normal; this.Normal = normal;
this.D = Vector3.Dot(normal, point); this.D = Vec3.Dot(normal, point);
} }
/// <summary> /// <summary>
@ -90,7 +90,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="value">The normal of the plane.</param> /// <param name="value">The normal of the plane.</param>
/// <param name="d">The distance of the plane along its normal from the origin</param> /// <param name="d">The distance of the plane along its normal from the origin</param>
public Plane(Vector3 value, float d) public Plane(Vec3 value, float d)
{ {
Normal = value; Normal = value;
D = d; D = d;
@ -102,7 +102,7 @@ namespace math
/// <param name="point1">First point of a triangle defining the plane.</param> /// <param name="point1">First point of a triangle defining the plane.</param>
/// <param name="point2">Second point of a triangle defining the plane.</param> /// <param name="point2">Second point of a triangle defining the plane.</param>
/// <param name="point3">Third point of a triangle defining the plane.</param> /// <param name="point3">Third point of a triangle defining the plane.</param>
public Plane(Vector3 point1, Vector3 point2, Vector3 point3) public Plane(Vec3 point1, Vec3 point2, Vec3 point3)
{ {
float x1 = point2.X - point1.X; float x1 = point2.X - point1.X;
float y1 = point2.Y - point1.Y; float y1 = point2.Y - point1.Y;
@ -213,7 +213,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public PlaneIntersectionType Intersects(ref Vector3 point) public PlaneIntersectionType Intersects(ref Vec3 point)
{ {
return CollisionHelper.PlaneIntersectsPoint(ref this, ref point); return CollisionHelper.PlaneIntersectsPoint(ref this, ref point);
} }
@ -246,9 +246,9 @@ namespace math
/// </summary> /// </summary>
/// <param name="ray">The ray to test.</param> /// <param name="ray">The ray to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Ray ray, out Vector3 point) public bool Intersects(ref Ray ray, out Vec3 point)
{ {
return CollisionHelper.RayIntersectsPlane(ref ray, ref this, out point); return CollisionHelper.RayIntersectsPlane(ref ray, ref this, out point);
} }
@ -282,7 +282,7 @@ namespace math
/// <param name="vertex2">The second vertex of the triagnle to test.</param> /// <param name="vertex2">The second vertex of the triagnle to test.</param>
/// <param name="vertex3">The third vertex of the triangle to test.</param> /// <param name="vertex3">The third vertex of the triangle to test.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public PlaneIntersectionType Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3) public PlaneIntersectionType Intersects(ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3)
{ {
return CollisionHelper.PlaneIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3); return CollisionHelper.PlaneIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3);
} }
@ -338,7 +338,7 @@ namespace math
/// <param name="left">The source plane.</param> /// <param name="left">The source plane.</param>
/// <param name="right">The source vector.</param> /// <param name="right">The source vector.</param>
/// <param name="result">When the method completes, contains the dot product of the specified plane and vector.</param> /// <param name="result">When the method completes, contains the dot product of the specified plane and vector.</param>
public static void Dot(ref Plane left, ref Vector4 right, out float result) public static void Dot(ref Plane left, ref Vec4 right, out float result)
{ {
result = (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z) + (left.D * right.W); result = (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z) + (left.D * right.W);
} }
@ -349,7 +349,7 @@ namespace math
/// <param name="left">The source plane.</param> /// <param name="left">The source plane.</param>
/// <param name="right">The source vector.</param> /// <param name="right">The source vector.</param>
/// <returns>The dot product of the specified plane and vector.</returns> /// <returns>The dot product of the specified plane and vector.</returns>
public static float Dot(Plane left, Vector4 right) public static float Dot(Plane left, Vec4 right)
{ {
return (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z) + (left.D * right.W); return (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z) + (left.D * right.W);
} }
@ -360,7 +360,7 @@ namespace math
/// <param name="left">The source plane.</param> /// <param name="left">The source plane.</param>
/// <param name="right">The source vector.</param> /// <param name="right">The source vector.</param>
/// <param name="result">When the method completes, contains the dot product of a specified vector and the normal of the Plane plus the distance value of the plane.</param> /// <param name="result">When the method completes, contains the dot product of a specified vector and the normal of the Plane plus the distance value of the plane.</param>
public static void DotCoordinate(ref Plane left, ref Vector3 right, out float result) public static void DotCoordinate(ref Plane left, ref Vec3 right, out float result)
{ {
result = (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z) + left.D; result = (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z) + left.D;
} }
@ -371,7 +371,7 @@ namespace math
/// <param name="left">The source plane.</param> /// <param name="left">The source plane.</param>
/// <param name="right">The source vector.</param> /// <param name="right">The source vector.</param>
/// <returns>The dot product of a specified vector and the normal of the Plane plus the distance value of the plane.</returns> /// <returns>The dot product of a specified vector and the normal of the Plane plus the distance value of the plane.</returns>
public static float DotCoordinate(Plane left, Vector3 right) public static float DotCoordinate(Plane left, Vec3 right)
{ {
return (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z) + left.D; return (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z) + left.D;
} }
@ -382,7 +382,7 @@ namespace math
/// <param name="left">The source plane.</param> /// <param name="left">The source plane.</param>
/// <param name="right">The source vector.</param> /// <param name="right">The source vector.</param>
/// <param name="result">When the method completes, contains the dot product of the specified vector and the normal of the plane.</param> /// <param name="result">When the method completes, contains the dot product of the specified vector and the normal of the plane.</param>
public static void DotNormal(ref Plane left, ref Vector3 right, out float result) public static void DotNormal(ref Plane left, ref Vec3 right, out float result)
{ {
result = (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z); result = (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z);
} }
@ -393,7 +393,7 @@ namespace math
/// <param name="left">The source plane.</param> /// <param name="left">The source plane.</param>
/// <param name="right">The source vector.</param> /// <param name="right">The source vector.</param>
/// <returns>The dot product of the specified vector and the normal of the plane.</returns> /// <returns>The dot product of the specified vector and the normal of the plane.</returns>
public static float DotNormal(Plane left, Vector3 right) public static float DotNormal(Plane left, Vec3 right)
{ {
return (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z); return (left.Normal.X * right.X) + (left.Normal.Y * right.Y) + (left.Normal.Z * right.Z);
} }
@ -404,14 +404,14 @@ namespace math
/// <param name="plane">The plane to project the point to.</param> /// <param name="plane">The plane to project the point to.</param>
/// <param name="point">The point to project.</param> /// <param name="point">The point to project.</param>
/// <param name="result">The projected point.</param> /// <param name="result">The projected point.</param>
public static void Project(ref Plane plane, ref Vector3 point, out Vector3 result) public static void Project(ref Plane plane, ref Vec3 point, out Vec3 result)
{ {
float distance; float distance;
DotCoordinate(ref plane, ref point, out distance); DotCoordinate(ref plane, ref point, out distance);
// compute: point - distance * plane.Normal // compute: point - distance * plane.Normal
Vector3.Multiply(ref plane.Normal, distance, out result); Vec3.Multiply(ref plane.Normal, distance, out result);
Vector3.Subtract(ref point, ref result, out result); Vec3.Subtract(ref point, ref result, out result);
} }
/// <summary> /// <summary>
@ -420,9 +420,9 @@ namespace math
/// <param name="plane">The plane to project the point to.</param> /// <param name="plane">The plane to project the point to.</param>
/// <param name="point">The point to project.</param> /// <param name="point">The point to project.</param>
/// <returns>The projected point.</returns> /// <returns>The projected point.</returns>
public static Vector3 Project(Plane plane, Vector3 point) public static Vec3 Project(Plane plane, Vec3 point)
{ {
Vector3 result; Vec3 result;
Project(ref plane, ref point, out result); Project(ref plane, ref point, out result);
return result; return result;
} }
@ -762,11 +762,11 @@ namespace math
} }
/// <summary> /// <summary>
/// Determines whether the specified <see cref="math.Vector4"/> is equal to this instance. /// Determines whether the specified <see cref="math.Vec4"/> is equal to this instance.
/// </summary> /// </summary>
/// <param name="value">The <see cref="math.Vector4"/> to compare with this instance.</param> /// <param name="value">The <see cref="math.Vec4"/> to compare with this instance.</param>
/// <returns> /// <returns>
/// <c>true</c> if the specified <see cref="math.Vector4"/> is equal to this instance; otherwise, <c>false</c>. /// <c>true</c> if the specified <see cref="math.Vec4"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns> /// </returns>
public bool Equals(Plane value) public bool Equals(Plane value)
{ {

View File

@ -97,7 +97,7 @@ namespace math
/// Initializes a new instance of the <see cref="math.Quaternion"/> struct. /// Initializes a new instance of the <see cref="math.Quaternion"/> struct.
/// </summary> /// </summary>
/// <param name="value">A vector containing the values with which to initialize the components.</param> /// <param name="value">A vector containing the values with which to initialize the components.</param>
public Quaternion(Vector4 value) public Quaternion(Vec4 value)
{ {
X = value.X; X = value.X;
Y = value.Y; Y = value.Y;
@ -110,7 +110,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="value">A vector containing the values with which to initialize the X, Y, and Z components.</param> /// <param name="value">A vector containing the values with which to initialize the X, Y, and Z components.</param>
/// <param name="w">Initial value for the W component of the quaternion.</param> /// <param name="w">Initial value for the W component of the quaternion.</param>
public Quaternion(Vector3 value, float w) public Quaternion(Vec3 value, float w)
{ {
X = value.X; X = value.X;
Y = value.Y; Y = value.Y;
@ -205,27 +205,27 @@ namespace math
/// Gets the axis components of the quaternion. /// Gets the axis components of the quaternion.
/// </summary> /// </summary>
/// <value>The axis components of the quaternion.</value> /// <value>The axis components of the quaternion.</value>
public Vector3 Axis public Vec3 Axis
{ {
get get
{ {
float length = (X * X) + (Y * Y) + (Z * Z); float length = (X * X) + (Y * Y) + (Z * Z);
if (length < MathUtil.ZeroTolerance) if (length < MathUtil.ZeroTolerance)
return Vector3.UnitX; return Vec3.UnitX;
float inv = 1.0f / length; float inv = 1.0f / length;
return new Vector3(X * inv, Y * inv, Z * inv); return new Vec3(X * inv, Y * inv, Z * inv);
} }
} }
/// <summary> /// <summary>
/// Gets yaw/pitch/roll equivalent of the quaternion /// Gets yaw/pitch/roll equivalent of the quaternion
/// </summary> /// </summary>
public Vector3 YawPitchRoll public Vec3 YawPitchRoll
{ {
get get
{ {
Vector3 yawPitchRoll; Vec3 yawPitchRoll;
RotationYawPitchRoll(ref this, out yawPitchRoll.X, out yawPitchRoll.Y, out yawPitchRoll.Z); RotationYawPitchRoll(ref this, out yawPitchRoll.X, out yawPitchRoll.Y, out yawPitchRoll.Z);
return yawPitchRoll; return yawPitchRoll;
} }
@ -750,7 +750,7 @@ namespace math
/// Rotates a Vector3 by the specified quaternion rotation. /// Rotates a Vector3 by the specified quaternion rotation.
/// </summary> /// </summary>
/// <param name="vector">The vector to rotate.</param> /// <param name="vector">The vector to rotate.</param>
public void Rotate(ref Vector3 vector) public void Rotate(ref Vec3 vector)
{ {
var pureQuaternion = new Quaternion(vector, 0); var pureQuaternion = new Quaternion(vector, 0);
pureQuaternion = Conjugate(this) * pureQuaternion * this; pureQuaternion = Conjugate(this) * pureQuaternion * this;
@ -766,10 +766,10 @@ namespace math
/// <param name="axis">The axis of rotation.</param> /// <param name="axis">The axis of rotation.</param>
/// <param name="angle">The angle of rotation.</param> /// <param name="angle">The angle of rotation.</param>
/// <param name="result">When the method completes, contains the newly created quaternion.</param> /// <param name="result">When the method completes, contains the newly created quaternion.</param>
public static void RotationAxis(ref Vector3 axis, float angle, out Quaternion result) public static void RotationAxis(ref Vec3 axis, float angle, out Quaternion result)
{ {
Vector3 normalized; Vec3 normalized;
Vector3.Normalize(ref axis, out normalized); Vec3.Normalize(ref axis, out normalized);
float half = angle * 0.5f; float half = angle * 0.5f;
float sin = (float)Math.Sin(half); float sin = (float)Math.Sin(half);
@ -787,7 +787,7 @@ namespace math
/// <param name="axis">The axis of rotation.</param> /// <param name="axis">The axis of rotation.</param>
/// <param name="angle">The angle of rotation.</param> /// <param name="angle">The angle of rotation.</param>
/// <returns>The newly created quaternion.</returns> /// <returns>The newly created quaternion.</returns>
public static Quaternion RotationAxis(Vector3 axis, float angle) public static Quaternion RotationAxis(Vec3 axis, float angle)
{ {
Quaternion result; Quaternion result;
RotationAxis(ref axis, angle, out result); RotationAxis(ref axis, angle, out result);
@ -1015,7 +1015,7 @@ namespace math
/// <param name="source">The source vector of the transformation.</param> /// <param name="source">The source vector of the transformation.</param>
/// <param name="target">The target vector of the transformation.</param> /// <param name="target">The target vector of the transformation.</param>
/// <returns>The resulting quaternion corresponding to the transformation of the source vector to the target vector.</returns> /// <returns>The resulting quaternion corresponding to the transformation of the source vector to the target vector.</returns>
public static Quaternion BetweenDirections(Vector3 source, Vector3 target) public static Quaternion BetweenDirections(Vec3 source, Vec3 target)
{ {
Quaternion result; Quaternion result;
BetweenDirections(ref source, ref target, out result); BetweenDirections(ref source, ref target, out result);
@ -1028,10 +1028,10 @@ namespace math
/// <param name="source">The source vector of the transformation.</param> /// <param name="source">The source vector of the transformation.</param>
/// <param name="target">The target vector of the transformation.</param> /// <param name="target">The target vector of the transformation.</param>
/// <param name="result">The resulting quaternion corresponding to the transformation of the source vector to the target vector.</param> /// <param name="result">The resulting quaternion corresponding to the transformation of the source vector to the target vector.</param>
public static void BetweenDirections(ref Vector3 source, ref Vector3 target, out Quaternion result) public static void BetweenDirections(ref Vec3 source, ref Vec3 target, out Quaternion result)
{ {
var norms = (float)Math.Sqrt(source.LengthSquared() * target.LengthSquared()); var norms = (float)Math.Sqrt(source.LengthSquared() * target.LengthSquared());
var real = norms + Vector3.Dot(source, target); var real = norms + Vec3.Dot(source, target);
if (real < MathUtil.ZeroTolerance * norms) if (real < MathUtil.ZeroTolerance * norms)
{ {
// If source and target are exactly opposite, rotate 180 degrees around an arbitrary orthogonal axis. // If source and target are exactly opposite, rotate 180 degrees around an arbitrary orthogonal axis.
@ -1043,7 +1043,7 @@ namespace math
else else
{ {
// Otherwise, build quaternion the standard way. // Otherwise, build quaternion the standard way.
var axis = Vector3.Cross(source, target); var axis = Vec3.Cross(source, target);
result = new Quaternion(axis, real); result = new Quaternion(axis, real);
} }
result.Normalize(); result.Normalize();

View File

@ -43,19 +43,19 @@ namespace math
/// <summary> /// <summary>
/// The position in three dimensional space where the ray starts. /// The position in three dimensional space where the ray starts.
/// </summary> /// </summary>
public Vector3 Position; public Vec3 Position;
/// <summary> /// <summary>
/// The normalized direction in which the ray points. /// The normalized direction in which the ray points.
/// </summary> /// </summary>
public Vector3 Direction; public Vec3 Direction;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="math.Ray"/> struct. /// Initializes a new instance of the <see cref="math.Ray"/> struct.
/// </summary> /// </summary>
/// <param name="position">The position in three dimensional space of the origin of the ray.</param> /// <param name="position">The position in three dimensional space of the origin of the ray.</param>
/// <param name="direction">The normalized direction of the ray.</param> /// <param name="direction">The normalized direction of the ray.</param>
public Ray(Vector3 position, Vector3 direction) public Ray(Vec3 position, Vec3 direction)
{ {
this.Position = position; this.Position = position;
this.Direction = direction; this.Direction = direction;
@ -66,7 +66,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="point">The point to test.</param> /// <param name="point">The point to test.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Vector3 point) public bool Intersects(ref Vec3 point)
{ {
return CollisionHelper.RayIntersectsPoint(ref this, ref point); return CollisionHelper.RayIntersectsPoint(ref this, ref point);
} }
@ -78,7 +78,7 @@ namespace math
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Ray ray) public bool Intersects(ref Ray ray)
{ {
Vector3 point; Vec3 point;
return CollisionHelper.RayIntersectsRay(ref this, ref ray, out point); return CollisionHelper.RayIntersectsRay(ref this, ref ray, out point);
} }
@ -87,9 +87,9 @@ namespace math
/// </summary> /// </summary>
/// <param name="ray">The ray to test.</param> /// <param name="ray">The ray to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Ray ray, out Vector3 point) public bool Intersects(ref Ray ray, out Vec3 point)
{ {
return CollisionHelper.RayIntersectsRay(ref this, ref ray, out point); return CollisionHelper.RayIntersectsRay(ref this, ref ray, out point);
} }
@ -122,9 +122,9 @@ namespace math
/// </summary> /// </summary>
/// <param name="plane">The plane to test.</param> /// <param name="plane">The plane to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Plane plane, out Vector3 point) public bool Intersects(ref Plane plane, out Vec3 point)
{ {
return CollisionHelper.RayIntersectsPlane(ref this, ref plane, out point); return CollisionHelper.RayIntersectsPlane(ref this, ref plane, out point);
} }
@ -136,7 +136,7 @@ namespace math
/// <param name="vertex2">The second vertex of the triangle to test.</param> /// <param name="vertex2">The second vertex of the triangle to test.</param>
/// <param name="vertex3">The third vertex of the triangle to test.</param> /// <param name="vertex3">The third vertex of the triangle to test.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3) public bool Intersects(ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3)
{ {
float distance; float distance;
return CollisionHelper.RayIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3, out distance); return CollisionHelper.RayIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3, out distance);
@ -151,7 +151,7 @@ namespace math
/// <param name="distance">When the method completes, contains the distance of the intersection, /// <param name="distance">When the method completes, contains the distance of the intersection,
/// or 0 if there was no intersection.</param> /// or 0 if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3, out float distance) public bool Intersects(ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3, out float distance)
{ {
return CollisionHelper.RayIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3, out distance); return CollisionHelper.RayIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3, out distance);
} }
@ -163,9 +163,9 @@ namespace math
/// <param name="vertex2">The second vertex of the triangle to test.</param> /// <param name="vertex2">The second vertex of the triangle to test.</param>
/// <param name="vertex3">The third vertex of the triangle to test.</param> /// <param name="vertex3">The third vertex of the triangle to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3, out Vector3 point) public bool Intersects(ref Vec3 vertex1, ref Vec3 vertex2, ref Vec3 vertex3, out Vec3 point)
{ {
return CollisionHelper.RayIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3, out point); return CollisionHelper.RayIntersectsTriangle(ref this, ref vertex1, ref vertex2, ref vertex3, out point);
} }
@ -198,9 +198,9 @@ namespace math
/// </summary> /// </summary>
/// <param name="box">The box to test.</param> /// <param name="box">The box to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref BoundingBox box, out Vector3 point) public bool Intersects(ref BoundingBox box, out Vec3 point)
{ {
return CollisionHelper.RayIntersectsBox(ref this, ref box, out point); return CollisionHelper.RayIntersectsBox(ref this, ref box, out point);
} }
@ -233,9 +233,9 @@ namespace math
/// </summary> /// </summary>
/// <param name="sphere">The sphere to test.</param> /// <param name="sphere">The sphere to test.</param>
/// <param name="point">When the method completes, contains the point of intersection, /// <param name="point">When the method completes, contains the point of intersection,
/// or <see cref="math.Vector3.Zero"/> if there was no intersection.</param> /// or <see cref="math.Vec3.Zero"/> if there was no intersection.</param>
/// <returns>Whether the two objects intersected.</returns> /// <returns>Whether the two objects intersected.</returns>
public bool Intersects(ref BoundingSphere sphere, out Vector3 point) public bool Intersects(ref BoundingSphere sphere, out Vec3 point)
{ {
return CollisionHelper.RayIntersectsSphere(ref this, ref sphere, out point); return CollisionHelper.RayIntersectsSphere(ref this, ref sphere, out point);
} }
@ -324,11 +324,11 @@ namespace math
} }
/// <summary> /// <summary>
/// Determines whether the specified <see cref="math.Vector4"/> is equal to this instance. /// Determines whether the specified <see cref="math.Vec4"/> is equal to this instance.
/// </summary> /// </summary>
/// <param name="value">The <see cref="math.Vector4"/> to compare with this instance.</param> /// <param name="value">The <see cref="math.Vec4"/> to compare with this instance.</param>
/// <returns> /// <returns>
/// <c>true</c> if the specified <see cref="math.Vector4"/> is equal to this instance; otherwise, <c>false</c>. /// <c>true</c> if the specified <see cref="math.Vec4"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns> /// </returns>
public bool Equals(Ray value) public bool Equals(Ray value)
{ {

View File

@ -70,7 +70,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="direction">The direction</param> /// <param name="direction">The direction</param>
/// <returns>The value of the spherical harmonics in the direction</returns> /// <returns>The value of the spherical harmonics in the direction</returns>
public abstract TDataType Evaluate(Vector3 direction); public abstract TDataType Evaluate(Vec3 direction);
/// <summary> /// <summary>
/// Returns the coefficient x{l,m} of the spherical harmonics (the {l,m} spherical coordinate corresponding to the spherical base Y{l,m}). /// Returns the coefficient x{l,m} of the spherical harmonics (the {l,m} spherical coordinate corresponding to the spherical base Y{l,m}).
@ -180,7 +180,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="direction">The direction to evaluate.</param> /// <param name="direction">The direction to evaluate.</param>
/// <returns>The color computed for this direction.</returns> /// <returns>The color computed for this direction.</returns>
public override Color3 Evaluate(Vector3 direction) public override Color3 Evaluate(Vec3 direction)
{ {
var x = direction.X; var x = direction.X;
var y = direction.Y; var y = direction.Y;

View File

@ -496,23 +496,23 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref = "UInt4" /> to <see cref = "Vector3" />. /// Performs an explicit conversion from <see cref = "UInt4" /> to <see cref = "Vec3" />.
/// </summary> /// </summary>
/// <param name = "value">The value.</param> /// <param name = "value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(UInt4 value) public static explicit operator Vec3(UInt4 value)
{ {
return new Vector3(value.X, value.Y, value.Z); return new Vec3(value.X, value.Y, value.Z);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref = "UInt4" /> to <see cref = "Vector4" />. /// Performs an explicit conversion from <see cref = "UInt4" /> to <see cref = "Vec4" />.
/// </summary> /// </summary>
/// <param name = "value">The value.</param> /// <param name = "value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector4(UInt4 value) public static explicit operator Vec4(UInt4 value)
{ {
return new Vector4(value.X, value.Y, value.Z, value.W); return new Vec4(value.X, value.Y, value.Z, value.W);
} }
/// <summary> /// <summary>

View File

@ -894,7 +894,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="vector">The vector to rotate.</param> /// <param name="vector">The vector to rotate.</param>
/// <param name="rotation">The <see cref="math.Quaternion"/> rotation to apply.</param> /// <param name="rotation">The <see cref="math.Quaternion"/> rotation to apply.</param>
/// <param name="result">When the method completes, contains the transformed <see cref="math.Vector4"/>.</param> /// <param name="result">When the method completes, contains the transformed <see cref="math.Vec4"/>.</param>
public static void Transform(ref Vec2 vector, ref Quaternion rotation, out Vec2 result) public static void Transform(ref Vec2 vector, ref Quaternion rotation, out Vec2 result)
{ {
float x = rotation.X + rotation.X; float x = rotation.X + rotation.X;
@ -914,7 +914,7 @@ namespace math
/// </summary> /// </summary>
/// <param name="vector">The vector to rotate.</param> /// <param name="vector">The vector to rotate.</param>
/// <param name="rotation">The <see cref="math.Quaternion"/> rotation to apply.</param> /// <param name="rotation">The <see cref="math.Quaternion"/> rotation to apply.</param>
/// <returns>The transformed <see cref="math.Vector4"/>.</returns> /// <returns>The transformed <see cref="math.Vec4"/>.</returns>
public static Vec2 Transform(Vec2 vector, Quaternion rotation) public static Vec2 Transform(Vec2 vector, Quaternion rotation)
{ {
Vec2 result; Vec2 result;
@ -967,10 +967,10 @@ namespace math
/// </summary> /// </summary>
/// <param name="vector">The source vector.</param> /// <param name="vector">The source vector.</param>
/// <param name="transform">The transformation <see cref="math.Matrix"/>.</param> /// <param name="transform">The transformation <see cref="math.Matrix"/>.</param>
/// <param name="result">When the method completes, contains the transformed <see cref="math.Vector4"/>.</param> /// <param name="result">When the method completes, contains the transformed <see cref="math.Vec4"/>.</param>
public static void Transform(ref Vec2 vector, ref Matrix transform, out Vector4 result) public static void Transform(ref Vec2 vector, ref Matrix transform, out Vec4 result)
{ {
result = new Vector4( result = new Vec4(
(vector.X * transform.M11) + (vector.Y * transform.M21) + transform.M41, (vector.X * transform.M11) + (vector.Y * transform.M21) + transform.M41,
(vector.X * transform.M12) + (vector.Y * transform.M22) + transform.M42, (vector.X * transform.M12) + (vector.Y * transform.M22) + transform.M42,
(vector.X * transform.M13) + (vector.Y * transform.M23) + transform.M43, (vector.X * transform.M13) + (vector.Y * transform.M23) + transform.M43,
@ -982,10 +982,10 @@ namespace math
/// </summary> /// </summary>
/// <param name="vector">The source vector.</param> /// <param name="vector">The source vector.</param>
/// <param name="transform">The transformation <see cref="math.Matrix"/>.</param> /// <param name="transform">The transformation <see cref="math.Matrix"/>.</param>
/// <returns>The transformed <see cref="math.Vector4"/>.</returns> /// <returns>The transformed <see cref="math.Vec4"/>.</returns>
public static Vector4 Transform(Vec2 vector, Matrix transform) public static Vec4 Transform(Vec2 vector, Matrix transform)
{ {
Vector4 result; Vec4 result;
Transform(ref vector, ref transform, out result); Transform(ref vector, ref transform, out result);
return result; return result;
} }
@ -998,7 +998,7 @@ namespace math
/// <param name="destination">The array for which the transformed vectors are stored.</param> /// <param name="destination">The array for which the transformed vectors are stored.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="source"/> or <paramref name="destination"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown when <paramref name="source"/> or <paramref name="destination"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="destination"/> is shorter in length than <paramref name="source"/>.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="destination"/> is shorter in length than <paramref name="source"/>.</exception>
public static void Transform(Vec2[] source, ref Matrix transform, Vector4[] destination) public static void Transform(Vec2[] source, ref Matrix transform, Vec4[] destination)
{ {
if (source == null) if (source == null)
throw new ArgumentNullException("source"); throw new ArgumentNullException("source");
@ -1028,7 +1028,7 @@ namespace math
/// </remarks> /// </remarks>
public static void TransformCoordinate(ref Vec2 coordinate, ref Matrix transform, out Vec2 result) public static void TransformCoordinate(ref Vec2 coordinate, ref Matrix transform, out Vec2 result)
{ {
Vector4 vector = new Vector4(); Vec4 vector = new Vec4();
vector.X = (coordinate.X * transform.M11) + (coordinate.Y * transform.M21) + transform.M41; vector.X = (coordinate.X * transform.M11) + (coordinate.Y * transform.M21) + transform.M41;
vector.Y = (coordinate.X * transform.M12) + (coordinate.Y * transform.M22) + transform.M42; vector.Y = (coordinate.X * transform.M12) + (coordinate.Y * transform.M22) + transform.M42;
vector.Z = (coordinate.X * transform.M13) + (coordinate.Y * transform.M23) + transform.M43; vector.Z = (coordinate.X * transform.M13) + (coordinate.Y * transform.M23) + transform.M43;
@ -1300,23 +1300,23 @@ namespace math
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="math.Vec2"/> to <see cref="math.Vector3"/>. /// Performs an explicit conversion from <see cref="math.Vec2"/> to <see cref="math.Vec3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(Vec2 value) public static explicit operator Vec3(Vec2 value)
{ {
return new Vector3(value, 0.0f); return new Vec3(value, 0.0f);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="math.Vec2"/> to <see cref="math.Vector4"/>. /// Performs an explicit conversion from <see cref="math.Vec2"/> to <see cref="math.Vec4"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector4(Vec2 value) public static explicit operator Vec4(Vec2 value)
{ {
return new Vector4(value, 0.0f, 0.0f); return new Vec4(value, 0.0f, 0.0f);
} }
/// <summary> /// <summary>

File diff suppressed because it is too large Load Diff

View File

@ -40,42 +40,42 @@ namespace math
[DataContract( Name = "float4")] [DataContract( Name = "float4")]
[DataStyle(DataStyle.Compact)] [DataStyle(DataStyle.Compact)]
[StructLayout(LayoutKind.Sequential, Pack = 4)] [StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct Vector4 : IEquatable<Vector4>, IFormattable public struct Vec4 : IEquatable<Vec4>, IFormattable
{ {
/// <summary> /// <summary>
/// The size of the <see cref="math.Vector4"/> type, in bytes. /// The size of the <see cref="math.Vec4"/> type, in bytes.
/// </summary> /// </summary>
public static readonly int SizeInBytes = lib.Util.SizeOf<Vector4>(); public static readonly int SizeInBytes = lib.Util.SizeOf<Vec4>();
/// <summary> /// <summary>
/// A <see cref="math.Vector4"/> with all of its components set to zero. /// A <see cref="math.Vec4"/> with all of its components set to zero.
/// </summary> /// </summary>
public static readonly Vector4 Zero = new Vector4(); public static readonly Vec4 Zero = new Vec4();
/// <summary> /// <summary>
/// The X unit <see cref="math.Vector4"/> (1, 0, 0, 0). /// The X unit <see cref="math.Vec4"/> (1, 0, 0, 0).
/// </summary> /// </summary>
public static readonly Vector4 UnitX = new Vector4(1.0f, 0.0f, 0.0f, 0.0f); public static readonly Vec4 UnitX = new Vec4(1.0f, 0.0f, 0.0f, 0.0f);
/// <summary> /// <summary>
/// The Y unit <see cref="math.Vector4"/> (0, 1, 0, 0). /// The Y unit <see cref="math.Vec4"/> (0, 1, 0, 0).
/// </summary> /// </summary>
public static readonly Vector4 UnitY = new Vector4(0.0f, 1.0f, 0.0f, 0.0f); public static readonly Vec4 UnitY = new Vec4(0.0f, 1.0f, 0.0f, 0.0f);
/// <summary> /// <summary>
/// The Z unit <see cref="math.Vector4"/> (0, 0, 1, 0). /// The Z unit <see cref="math.Vec4"/> (0, 0, 1, 0).
/// </summary> /// </summary>
public static readonly Vector4 UnitZ = new Vector4(0.0f, 0.0f, 1.0f, 0.0f); public static readonly Vec4 UnitZ = new Vec4(0.0f, 0.0f, 1.0f, 0.0f);
/// <summary> /// <summary>
/// The W unit <see cref="math.Vector4"/> (0, 0, 0, 1). /// The W unit <see cref="math.Vec4"/> (0, 0, 0, 1).
/// </summary> /// </summary>
public static readonly Vector4 UnitW = new Vector4(0.0f, 0.0f, 0.0f, 1.0f); public static readonly Vec4 UnitW = new Vec4(0.0f, 0.0f, 0.0f, 1.0f);
/// <summary> /// <summary>
/// A <see cref="math.Vector4"/> with all of its components set to one. /// A <see cref="math.Vec4"/> with all of its components set to one.
/// </summary> /// </summary>
public static readonly Vector4 One = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); public static readonly Vec4 One = new Vec4(1.0f, 1.0f, 1.0f, 1.0f);
/// <summary> /// <summary>
/// The X component of the vector. /// The X component of the vector.
@ -102,10 +102,10 @@ namespace math
public float W; public float W;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="math.Vector4"/> struct. /// Initializes a new instance of the <see cref="math.Vec4"/> struct.
/// </summary> /// </summary>
/// <param name="value">The value that will be assigned to all components.</param> /// <param name="value">The value that will be assigned to all components.</param>
public Vector4(float value) public Vec4(float value)
{ {
X = value; X = value;
Y = value; Y = value;
@ -114,13 +114,13 @@ namespace math
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="math.Vector4"/> struct. /// Initializes a new instance of the <see cref="math.Vec4"/> struct.
/// </summary> /// </summary>
/// <param name="x">Initial value for the X component of the vector.</param> /// <param name="x">Initial value for the X component of the vector.</param>
/// <param name="y">Initial value for the Y component of the vector.</param> /// <param name="y">Initial value for the Y component of the vector.</param>
/// <param name="z">Initial value for the Z component of the vector.</param> /// <param name="z">Initial value for the Z component of the vector.</param>
/// <param name="w">Initial value for the W component of the vector.</param> /// <param name="w">Initial value for the W component of the vector.</param>
public Vector4(float x, float y, float z, float w) public Vec4(float x, float y, float z, float w)
{ {
X = x; X = x;
Y = y; Y = y;
@ -129,11 +129,11 @@ namespace math
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="math.Vector4"/> struct. /// Initializes a new instance of the <see cref="math.Vec4"/> struct.
/// </summary> /// </summary>
/// <param name="value">A vector containing the values with which to initialize the X, Y, and Z components.</param> /// <param name="value">A vector containing the values with which to initialize the X, Y, and Z components.</param>
/// <param name="w">Initial value for the W component of the vector.</param> /// <param name="w">Initial value for the W component of the vector.</param>
public Vector4(Vector3 value, float w) public Vec4(Vec3 value, float w)
{ {
X = value.X; X = value.X;
Y = value.Y; Y = value.Y;
@ -142,12 +142,12 @@ namespace math
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="math.Vector4"/> struct. /// Initializes a new instance of the <see cref="math.Vec4"/> struct.
/// </summary> /// </summary>
/// <param name="value">A vector containing the values with which to initialize the X and Y components.</param> /// <param name="value">A vector containing the values with which to initialize the X and Y components.</param>
/// <param name="z">Initial value for the Z component of the vector.</param> /// <param name="z">Initial value for the Z component of the vector.</param>
/// <param name="w">Initial value for the W component of the vector.</param> /// <param name="w">Initial value for the W component of the vector.</param>
public Vector4(Vec2 value, float z, float w) public Vec4(Vec2 value, float z, float w)
{ {
X = value.X; X = value.X;
Y = value.Y; Y = value.Y;
@ -156,12 +156,12 @@ namespace math
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="math.Vector4"/> struct. /// Initializes a new instance of the <see cref="math.Vec4"/> struct.
/// </summary> /// </summary>
/// <param name="values">The values to assign to the X, Y, Z, and W components of the vector. This must be an array with four elements.</param> /// <param name="values">The values to assign to the X, Y, Z, and W components of the vector. This must be an array with four elements.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="values"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown when <paramref name="values"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="values"/> contains more or less than four elements.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="values"/> contains more or less than four elements.</exception>
public Vector4(float[] values) public Vec4(float[] values)
{ {
if (values == null) if (values == null)
throw new ArgumentNullException("values"); throw new ArgumentNullException("values");
@ -222,7 +222,7 @@ namespace math
/// </summary> /// </summary>
/// <returns>The length of the vector.</returns> /// <returns>The length of the vector.</returns>
/// <remarks> /// <remarks>
/// <see cref="math.Vector4.LengthSquared"/> may be preferred when only the relative length is needed /// <see cref="math.Vec4.LengthSquared"/> may be preferred when only the relative length is needed
/// and speed is of the essence. /// and speed is of the essence.
/// </remarks> /// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -236,7 +236,7 @@ namespace math
/// </summary> /// </summary>
/// <returns>The squared length of the vector.</returns> /// <returns>The squared length of the vector.</returns>
/// <remarks> /// <remarks>
/// This method may be preferred to <see cref="math.Vector4.Length"/> when only a relative length is needed /// This method may be preferred to <see cref="math.Vec4.Length"/> when only a relative length is needed
/// and speed is of the essence. /// and speed is of the essence.
/// </remarks> /// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -290,9 +290,9 @@ namespace math
/// <param name="right">The second vector to add.</param> /// <param name="right">The second vector to add.</param>
/// <param name="result">When the method completes, contains the sum of the two vectors.</param> /// <param name="result">When the method completes, contains the sum of the two vectors.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Add(ref Vector4 left, ref Vector4 right, out Vector4 result) public static void Add(ref Vec4 left, ref Vec4 right, out Vec4 result)
{ {
result = new Vector4(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); result = new Vec4(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W);
} }
/// <summary> /// <summary>
@ -302,9 +302,9 @@ namespace math
/// <param name="right">The second vector to add.</param> /// <param name="right">The second vector to add.</param>
/// <returns>The sum of the two vectors.</returns> /// <returns>The sum of the two vectors.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Add(Vector4 left, Vector4 right) public static Vec4 Add(Vec4 left, Vec4 right)
{ {
return new Vector4(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); return new Vec4(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W);
} }
/// <summary> /// <summary>
@ -314,9 +314,9 @@ namespace math
/// <param name="right">The second vector to subtract.</param> /// <param name="right">The second vector to subtract.</param>
/// <param name="result">When the method completes, contains the difference of the two vectors.</param> /// <param name="result">When the method completes, contains the difference of the two vectors.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Subtract(ref Vector4 left, ref Vector4 right, out Vector4 result) public static void Subtract(ref Vec4 left, ref Vec4 right, out Vec4 result)
{ {
result = new Vector4(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); result = new Vec4(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W);
} }
/// <summary> /// <summary>
@ -326,9 +326,9 @@ namespace math
/// <param name="right">The second vector to subtract.</param> /// <param name="right">The second vector to subtract.</param>
/// <returns>The difference of the two vectors.</returns> /// <returns>The difference of the two vectors.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Subtract(Vector4 left, Vector4 right) public static Vec4 Subtract(Vec4 left, Vec4 right)
{ {
return new Vector4(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); return new Vec4(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W);
} }
/// <summary> /// <summary>
@ -338,9 +338,9 @@ namespace math
/// <param name="scale">The amount by which to scale the vector.</param> /// <param name="scale">The amount by which to scale the vector.</param>
/// <param name="result">When the method completes, contains the scaled vector.</param> /// <param name="result">When the method completes, contains the scaled vector.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Multiply(ref Vector4 value, float scale, out Vector4 result) public static void Multiply(ref Vec4 value, float scale, out Vec4 result)
{ {
result = new Vector4(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale); result = new Vec4(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale);
} }
/// <summary> /// <summary>
@ -350,9 +350,9 @@ namespace math
/// <param name="scale">The amount by which to scale the vector.</param> /// <param name="scale">The amount by which to scale the vector.</param>
/// <returns>The scaled vector.</returns> /// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Multiply(Vector4 value, float scale) public static Vec4 Multiply(Vec4 value, float scale)
{ {
return new Vector4(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale); return new Vec4(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale);
} }
/// <summary> /// <summary>
@ -362,9 +362,9 @@ namespace math
/// <param name="right">The second vector to modulate.</param> /// <param name="right">The second vector to modulate.</param>
/// <param name="result">When the method completes, contains the modulated vector.</param> /// <param name="result">When the method completes, contains the modulated vector.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Modulate(ref Vector4 left, ref Vector4 right, out Vector4 result) public static void Modulate(ref Vec4 left, ref Vec4 right, out Vec4 result)
{ {
result = new Vector4(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); result = new Vec4(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W);
} }
/// <summary> /// <summary>
@ -374,9 +374,9 @@ namespace math
/// <param name="right">The second vector to modulate.</param> /// <param name="right">The second vector to modulate.</param>
/// <returns>The modulated vector.</returns> /// <returns>The modulated vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Modulate(Vector4 left, Vector4 right) public static Vec4 Modulate(Vec4 left, Vec4 right)
{ {
return new Vector4(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); return new Vec4(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W);
} }
/// <summary> /// <summary>
@ -386,9 +386,9 @@ namespace math
/// <param name="scale">The amount by which to scale the vector.</param> /// <param name="scale">The amount by which to scale the vector.</param>
/// <param name="result">When the method completes, contains the scaled vector.</param> /// <param name="result">When the method completes, contains the scaled vector.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Divide(ref Vector4 value, float scale, out Vector4 result) public static void Divide(ref Vec4 value, float scale, out Vec4 result)
{ {
result = new Vector4(value.X / scale, value.Y / scale, value.Z / scale, value.W / scale); result = new Vec4(value.X / scale, value.Y / scale, value.Z / scale, value.W / scale);
} }
/// <summary> /// <summary>
@ -398,9 +398,9 @@ namespace math
/// <param name="scale">The amount by which to scale the vector.</param> /// <param name="scale">The amount by which to scale the vector.</param>
/// <returns>The scaled vector.</returns> /// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Divide(Vector4 value, float scale) public static Vec4 Divide(Vec4 value, float scale)
{ {
return new Vector4(value.X / scale, value.Y / scale, value.Z / scale, value.W / scale); return new Vec4(value.X / scale, value.Y / scale, value.Z / scale, value.W / scale);
} }
/// <summary> /// <summary>
@ -410,9 +410,9 @@ namespace math
/// <param name="right">The second vector to demodulate.</param> /// <param name="right">The second vector to demodulate.</param>
/// <param name="result">When the method completes, contains the demodulated vector.</param> /// <param name="result">When the method completes, contains the demodulated vector.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Demodulate(ref Vector4 left, ref Vector4 right, out Vector4 result) public static void Demodulate(ref Vec4 left, ref Vec4 right, out Vec4 result)
{ {
result = new Vector4(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); result = new Vec4(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W);
} }
/// <summary> /// <summary>
@ -422,9 +422,9 @@ namespace math
/// <param name="right">The second vector to demodulate.</param> /// <param name="right">The second vector to demodulate.</param>
/// <returns>The demodulated vector.</returns> /// <returns>The demodulated vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Demodulate(Vector4 left, Vector4 right) public static Vec4 Demodulate(Vec4 left, Vec4 right)
{ {
return new Vector4(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W); return new Vec4(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W);
} }
/// <summary> /// <summary>
@ -433,9 +433,9 @@ namespace math
/// <param name="value">The vector to negate.</param> /// <param name="value">The vector to negate.</param>
/// <param name="result">When the method completes, contains a vector facing in the opposite direction.</param> /// <param name="result">When the method completes, contains a vector facing in the opposite direction.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Negate(ref Vector4 value, out Vector4 result) public static void Negate(ref Vec4 value, out Vec4 result)
{ {
result = new Vector4(-value.X, -value.Y, -value.Z, -value.W); result = new Vec4(-value.X, -value.Y, -value.Z, -value.W);
} }
/// <summary> /// <summary>
@ -444,23 +444,23 @@ namespace math
/// <param name="value">The vector to negate.</param> /// <param name="value">The vector to negate.</param>
/// <returns>A vector facing in the opposite direction.</returns> /// <returns>A vector facing in the opposite direction.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Negate(Vector4 value) public static Vec4 Negate(Vec4 value)
{ {
return new Vector4(-value.X, -value.Y, -value.Z, -value.W); return new Vec4(-value.X, -value.Y, -value.Z, -value.W);
} }
/// <summary> /// <summary>
/// Returns a <see cref="math.Vector4"/> containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 4D triangle. /// Returns a <see cref="math.Vec4"/> containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 4D triangle.
/// </summary> /// </summary>
/// <param name="value1">A <see cref="math.Vector4"/> containing the 4D Cartesian coordinates of vertex 1 of the triangle.</param> /// <param name="value1">A <see cref="math.Vec4"/> containing the 4D Cartesian coordinates of vertex 1 of the triangle.</param>
/// <param name="value2">A <see cref="math.Vector4"/> containing the 4D Cartesian coordinates of vertex 2 of the triangle.</param> /// <param name="value2">A <see cref="math.Vec4"/> containing the 4D Cartesian coordinates of vertex 2 of the triangle.</param>
/// <param name="value3">A <see cref="math.Vector4"/> containing the 4D Cartesian coordinates of vertex 3 of the triangle.</param> /// <param name="value3">A <see cref="math.Vec4"/> containing the 4D Cartesian coordinates of vertex 3 of the triangle.</param>
/// <param name="amount1">Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in <paramref name="value2"/>).</param> /// <param name="amount1">Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in <paramref name="value2"/>).</param>
/// <param name="amount2">Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in <paramref name="value3"/>).</param> /// <param name="amount2">Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in <paramref name="value3"/>).</param>
/// <param name="result">When the method completes, contains the 4D Cartesian coordinates of the specified point.</param> /// <param name="result">When the method completes, contains the 4D Cartesian coordinates of the specified point.</param>
public static void Barycentric(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, float amount1, float amount2, out Vector4 result) public static void Barycentric(ref Vec4 value1, ref Vec4 value2, ref Vec4 value3, float amount1, float amount2, out Vec4 result)
{ {
result = new Vector4( result = new Vec4(
(value1.X + (amount1 * (value2.X - value1.X))) + (amount2 * (value3.X - value1.X)), (value1.X + (amount1 * (value2.X - value1.X))) + (amount2 * (value3.X - value1.X)),
(value1.Y + (amount1 * (value2.Y - value1.Y))) + (amount2 * (value3.Y - value1.Y)), (value1.Y + (amount1 * (value2.Y - value1.Y))) + (amount2 * (value3.Y - value1.Y)),
(value1.Z + (amount1 * (value2.Z - value1.Z))) + (amount2 * (value3.Z - value1.Z)), (value1.Z + (amount1 * (value2.Z - value1.Z))) + (amount2 * (value3.Z - value1.Z)),
@ -468,17 +468,17 @@ namespace math
} }
/// <summary> /// <summary>
/// Returns a <see cref="math.Vector4"/> containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 4D triangle. /// Returns a <see cref="math.Vec4"/> containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 4D triangle.
/// </summary> /// </summary>
/// <param name="value1">A <see cref="math.Vector4"/> containing the 4D Cartesian coordinates of vertex 1 of the triangle.</param> /// <param name="value1">A <see cref="math.Vec4"/> containing the 4D Cartesian coordinates of vertex 1 of the triangle.</param>
/// <param name="value2">A <see cref="math.Vector4"/> containing the 4D Cartesian coordinates of vertex 2 of the triangle.</param> /// <param name="value2">A <see cref="math.Vec4"/> containing the 4D Cartesian coordinates of vertex 2 of the triangle.</param>
/// <param name="value3">A <see cref="math.Vector4"/> containing the 4D Cartesian coordinates of vertex 3 of the triangle.</param> /// <param name="value3">A <see cref="math.Vec4"/> containing the 4D Cartesian coordinates of vertex 3 of the triangle.</param>
/// <param name="amount1">Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in <paramref name="value2"/>).</param> /// <param name="amount1">Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in <paramref name="value2"/>).</param>
/// <param name="amount2">Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in <paramref name="value3"/>).</param> /// <param name="amount2">Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in <paramref name="value3"/>).</param>
/// <returns>A new <see cref="math.Vector4"/> containing the 4D Cartesian coordinates of the specified point.</returns> /// <returns>A new <see cref="math.Vec4"/> containing the 4D Cartesian coordinates of the specified point.</returns>
public static Vector4 Barycentric(Vector4 value1, Vector4 value2, Vector4 value3, float amount1, float amount2) public static Vec4 Barycentric(Vec4 value1, Vec4 value2, Vec4 value3, float amount1, float amount2)
{ {
Vector4 result; Vec4 result;
Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out result); Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out result);
return result; return result;
} }
@ -490,7 +490,7 @@ namespace math
/// <param name="min">The minimum value.</param> /// <param name="min">The minimum value.</param>
/// <param name="max">The maximum value.</param> /// <param name="max">The maximum value.</param>
/// <param name="result">When the method completes, contains the clamped value.</param> /// <param name="result">When the method completes, contains the clamped value.</param>
public static void Clamp(ref Vector4 value, ref Vector4 min, ref Vector4 max, out Vector4 result) public static void Clamp(ref Vec4 value, ref Vec4 min, ref Vec4 max, out Vec4 result)
{ {
float x = value.X; float x = value.X;
x = (x > max.X) ? max.X : x; x = (x > max.X) ? max.X : x;
@ -508,7 +508,7 @@ namespace math
w = (w > max.W) ? max.W : w; w = (w > max.W) ? max.W : w;
w = (w < min.W) ? min.W : w; w = (w < min.W) ? min.W : w;
result = new Vector4(x, y, z, w); result = new Vec4(x, y, z, w);
} }
/// <summary> /// <summary>
@ -518,9 +518,9 @@ namespace math
/// <param name="min">The minimum value.</param> /// <param name="min">The minimum value.</param>
/// <param name="max">The maximum value.</param> /// <param name="max">The maximum value.</param>
/// <returns>The clamped value.</returns> /// <returns>The clamped value.</returns>
public static Vector4 Clamp(Vector4 value, Vector4 min, Vector4 max) public static Vec4 Clamp(Vec4 value, Vec4 min, Vec4 max)
{ {
Vector4 result; Vec4 result;
Clamp(ref value, ref min, ref max, out result); Clamp(ref value, ref min, ref max, out result);
return result; return result;
} }
@ -532,10 +532,10 @@ namespace math
/// <param name="value2">The second vector.</param> /// <param name="value2">The second vector.</param>
/// <param name="result">When the method completes, contains the distance between the two vectors.</param> /// <param name="result">When the method completes, contains the distance between the two vectors.</param>
/// <remarks> /// <remarks>
/// <see cref="math.Vector4.DistanceSquared(ref Vector4, ref Vector4, out float)"/> may be preferred when only the relative distance is needed /// <see cref="math.Vec4.DistanceSquared(ref Vec4, ref Vec4, out float)"/> may be preferred when only the relative distance is needed
/// and speed is of the essence. /// and speed is of the essence.
/// </remarks> /// </remarks>
public static void Distance(ref Vector4 value1, ref Vector4 value2, out float result) public static void Distance(ref Vec4 value1, ref Vec4 value2, out float result)
{ {
float x = value1.X - value2.X; float x = value1.X - value2.X;
float y = value1.Y - value2.Y; float y = value1.Y - value2.Y;
@ -552,10 +552,10 @@ namespace math
/// <param name="value2">The second vector.</param> /// <param name="value2">The second vector.</param>
/// <returns>The distance between the two vectors.</returns> /// <returns>The distance between the two vectors.</returns>
/// <remarks> /// <remarks>
/// <see cref="math.Vector4.DistanceSquared(Vector4, Vector4)"/> may be preferred when only the relative distance is needed /// <see cref="math.Vec4.DistanceSquared(Vec4, Vec4)"/> may be preferred when only the relative distance is needed
/// and speed is of the essence. /// and speed is of the essence.
/// </remarks> /// </remarks>
public static float Distance(Vector4 value1, Vector4 value2) public static float Distance(Vec4 value1, Vec4 value2)
{ {
float x = value1.X - value2.X; float x = value1.X - value2.X;
float y = value1.Y - value2.Y; float y = value1.Y - value2.Y;
@ -578,7 +578,7 @@ namespace math
/// involves two square roots, which are computationally expensive. However, using distance squared /// involves two square roots, which are computationally expensive. However, using distance squared
/// provides the same information and avoids calculating two square roots. /// provides the same information and avoids calculating two square roots.
/// </remarks> /// </remarks>
public static void DistanceSquared(ref Vector4 value1, ref Vector4 value2, out float result) public static void DistanceSquared(ref Vec4 value1, ref Vec4 value2, out float result)
{ {
float x = value1.X - value2.X; float x = value1.X - value2.X;
float y = value1.Y - value2.Y; float y = value1.Y - value2.Y;
@ -601,7 +601,7 @@ namespace math
/// involves two square roots, which are computationally expensive. However, using distance squared /// involves two square roots, which are computationally expensive. However, using distance squared
/// provides the same information and avoids calculating two square roots. /// provides the same information and avoids calculating two square roots.
/// </remarks> /// </remarks>
public static float DistanceSquared(Vector4 value1, Vector4 value2) public static float DistanceSquared(Vec4 value1, Vec4 value2)
{ {
float x = value1.X - value2.X; float x = value1.X - value2.X;
float y = value1.Y - value2.Y; float y = value1.Y - value2.Y;
@ -618,7 +618,7 @@ namespace math
/// <param name="right">Second source vector.</param> /// <param name="right">Second source vector.</param>
/// <param name="result">When the method completes, contains the dot product of the two vectors.</param> /// <param name="result">When the method completes, contains the dot product of the two vectors.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Dot(ref Vector4 left, ref Vector4 right, out float result) public static void Dot(ref Vec4 left, ref Vec4 right, out float result)
{ {
result = (left.X * right.X) + (left.Y * right.Y) + (left.Z * right.Z) + (left.W * right.W); result = (left.X * right.X) + (left.Y * right.Y) + (left.Z * right.Z) + (left.W * right.W);
} }
@ -630,7 +630,7 @@ namespace math
/// <param name="right">Second source vector.</param> /// <param name="right">Second source vector.</param>
/// <returns>The dot product of the two vectors.</returns> /// <returns>The dot product of the two vectors.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Dot(Vector4 left, Vector4 right) public static float Dot(Vec4 left, Vec4 right)
{ {
return (left.X * right.X) + (left.Y * right.Y) + (left.Z * right.Z) + (left.W * right.W); return (left.X * right.X) + (left.Y * right.Y) + (left.Z * right.Z) + (left.W * right.W);
} }
@ -641,9 +641,9 @@ namespace math
/// <param name="value">The vector to normalize.</param> /// <param name="value">The vector to normalize.</param>
/// <param name="result">When the method completes, contains the normalized vector.</param> /// <param name="result">When the method completes, contains the normalized vector.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Normalize(ref Vector4 value, out Vector4 result) public static void Normalize(ref Vec4 value, out Vec4 result)
{ {
Vector4 temp = value; Vec4 temp = value;
result = temp; result = temp;
result.Normalize(); result.Normalize();
} }
@ -654,7 +654,7 @@ namespace math
/// <param name="value">The vector to normalize.</param> /// <param name="value">The vector to normalize.</param>
/// <returns>The normalized vector.</returns> /// <returns>The normalized vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Normalize(Vector4 value) public static Vec4 Normalize(Vec4 value)
{ {
value.Normalize(); value.Normalize();
return value; return value;
@ -672,7 +672,7 @@ namespace math
/// <code>start + (end - start) * amount</code> /// <code>start + (end - start) * amount</code>
/// Passing <paramref name="amount"/> a value of 0 will cause <paramref name="start"/> to be returned; a value of 1 will cause <paramref name="end"/> to be returned. /// Passing <paramref name="amount"/> a value of 0 will cause <paramref name="start"/> to be returned; a value of 1 will cause <paramref name="end"/> to be returned.
/// </remarks> /// </remarks>
public static void Lerp(ref Vector4 start, ref Vector4 end, float amount, out Vector4 result) public static void Lerp(ref Vec4 start, ref Vec4 end, float amount, out Vec4 result)
{ {
result.X = start.X + ((end.X - start.X) * amount); result.X = start.X + ((end.X - start.X) * amount);
result.Y = start.Y + ((end.Y - start.Y) * amount); result.Y = start.Y + ((end.Y - start.Y) * amount);
@ -692,9 +692,9 @@ namespace math
/// <code>start + (end - start) * amount</code> /// <code>start + (end - start) * amount</code>
/// Passing <paramref name="amount"/> a value of 0 will cause <paramref name="start"/> to be returned; a value of 1 will cause <paramref name="end"/> to be returned. /// Passing <paramref name="amount"/> a value of 0 will cause <paramref name="start"/> to be returned; a value of 1 will cause <paramref name="end"/> to be returned.
/// </remarks> /// </remarks>
public static Vector4 Lerp(Vector4 start, Vector4 end, float amount) public static Vec4 Lerp(Vec4 start, Vec4 end, float amount)
{ {
Vector4 result; Vec4 result;
Lerp(ref start, ref end, amount, out result); Lerp(ref start, ref end, amount, out result);
return result; return result;
} }
@ -706,7 +706,7 @@ namespace math
/// <param name="end">End vector.</param> /// <param name="end">End vector.</param>
/// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end"/>.</param> /// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end"/>.</param>
/// <param name="result">When the method completes, contains the cubic interpolation of the two vectors.</param> /// <param name="result">When the method completes, contains the cubic interpolation of the two vectors.</param>
public static void SmoothStep(ref Vector4 start, ref Vector4 end, float amount, out Vector4 result) public static void SmoothStep(ref Vec4 start, ref Vec4 end, float amount, out Vec4 result)
{ {
amount = (amount > 1.0f) ? 1.0f : ((amount < 0.0f) ? 0.0f : amount); amount = (amount > 1.0f) ? 1.0f : ((amount < 0.0f) ? 0.0f : amount);
amount = (amount * amount) * (3.0f - (2.0f * amount)); amount = (amount * amount) * (3.0f - (2.0f * amount));
@ -724,9 +724,9 @@ namespace math
/// <param name="end">End vector.</param> /// <param name="end">End vector.</param>
/// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end"/>.</param> /// <param name="amount">Value between 0 and 1 indicating the weight of <paramref name="end"/>.</param>
/// <returns>The cubic interpolation of the two vectors.</returns> /// <returns>The cubic interpolation of the two vectors.</returns>
public static Vector4 SmoothStep(Vector4 start, Vector4 end, float amount) public static Vec4 SmoothStep(Vec4 start, Vec4 end, float amount)
{ {
Vector4 result; Vec4 result;
SmoothStep(ref start, ref end, amount, out result); SmoothStep(ref start, ref end, amount, out result);
return result; return result;
} }
@ -740,7 +740,7 @@ namespace math
/// <param name="tangent2">Second source tangent vector.</param> /// <param name="tangent2">Second source tangent vector.</param>
/// <param name="amount">Weighting factor.</param> /// <param name="amount">Weighting factor.</param>
/// <param name="result">When the method completes, contains the result of the Hermite spline interpolation.</param> /// <param name="result">When the method completes, contains the result of the Hermite spline interpolation.</param>
public static void Hermite(ref Vector4 value1, ref Vector4 tangent1, ref Vector4 value2, ref Vector4 tangent2, float amount, out Vector4 result) public static void Hermite(ref Vec4 value1, ref Vec4 tangent1, ref Vec4 value2, ref Vec4 tangent2, float amount, out Vec4 result)
{ {
float squared = amount * amount; float squared = amount * amount;
float cubed = amount * squared; float cubed = amount * squared;
@ -749,7 +749,7 @@ namespace math
float part3 = (cubed - (2.0f * squared)) + amount; float part3 = (cubed - (2.0f * squared)) + amount;
float part4 = cubed - squared; float part4 = cubed - squared;
result = new Vector4( result = new Vec4(
(((value1.X * part1) + (value2.X * part2)) + (tangent1.X * part3)) + (tangent2.X * part4), (((value1.X * part1) + (value2.X * part2)) + (tangent1.X * part3)) + (tangent2.X * part4),
(((value1.Y * part1) + (value2.Y * part2)) + (tangent1.Y * part3)) + (tangent2.Y * part4), (((value1.Y * part1) + (value2.Y * part2)) + (tangent1.Y * part3)) + (tangent2.Y * part4),
(((value1.Z * part1) + (value2.Z * part2)) + (tangent1.Z * part3)) + (tangent2.Z * part4), (((value1.Z * part1) + (value2.Z * part2)) + (tangent1.Z * part3)) + (tangent2.Z * part4),
@ -765,9 +765,9 @@ namespace math
/// <param name="tangent2">Second source tangent vector.</param> /// <param name="tangent2">Second source tangent vector.</param>
/// <param name="amount">Weighting factor.</param> /// <param name="amount">Weighting factor.</param>
/// <returns>The result of the Hermite spline interpolation.</returns> /// <returns>The result of the Hermite spline interpolation.</returns>
public static Vector4 Hermite(Vector4 value1, Vector4 tangent1, Vector4 value2, Vector4 tangent2, float amount) public static Vec4 Hermite(Vec4 value1, Vec4 tangent1, Vec4 value2, Vec4 tangent2, float amount)
{ {
Vector4 result; Vec4 result;
Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result); Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result);
return result; return result;
} }
@ -781,7 +781,7 @@ namespace math
/// <param name="value4">The fourth position in the interpolation.</param> /// <param name="value4">The fourth position in the interpolation.</param>
/// <param name="amount">Weighting factor.</param> /// <param name="amount">Weighting factor.</param>
/// <param name="result">When the method completes, contains the result of the Catmull-Rom interpolation.</param> /// <param name="result">When the method completes, contains the result of the Catmull-Rom interpolation.</param>
public static void CatmullRom(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, ref Vector4 value4, float amount, out Vector4 result) public static void CatmullRom(ref Vec4 value1, ref Vec4 value2, ref Vec4 value3, ref Vec4 value4, float amount, out Vec4 result)
{ {
float squared = amount * amount; float squared = amount * amount;
float cubed = amount * squared; float cubed = amount * squared;
@ -801,9 +801,9 @@ namespace math
/// <param name="value4">The fourth position in the interpolation.</param> /// <param name="value4">The fourth position in the interpolation.</param>
/// <param name="amount">Weighting factor.</param> /// <param name="amount">Weighting factor.</param>
/// <returns>A vector that is the result of the Catmull-Rom interpolation.</returns> /// <returns>A vector that is the result of the Catmull-Rom interpolation.</returns>
public static Vector4 CatmullRom(Vector4 value1, Vector4 value2, Vector4 value3, Vector4 value4, float amount) public static Vec4 CatmullRom(Vec4 value1, Vec4 value2, Vec4 value3, Vec4 value4, float amount)
{ {
Vector4 result; Vec4 result;
CatmullRom(ref value1, ref value2, ref value3, ref value4, amount, out result); CatmullRom(ref value1, ref value2, ref value3, ref value4, amount, out result);
return result; return result;
} }
@ -815,7 +815,7 @@ namespace math
/// <param name="right">The second source vector.</param> /// <param name="right">The second source vector.</param>
/// <param name="result">When the method completes, contains an new vector composed of the largest components of the source vectors.</param> /// <param name="result">When the method completes, contains an new vector composed of the largest components of the source vectors.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Max(ref Vector4 left, ref Vector4 right, out Vector4 result) public static void Max(ref Vec4 left, ref Vec4 right, out Vec4 result)
{ {
result.X = (left.X > right.X) ? left.X : right.X; result.X = (left.X > right.X) ? left.X : right.X;
result.Y = (left.Y > right.Y) ? left.Y : right.Y; result.Y = (left.Y > right.Y) ? left.Y : right.Y;
@ -830,9 +830,9 @@ namespace math
/// <param name="right">The second source vector.</param> /// <param name="right">The second source vector.</param>
/// <returns>A vector containing the largest components of the source vectors.</returns> /// <returns>A vector containing the largest components of the source vectors.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Max(Vector4 left, Vector4 right) public static Vec4 Max(Vec4 left, Vec4 right)
{ {
Vector4 result; Vec4 result;
Max(ref left, ref right, out result); Max(ref left, ref right, out result);
return result; return result;
} }
@ -844,7 +844,7 @@ namespace math
/// <param name="right">The second source vector.</param> /// <param name="right">The second source vector.</param>
/// <param name="result">When the method completes, contains an new vector composed of the smallest components of the source vectors.</param> /// <param name="result">When the method completes, contains an new vector composed of the smallest components of the source vectors.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Min(ref Vector4 left, ref Vector4 right, out Vector4 result) public static void Min(ref Vec4 left, ref Vec4 right, out Vec4 result)
{ {
result.X = (left.X < right.X) ? left.X : right.X; result.X = (left.X < right.X) ? left.X : right.X;
result.Y = (left.Y < right.Y) ? left.Y : right.Y; result.Y = (left.Y < right.Y) ? left.Y : right.Y;
@ -859,9 +859,9 @@ namespace math
/// <param name="right">The second source vector.</param> /// <param name="right">The second source vector.</param>
/// <returns>A vector containing the smallest components of the source vectors.</returns> /// <returns>A vector containing the smallest components of the source vectors.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 Min(Vector4 left, Vector4 right) public static Vec4 Min(Vec4 left, Vec4 right)
{ {
Vector4 result; Vec4 result;
Min(ref left, ref right, out result); Min(ref left, ref right, out result);
return result; return result;
} }
@ -882,7 +882,7 @@ namespace math
/// </remarks> /// </remarks>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="source"/> or <paramref name="destination"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown when <paramref name="source"/> or <paramref name="destination"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="destination"/> is shorter in length than <paramref name="source"/>.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="destination"/> is shorter in length than <paramref name="source"/>.</exception>
public static void Orthogonalize(Vector4[] destination, params Vector4[] source) public static void Orthogonalize(Vec4[] destination, params Vec4[] source)
{ {
//Uses the modified Gram-Schmidt process. //Uses the modified Gram-Schmidt process.
//q1 = m1 //q1 = m1
@ -900,11 +900,11 @@ namespace math
for (int i = 0; i < source.Length; ++i) for (int i = 0; i < source.Length; ++i)
{ {
Vector4 newvector = source[i]; Vec4 newvector = source[i];
for (int r = 0; r < i; ++r) for (int r = 0; r < i; ++r)
{ {
newvector -= (Vector4.Dot(destination[r], newvector) / Vector4.Dot(destination[r], destination[r])) * destination[r]; newvector -= (Vec4.Dot(destination[r], newvector) / Vec4.Dot(destination[r], destination[r])) * destination[r];
} }
destination[i] = newvector; destination[i] = newvector;
@ -927,7 +927,7 @@ namespace math
/// </remarks> /// </remarks>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="source"/> or <paramref name="destination"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown when <paramref name="source"/> or <paramref name="destination"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="destination"/> is shorter in length than <paramref name="source"/>.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="destination"/> is shorter in length than <paramref name="source"/>.</exception>
public static void Orthonormalize(Vector4[] destination, params Vector4[] source) public static void Orthonormalize(Vec4[] destination, params Vec4[] source)
{ {
//Uses the modified Gram-Schmidt process. //Uses the modified Gram-Schmidt process.
//Because we are making unit vectors, we can optimize the math for orthogonalization //Because we are making unit vectors, we can optimize the math for orthogonalization
@ -947,11 +947,11 @@ namespace math
for (int i = 0; i < source.Length; ++i) for (int i = 0; i < source.Length; ++i)
{ {
Vector4 newvector = source[i]; Vec4 newvector = source[i];
for (int r = 0; r < i; ++r) for (int r = 0; r < i; ++r)
{ {
newvector -= Vector4.Dot(destination[r], newvector) * destination[r]; newvector -= Vec4.Dot(destination[r], newvector) * destination[r];
} }
newvector.Normalize(); newvector.Normalize();
@ -964,8 +964,8 @@ namespace math
/// </summary> /// </summary>
/// <param name="vector">The vector to rotate.</param> /// <param name="vector">The vector to rotate.</param>
/// <param name="rotation">The <see cref="math.Quaternion"/> rotation to apply.</param> /// <param name="rotation">The <see cref="math.Quaternion"/> rotation to apply.</param>
/// <param name="result">When the method completes, contains the transformed <see cref="math.Vector4"/>.</param> /// <param name="result">When the method completes, contains the transformed <see cref="math.Vec4"/>.</param>
public static void Transform(ref Vector4 vector, ref Quaternion rotation, out Vector4 result) public static void Transform(ref Vec4 vector, ref Quaternion rotation, out Vec4 result)
{ {
float x = rotation.X + rotation.X; float x = rotation.X + rotation.X;
float y = rotation.Y + rotation.Y; float y = rotation.Y + rotation.Y;
@ -980,7 +980,7 @@ namespace math
float yz = rotation.Y * z; float yz = rotation.Y * z;
float zz = rotation.Z * z; float zz = rotation.Z * z;
result = new Vector4( result = new Vec4(
((vector.X * ((1.0f - yy) - zz)) + (vector.Y * (xy - wz))) + (vector.Z * (xz + wy)), ((vector.X * ((1.0f - yy) - zz)) + (vector.Y * (xy - wz))) + (vector.Z * (xz + wy)),
((vector.X * (xy + wz)) + (vector.Y * ((1.0f - xx) - zz))) + (vector.Z * (yz - wx)), ((vector.X * (xy + wz)) + (vector.Y * ((1.0f - xx) - zz))) + (vector.Z * (yz - wx)),
((vector.X * (xz - wy)) + (vector.Y * (yz + wx))) + (vector.Z * ((1.0f - xx) - yy)), ((vector.X * (xz - wy)) + (vector.Y * (yz + wx))) + (vector.Z * ((1.0f - xx) - yy)),
@ -992,10 +992,10 @@ namespace math
/// </summary> /// </summary>
/// <param name="vector">The vector to rotate.</param> /// <param name="vector">The vector to rotate.</param>
/// <param name="rotation">The <see cref="math.Quaternion"/> rotation to apply.</param> /// <param name="rotation">The <see cref="math.Quaternion"/> rotation to apply.</param>
/// <returns>The transformed <see cref="math.Vector4"/>.</returns> /// <returns>The transformed <see cref="math.Vec4"/>.</returns>
public static Vector4 Transform(Vector4 vector, Quaternion rotation) public static Vec4 Transform(Vec4 vector, Quaternion rotation)
{ {
Vector4 result; Vec4 result;
Transform(ref vector, ref rotation, out result); Transform(ref vector, ref rotation, out result);
return result; return result;
} }
@ -1009,7 +1009,7 @@ namespace math
/// This array may be the same array as <paramref name="source"/>.</param> /// This array may be the same array as <paramref name="source"/>.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="source"/> or <paramref name="destination"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown when <paramref name="source"/> or <paramref name="destination"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="destination"/> is shorter in length than <paramref name="source"/>.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="destination"/> is shorter in length than <paramref name="source"/>.</exception>
public static void Transform(Vector4[] source, ref Quaternion rotation, Vector4[] destination) public static void Transform(Vec4[] source, ref Quaternion rotation, Vec4[] destination)
{ {
if (source == null) if (source == null)
throw new ArgumentNullException("source"); throw new ArgumentNullException("source");
@ -1043,7 +1043,7 @@ namespace math
for (int i = 0; i < source.Length; ++i) for (int i = 0; i < source.Length; ++i)
{ {
destination[i] = new Vector4( destination[i] = new Vec4(
((source[i].X * num1) + (source[i].Y * num2)) + (source[i].Z * num3), ((source[i].X * num1) + (source[i].Y * num2)) + (source[i].Z * num3),
((source[i].X * num4) + (source[i].Y * num5)) + (source[i].Z * num6), ((source[i].X * num4) + (source[i].Y * num5)) + (source[i].Z * num6),
((source[i].X * num7) + (source[i].Y * num8)) + (source[i].Z * num9), ((source[i].X * num7) + (source[i].Y * num8)) + (source[i].Z * num9),
@ -1056,10 +1056,10 @@ namespace math
/// </summary> /// </summary>
/// <param name="vector">The source vector.</param> /// <param name="vector">The source vector.</param>
/// <param name="transform">The transformation <see cref="math.Matrix"/>.</param> /// <param name="transform">The transformation <see cref="math.Matrix"/>.</param>
/// <param name="result">When the method completes, contains the transformed <see cref="math.Vector4"/>.</param> /// <param name="result">When the method completes, contains the transformed <see cref="math.Vec4"/>.</param>
public static void Transform(ref Vector4 vector, ref Matrix transform, out Vector4 result) public static void Transform(ref Vec4 vector, ref Matrix transform, out Vec4 result)
{ {
result = new Vector4( result = new Vec4(
(vector.X * transform.M11) + (vector.Y * transform.M21) + (vector.Z * transform.M31) + (vector.W * transform.M41), (vector.X * transform.M11) + (vector.Y * transform.M21) + (vector.Z * transform.M31) + (vector.W * transform.M41),
(vector.X * transform.M12) + (vector.Y * transform.M22) + (vector.Z * transform.M32) + (vector.W * transform.M42), (vector.X * transform.M12) + (vector.Y * transform.M22) + (vector.Z * transform.M32) + (vector.W * transform.M42),
(vector.X * transform.M13) + (vector.Y * transform.M23) + (vector.Z * transform.M33) + (vector.W * transform.M43), (vector.X * transform.M13) + (vector.Y * transform.M23) + (vector.Z * transform.M33) + (vector.W * transform.M43),
@ -1071,10 +1071,10 @@ namespace math
/// </summary> /// </summary>
/// <param name="vector">The source vector.</param> /// <param name="vector">The source vector.</param>
/// <param name="transform">The transformation <see cref="math.Matrix"/>.</param> /// <param name="transform">The transformation <see cref="math.Matrix"/>.</param>
/// <returns>The transformed <see cref="math.Vector4"/>.</returns> /// <returns>The transformed <see cref="math.Vec4"/>.</returns>
public static Vector4 Transform(Vector4 vector, Matrix transform) public static Vec4 Transform(Vec4 vector, Matrix transform)
{ {
Vector4 result; Vec4 result;
Transform(ref vector, ref transform, out result); Transform(ref vector, ref transform, out result);
return result; return result;
} }
@ -1088,7 +1088,7 @@ namespace math
/// This array may be the same array as <paramref name="source"/>.</param> /// This array may be the same array as <paramref name="source"/>.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="source"/> or <paramref name="destination"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown when <paramref name="source"/> or <paramref name="destination"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="destination"/> is shorter in length than <paramref name="source"/>.</exception> /// <exception cref="ArgumentOutOfRangeException">Thrown when <paramref name="destination"/> is shorter in length than <paramref name="source"/>.</exception>
public static void Transform(Vector4[] source, ref Matrix transform, Vector4[] destination) public static void Transform(Vec4[] source, ref Matrix transform, Vec4[] destination)
{ {
if (source == null) if (source == null)
throw new ArgumentNullException("source"); throw new ArgumentNullException("source");
@ -1110,9 +1110,9 @@ namespace math
/// <param name="right">The second vector to add.</param> /// <param name="right">The second vector to add.</param>
/// <returns>The sum of the two vectors.</returns> /// <returns>The sum of the two vectors.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator +(Vector4 left, Vector4 right) public static Vec4 operator +(Vec4 left, Vec4 right)
{ {
return new Vector4(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W); return new Vec4(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W);
} }
/// <summary> /// <summary>
@ -1121,7 +1121,7 @@ namespace math
/// <param name="value">The vector to assert (unchange).</param> /// <param name="value">The vector to assert (unchange).</param>
/// <returns>The asserted (unchanged) vector.</returns> /// <returns>The asserted (unchanged) vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator +(Vector4 value) public static Vec4 operator +(Vec4 value)
{ {
return value; return value;
} }
@ -1133,9 +1133,9 @@ namespace math
/// <param name="right">The second vector to subtract.</param> /// <param name="right">The second vector to subtract.</param>
/// <returns>The difference of the two vectors.</returns> /// <returns>The difference of the two vectors.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator -(Vector4 left, Vector4 right) public static Vec4 operator -(Vec4 left, Vec4 right)
{ {
return new Vector4(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W); return new Vec4(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W);
} }
/// <summary> /// <summary>
@ -1144,9 +1144,9 @@ namespace math
/// <param name="value">The vector to negate.</param> /// <param name="value">The vector to negate.</param>
/// <returns>A vector facing in the opposite direction.</returns> /// <returns>A vector facing in the opposite direction.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator -(Vector4 value) public static Vec4 operator -(Vec4 value)
{ {
return new Vector4(-value.X, -value.Y, -value.Z, -value.W); return new Vec4(-value.X, -value.Y, -value.Z, -value.W);
} }
/// <summary> /// <summary>
@ -1156,9 +1156,9 @@ namespace math
/// <param name="scale">The amount by which to scale the vector.</param> /// <param name="scale">The amount by which to scale the vector.</param>
/// <returns>The scaled vector.</returns> /// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator *(float scale, Vector4 value) public static Vec4 operator *(float scale, Vec4 value)
{ {
return new Vector4(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale); return new Vec4(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale);
} }
/// <summary> /// <summary>
@ -1168,9 +1168,9 @@ namespace math
/// <param name="scale">The amount by which to scale the vector.</param> /// <param name="scale">The amount by which to scale the vector.</param>
/// <returns>The scaled vector.</returns> /// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator *(Vector4 value, float scale) public static Vec4 operator *(Vec4 value, float scale)
{ {
return new Vector4(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale); return new Vec4(value.X * scale, value.Y * scale, value.Z * scale, value.W * scale);
} }
/// <summary> /// <summary>
@ -1180,9 +1180,9 @@ namespace math
/// <param name="right">The second vector to multiply.</param> /// <param name="right">The second vector to multiply.</param>
/// <returns>The multiplication of the two vectors.</returns> /// <returns>The multiplication of the two vectors.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator *(Vector4 left, Vector4 right) public static Vec4 operator *(Vec4 left, Vec4 right)
{ {
return new Vector4(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W); return new Vec4(left.X * right.X, left.Y * right.Y, left.Z * right.Z, left.W * right.W);
} }
/// <summary> /// <summary>
@ -1192,9 +1192,9 @@ namespace math
/// <param name="scale">The amount by which to scale the vector.</param> /// <param name="scale">The amount by which to scale the vector.</param>
/// <returns>The scaled vector.</returns> /// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator /(Vector4 value, float scale) public static Vec4 operator /(Vec4 value, float scale)
{ {
return new Vector4(value.X / scale, value.Y / scale, value.Z / scale, value.W / scale); return new Vec4(value.X / scale, value.Y / scale, value.Z / scale, value.W / scale);
} }
/// <summary> /// <summary>
@ -1204,9 +1204,9 @@ namespace math
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The scaled vector.</returns> /// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator /(float numerator, Vector4 value) public static Vec4 operator /(float numerator, Vec4 value)
{ {
return new Vector4(numerator / value.X, numerator / value.Y, numerator / value.Z, numerator / value.W); return new Vec4(numerator / value.X, numerator / value.Y, numerator / value.Z, numerator / value.W);
} }
/// <summary> /// <summary>
@ -1216,9 +1216,9 @@ namespace math
/// <param name="by">The by.</param> /// <param name="by">The by.</param>
/// <returns>The scaled vector.</returns> /// <returns>The scaled vector.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Vector4 operator /(Vector4 value, Vector4 by) public static Vec4 operator /(Vec4 value, Vec4 by)
{ {
return new Vector4(value.X / by.X, value.Y / by.Y, value.Z / by.Z, value.W / by.W); return new Vec4(value.X / by.X, value.Y / by.Y, value.Z / by.Z, value.W / by.W);
} }
/// <summary> /// <summary>
@ -1227,7 +1227,7 @@ namespace math
/// <param name="left">The first value to compare.</param> /// <param name="left">The first value to compare.</param>
/// <param name="right">The second value to compare.</param> /// <param name="right">The second value to compare.</param>
/// <returns><c>true</c> if <paramref name="left"/> has the same value as <paramref name="right"/>; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if <paramref name="left"/> has the same value as <paramref name="right"/>; otherwise, <c>false</c>.</returns>
public static bool operator ==(Vector4 left, Vector4 right) public static bool operator ==(Vec4 left, Vec4 right)
{ {
return left.Equals(right); return left.Equals(right);
} }
@ -1238,29 +1238,29 @@ namespace math
/// <param name="left">The first value to compare.</param> /// <param name="left">The first value to compare.</param>
/// <param name="right">The second value to compare.</param> /// <param name="right">The second value to compare.</param>
/// <returns><c>true</c> if <paramref name="left"/> has a different value than <paramref name="right"/>; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if <paramref name="left"/> has a different value than <paramref name="right"/>; otherwise, <c>false</c>.</returns>
public static bool operator !=(Vector4 left, Vector4 right) public static bool operator !=(Vec4 left, Vec4 right)
{ {
return !left.Equals(right); return !left.Equals(right);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="math.Vector4"/> to <see cref="math.Vec2"/>. /// Performs an explicit conversion from <see cref="math.Vec4"/> to <see cref="math.Vec2"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vec2(Vector4 value) public static explicit operator Vec2(Vec4 value)
{ {
return new Vec2(value.X, value.Y); return new Vec2(value.X, value.Y);
} }
/// <summary> /// <summary>
/// Performs an explicit conversion from <see cref="math.Vector4"/> to <see cref="math.Vector3"/>. /// Performs an explicit conversion from <see cref="math.Vec4"/> to <see cref="math.Vec3"/>.
/// </summary> /// </summary>
/// <param name="value">The value.</param> /// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns> /// <returns>The result of the conversion.</returns>
public static explicit operator Vector3(Vector4 value) public static explicit operator Vec3(Vec4 value)
{ {
return new Vector3(value.X, value.Y, value.Z); return new Vec3(value.X, value.Y, value.Z);
} }
/// <summary> /// <summary>
@ -1331,13 +1331,13 @@ namespace math
} }
/// <summary> /// <summary>
/// Determines whether the specified <see cref="math.Vector4"/> is equal to this instance. /// Determines whether the specified <see cref="math.Vec4"/> is equal to this instance.
/// </summary> /// </summary>
/// <param name="other">The <see cref="math.Vector4"/> to compare with this instance.</param> /// <param name="other">The <see cref="math.Vec4"/> to compare with this instance.</param>
/// <returns> /// <returns>
/// <c>true</c> if the specified <see cref="math.Vector4"/> is equal to this instance; otherwise, <c>false</c>. /// <c>true</c> if the specified <see cref="math.Vec4"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns> /// </returns>
public bool Equals(Vector4 other) public bool Equals(Vec4 other)
{ {
return ((float)Math.Abs(other.X - X) < MathUtil.ZeroTolerance && return ((float)Math.Abs(other.X - X) < MathUtil.ZeroTolerance &&
(float)Math.Abs(other.Y - Y) < MathUtil.ZeroTolerance && (float)Math.Abs(other.Y - Y) < MathUtil.ZeroTolerance &&
@ -1360,7 +1360,7 @@ namespace math
if (value.GetType() != GetType()) if (value.GetType() != GetType())
return false; return false;
return Equals((Vector4)value); return Equals((Vec4)value);
} }
#if WPFInterop #if WPFInterop

View File

@ -20,7 +20,7 @@ namespace math
/// Return the X/Y components of the vector. /// Return the X/Y components of the vector.
/// </summary> /// </summary>
/// <param name="vector">the input vector</param> /// <param name="vector">the input vector</param>
public static Vec2 XY(this Vector3 vector) public static Vec2 XY(this Vec3 vector)
{ {
return new Vec2(vector.X, vector.Y); return new Vec2(vector.X, vector.Y);
} }
@ -29,7 +29,7 @@ namespace math
/// Return the X/Z components of the vector. /// Return the X/Z components of the vector.
/// </summary> /// </summary>
/// <param name="vector">the input vector</param> /// <param name="vector">the input vector</param>
public static Vec2 XZ(this Vector3 vector) public static Vec2 XZ(this Vec3 vector)
{ {
return new Vec2(vector.X, vector.Z); return new Vec2(vector.X, vector.Z);
} }
@ -38,7 +38,7 @@ namespace math
/// Return the Y/Z components of the vector. /// Return the Y/Z components of the vector.
/// </summary> /// </summary>
/// <param name="vector">the input vector</param> /// <param name="vector">the input vector</param>
public static Vec2 YZ(this Vector3 vector) public static Vec2 YZ(this Vec3 vector)
{ {
return new Vec2(vector.Y, vector.Z); return new Vec2(vector.Y, vector.Z);
} }
@ -47,7 +47,7 @@ namespace math
/// Return the X/Y components of the vector. /// Return the X/Y components of the vector.
/// </summary> /// </summary>
/// <param name="vector">the input vector</param> /// <param name="vector">the input vector</param>
public static Vec2 XY(this Vector4 vector) public static Vec2 XY(this Vec4 vector)
{ {
return new Vec2(vector.X, vector.Y); return new Vec2(vector.X, vector.Y);
} }
@ -56,9 +56,9 @@ namespace math
/// Return the X/Y/Z components of the vector. /// Return the X/Y/Z components of the vector.
/// </summary> /// </summary>
/// <param name="vector">the input vector</param> /// <param name="vector">the input vector</param>
public static Vector3 XYZ(this Vector4 vector) public static Vec3 XYZ(this Vec4 vector)
{ {
return new Vector3(vector.X, vector.Y, vector.Z); return new Vec3(vector.X, vector.Y, vector.Z);
} }
} }
} }