Cleanup some warnings.
This commit is contained in:
@@ -251,7 +251,7 @@ namespace Framework.GameMath
|
||||
public Vector3 corner(int index)
|
||||
{
|
||||
// default constructor inits all components to 0
|
||||
Vector3 v = new Vector3();
|
||||
Vector3 v = new();
|
||||
|
||||
switch (index)
|
||||
{
|
||||
@@ -312,7 +312,7 @@ namespace Framework.GameMath
|
||||
|
||||
public static AxisAlignedBox operator +(AxisAlignedBox box, Vector3 v)
|
||||
{
|
||||
AxisAlignedBox outt = new AxisAlignedBox();
|
||||
AxisAlignedBox outt = new();
|
||||
outt.Lo = box.Lo + v;
|
||||
outt.Hi = box.Hi + v;
|
||||
return outt;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Framework.GameMath
|
||||
Inside = true;
|
||||
Vector3 MinB = box.Lo;
|
||||
Vector3 MaxB = box.Hi;
|
||||
Vector3 MaxT = new Vector3(-1.0f, -1.0f, -1.0f);
|
||||
Vector3 MaxT = new(-1.0f, -1.0f, -1.0f);
|
||||
|
||||
// Find candidate planes.
|
||||
for (int i = 0; i < 3; ++i)
|
||||
|
||||
@@ -95,11 +95,11 @@ namespace Framework.GameMath
|
||||
/// <summary>
|
||||
/// 4-dimentional single-precision floating point zero matrix.
|
||||
/// </summary>
|
||||
public static readonly Matrix2 Zero = new Matrix2(0, 0, 0, 0);
|
||||
public static readonly Matrix2 Zero = new(0, 0, 0, 0);
|
||||
/// <summary>
|
||||
/// 4-dimentional single-precision floating point identity matrix.
|
||||
/// </summary>
|
||||
public static readonly Matrix2 Identity = new Matrix2(1, 0, 0, 1);
|
||||
public static readonly Matrix2 Identity = new(1, 0, 0, 1);
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
@@ -186,7 +186,7 @@ namespace Framework.GameMath
|
||||
/// </remarks>
|
||||
public static Matrix2 Parse(string value)
|
||||
{
|
||||
Regex r = new Regex(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
|
||||
Regex r = new(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -219,7 +219,7 @@ namespace Framework.GameMath
|
||||
/// </remarks>
|
||||
public static bool TryParse(string value, out Matrix2 result)
|
||||
{
|
||||
Regex r = new Regex(regularExp, RegexOptions.Singleline);
|
||||
Regex r = new(regularExp, RegexOptions.Singleline);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -409,7 +409,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A new <see cref="Matrix2"/> instance containing the transposed matrix.</returns>
|
||||
public static Matrix2 Transpose(Matrix2 m)
|
||||
{
|
||||
Matrix2 t = new Matrix2(m);
|
||||
Matrix2 t = new(m);
|
||||
t.Transpose();
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -102,11 +102,11 @@ namespace Framework.GameMath
|
||||
/// <summary>
|
||||
/// 4-dimentional single-precision floating point zero matrix.
|
||||
/// </summary>
|
||||
public static readonly Matrix3 Zero = new Matrix3(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
public static readonly Matrix3 Zero = new(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
/// <summary>
|
||||
/// 4-dimentional single-precision floating point identity matrix.
|
||||
/// </summary>
|
||||
public static readonly Matrix3 Identity = new Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1);
|
||||
public static readonly Matrix3 Identity = new(1, 0, 0, 0, 1, 0, 0, 0, 1);
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
@@ -241,7 +241,7 @@ namespace Framework.GameMath
|
||||
/// </remarks>
|
||||
public static Matrix3 Parse(string value)
|
||||
{
|
||||
Regex r = new Regex(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
|
||||
Regex r = new(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -280,7 +280,7 @@ namespace Framework.GameMath
|
||||
/// </remarks>
|
||||
public static bool TryParse(string value, out Matrix3 result)
|
||||
{
|
||||
Regex r = new Regex(regularExp, RegexOptions.Singleline);
|
||||
Regex r = new(regularExp, RegexOptions.Singleline);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -519,7 +519,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A new <see cref="Matrix3"/> instance containing the transposed matrix.</returns>
|
||||
public static Matrix3 Transpose(Matrix3 m)
|
||||
{
|
||||
Matrix3 t = new Matrix3(m);
|
||||
Matrix3 t = new(m);
|
||||
t.Transpose();
|
||||
return t;
|
||||
}
|
||||
@@ -530,15 +530,15 @@ namespace Framework.GameMath
|
||||
|
||||
fCos = (float)Math.Cos(fYAngle);
|
||||
fSin = (float)Math.Sin(fYAngle);
|
||||
Matrix3 kZMat = new Matrix3(fCos, -fSin, 0.0f, fSin, fCos, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
Matrix3 kZMat = new(fCos, -fSin, 0.0f, fSin, fCos, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
fCos = (float)Math.Cos(fPAngle);
|
||||
fSin = (float)Math.Sin(fPAngle);
|
||||
Matrix3 kYMat = new Matrix3(fCos, 0.0f, fSin, 0.0f, 1.0f, 0.0f, -fSin, 0.0f, fCos);
|
||||
Matrix3 kYMat = new(fCos, 0.0f, fSin, 0.0f, 1.0f, 0.0f, -fSin, 0.0f, fCos);
|
||||
|
||||
fCos = (float)Math.Cos(fRAngle);
|
||||
fSin = (float)Math.Sin(fRAngle);
|
||||
Matrix3 kXMat = new Matrix3(1.0f, 0.0f, 0.0f, 0.0f, fCos, -fSin, 0.0f, fSin, fCos);
|
||||
Matrix3 kXMat = new(1.0f, 0.0f, 0.0f, 0.0f, fCos, -fSin, 0.0f, fSin, fCos);
|
||||
|
||||
return (kZMat * (kYMat * kXMat));
|
||||
}
|
||||
|
||||
@@ -109,11 +109,11 @@ namespace Framework.GameMath
|
||||
/// <summary>
|
||||
/// 4-dimentional single-precision floating point zero matrix.
|
||||
/// </summary>
|
||||
public static readonly Matrix4 Zero = new Matrix4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
public static readonly Matrix4 Zero = new(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
/// <summary>
|
||||
/// 4-dimentional single-precision floating point identity matrix.
|
||||
/// </summary>
|
||||
public static readonly Matrix4 Identity = new Matrix4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
||||
public static readonly Matrix4 Identity = new(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
@@ -313,7 +313,7 @@ namespace Framework.GameMath
|
||||
/// </remarks>
|
||||
public static Matrix4 Parse(string value)
|
||||
{
|
||||
Regex r = new Regex(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
|
||||
Regex r = new(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -360,7 +360,7 @@ namespace Framework.GameMath
|
||||
/// </remarks>
|
||||
public static bool TryParse(string value, out Matrix4 result)
|
||||
{
|
||||
Regex r = new Regex(regularExp, RegexOptions.Singleline);
|
||||
Regex r = new(regularExp, RegexOptions.Singleline);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -661,7 +661,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A new <see cref="Matrix4"/> instance containing the transposed matrix.</returns>
|
||||
public static Matrix4 Transpose(Matrix4 m)
|
||||
{
|
||||
Matrix4 t = new Matrix4(m);
|
||||
Matrix4 t = new(m);
|
||||
t.Transpose();
|
||||
return t;
|
||||
}
|
||||
@@ -840,7 +840,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A new <see cref="Vector4"/> instance containing the result.</returns>
|
||||
public static Vector4 operator *(Matrix4 matrix, Vector4 vector)
|
||||
{
|
||||
Vector4 result = new Vector4();
|
||||
Vector4 result = new();
|
||||
for (int r = 0; r < 4; ++r)
|
||||
{
|
||||
for (int c = 0; c < 4; ++c)
|
||||
|
||||
@@ -119,15 +119,15 @@ namespace Framework.GameMath
|
||||
/// <summary>
|
||||
/// Plane on the X axis.
|
||||
/// </summary>
|
||||
public static readonly Plane XPlane = new Plane(Vector3.XAxis, Vector3.Zero);
|
||||
public static readonly Plane XPlane = new(Vector3.XAxis, Vector3.Zero);
|
||||
/// <summary>
|
||||
/// Plane on the Y axis.
|
||||
/// </summary>
|
||||
public static readonly Plane YPlane = new Plane(Vector3.YAxis, Vector3.Zero);
|
||||
public static readonly Plane YPlane = new(Vector3.YAxis, Vector3.Zero);
|
||||
/// <summary>
|
||||
/// Plane on the Z axis.
|
||||
/// </summary>
|
||||
public static readonly Plane ZPlane = new Plane(Vector3.ZAxis, Vector3.Zero);
|
||||
public static readonly Plane ZPlane = new(Vector3.ZAxis, Vector3.Zero);
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
@@ -134,27 +134,27 @@ namespace Framework.GameMath
|
||||
/// <summary>
|
||||
/// Double-precision floating point zero quaternion.
|
||||
/// </summary>
|
||||
public static readonly Quaternion Zero = new Quaternion(0, 0, 0, 0);
|
||||
public static readonly Quaternion Zero = new(0, 0, 0, 0);
|
||||
/// <summary>
|
||||
/// Double-precision floating point identity quaternion.
|
||||
/// </summary>
|
||||
public static readonly Quaternion Identity = new Quaternion(0, 0, 0, 1);
|
||||
public static readonly Quaternion Identity = new(0, 0, 0, 1);
|
||||
/// <summary>
|
||||
/// Double-precision floating point X-Axis quaternion.
|
||||
/// </summary>
|
||||
public static readonly Quaternion XAxis = new Quaternion(1, 0, 0, 0);
|
||||
public static readonly Quaternion XAxis = new(1, 0, 0, 0);
|
||||
/// <summary>
|
||||
/// Double-precision floating point Y-Axis quaternion.
|
||||
/// </summary>
|
||||
public static readonly Quaternion YAxis = new Quaternion(0, 1, 0, 0);
|
||||
public static readonly Quaternion YAxis = new(0, 1, 0, 0);
|
||||
/// <summary>
|
||||
/// Double-precision floating point Z-Axis quaternion.
|
||||
/// </summary>
|
||||
public static readonly Quaternion ZAxis = new Quaternion(0, 0, 1, 0);
|
||||
public static readonly Quaternion ZAxis = new(0, 0, 1, 0);
|
||||
/// <summary>
|
||||
/// Double-precision floating point W-Axis quaternion.
|
||||
/// </summary>
|
||||
public static readonly Quaternion WAxis = new Quaternion(0, 0, 0, 1);
|
||||
public static readonly Quaternion WAxis = new(0, 0, 0, 1);
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
@@ -261,7 +261,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="Quaternion"/> that represents the vector specified by the <paramref name="value"/> parameter.</returns>
|
||||
public static Quaternion Parse(string value)
|
||||
{
|
||||
Regex r = new Regex(@"\((?<w>.*),(?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.None);
|
||||
Regex r = new(@"\((?<w>.*),(?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.None);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -289,7 +289,7 @@ namespace Framework.GameMath
|
||||
/// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
|
||||
public static bool TryParse(string value, out Quaternion result)
|
||||
{
|
||||
Regex r = new Regex(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.None);
|
||||
Regex r = new(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.None);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -365,7 +365,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A new <see cref="Quaternion"/> containing the result.</returns>
|
||||
public static Quaternion Multiply(Quaternion left, Quaternion right)
|
||||
{
|
||||
Quaternion result = new Quaternion();
|
||||
Quaternion result = new();
|
||||
result.X = left.W * right.X + left.X * right.W + left.Y * right.Z - left.Z * right.Y;
|
||||
result.Y = left.W * right.Y + left.Y * right.W + left.Z * right.X - left.X * right.Z;
|
||||
result.Z = left.W * right.Z + left.Z * right.W + left.X * right.Y - left.Y * right.X;
|
||||
@@ -394,7 +394,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="Quaternion"/> instance to hold the result.</returns>
|
||||
public static Quaternion Multiply(Quaternion quaternion, float scalar)
|
||||
{
|
||||
Quaternion result = new Quaternion(quaternion);
|
||||
Quaternion result = new(quaternion);
|
||||
result.X *= scalar;
|
||||
result.Y *= scalar;
|
||||
result.Z *= scalar;
|
||||
@@ -429,7 +429,7 @@ namespace Framework.GameMath
|
||||
throw new DivideByZeroException("Dividing quaternion by zero");
|
||||
}
|
||||
|
||||
Quaternion result = new Quaternion(quaternion);
|
||||
Quaternion result = new(quaternion);
|
||||
result.X /= scalar;
|
||||
result.Y /= scalar;
|
||||
result.Z /= scalar;
|
||||
@@ -508,7 +508,7 @@ namespace Framework.GameMath
|
||||
/// <returns>The quaternion's logarithm.</returns>
|
||||
public static Quaternion Log(Quaternion quaternion)
|
||||
{
|
||||
Quaternion result = new Quaternion(0, 0, 0, 0);
|
||||
Quaternion result = new(0, 0, 0, 0);
|
||||
|
||||
if (Math.Abs(quaternion.W) < 1.0)
|
||||
{
|
||||
@@ -539,7 +539,7 @@ namespace Framework.GameMath
|
||||
/// <returns>The quaternion's exponent.</returns>
|
||||
public Quaternion Exp(Quaternion quaternion)
|
||||
{
|
||||
Quaternion result = new Quaternion(0, 0, 0, 0);
|
||||
Quaternion result = new(0, 0, 0, 0);
|
||||
|
||||
float angle = (float)System.Math.Sqrt(quaternion.X * quaternion.X + quaternion.Y * quaternion.Y + quaternion.Z * quaternion.Z);
|
||||
float sin = (float)System.Math.Sin(angle);
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="Ray"/> that represents the vector specified by the <paramref name="s"/> parameter.</returns>
|
||||
public static Ray Parse(string s)
|
||||
{
|
||||
Regex r = new Regex(@"\((?<origin>\([^\)]*\)), (?<direction>\([^\)]*\))\)", RegexOptions.None);
|
||||
Regex r = new(@"\((?<origin>\([^\)]*\)), (?<direction>\([^\)]*\))\)", RegexOptions.None);
|
||||
Match m = r.Match(s);
|
||||
if (m.Success)
|
||||
{
|
||||
|
||||
@@ -88,15 +88,15 @@ namespace Framework.GameMath
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point zero vector.
|
||||
/// </summary>
|
||||
public static readonly Vector2 Zero = new Vector2(0.0f, 0.0f);
|
||||
public static readonly Vector2 Zero = new(0.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point X-Axis vector.
|
||||
/// </summary>
|
||||
public static readonly Vector2 XAxis = new Vector2(1.0f, 0.0f);
|
||||
public static readonly Vector2 XAxis = new(1.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point Y-Axis vector.
|
||||
/// </summary>
|
||||
public static readonly Vector2 YAxis = new Vector2(0.0f, 1.0f);
|
||||
public static readonly Vector2 YAxis = new(0.0f, 1.0f);
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
@@ -147,7 +147,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="Vector2"/> that represents the vector specified by the <paramref name="value"/> parameter.</returns>
|
||||
public static Vector2 Parse(string value)
|
||||
{
|
||||
Regex r = new Regex(@"\((?<x>.*),(?<y>.*)\)", RegexOptions.Singleline);
|
||||
Regex r = new(@"\((?<x>.*),(?<y>.*)\)", RegexOptions.Singleline);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -173,7 +173,7 @@ namespace Framework.GameMath
|
||||
/// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
|
||||
public static bool TryParse(string value, out Vector2 result)
|
||||
{
|
||||
Regex r = new Regex(@"\((?<x>.*),(?<y>.*)\)", RegexOptions.Singleline);
|
||||
Regex r = new(@"\((?<x>.*),(?<y>.*)\)", RegexOptions.Singleline);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -831,7 +831,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.</returns>
|
||||
public static explicit operator List<float>(Vector2 vector)
|
||||
{
|
||||
List<float> list = new List<float>();
|
||||
List<float> list = new();
|
||||
list.Add(vector.X);
|
||||
list.Add(vector.Y);
|
||||
|
||||
@@ -844,7 +844,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.</returns>
|
||||
public static explicit operator LinkedList<float>(Vector2 vector)
|
||||
{
|
||||
LinkedList<float> list = new LinkedList<float>();
|
||||
LinkedList<float> list = new();
|
||||
list.AddLast(vector.X);
|
||||
list.AddLast(vector.Y);
|
||||
|
||||
@@ -938,7 +938,7 @@ namespace Framework.GameMath
|
||||
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
||||
{
|
||||
StandardValuesCollection svc =
|
||||
new StandardValuesCollection(new object[3] { Vector2.Zero, Vector2.XAxis, Vector2.YAxis });
|
||||
new(new object[3] { Vector2.Zero, Vector2.XAxis, Vector2.YAxis });
|
||||
|
||||
return svc;
|
||||
}
|
||||
|
||||
@@ -88,23 +88,23 @@ namespace Framework.GameMath
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point zero vector.
|
||||
/// </summary>
|
||||
public static readonly Vector3 Zero = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
public static readonly Vector3 Zero = new(0.0f, 0.0f, 0.0f);
|
||||
|
||||
public static readonly Vector3 One = new Vector3(1.0f, 1.0f, 1.0f);
|
||||
public static readonly Vector3 One = new(1.0f, 1.0f, 1.0f);
|
||||
|
||||
public static readonly Vector3 Inf = new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
|
||||
public static readonly Vector3 Inf = new(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point X-Axis vector.
|
||||
/// </summary>
|
||||
public static readonly Vector3 XAxis = new Vector3(1.0f, 0.0f, 0.0f);
|
||||
public static readonly Vector3 XAxis = new(1.0f, 0.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point Y-Axis vector.
|
||||
/// </summary>
|
||||
public static readonly Vector3 YAxis = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
public static readonly Vector3 YAxis = new(0.0f, 1.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point Y-Axis vector.
|
||||
/// </summary>
|
||||
public static readonly Vector3 ZAxis = new Vector3(0.0f, 0.0f, 1.0f);
|
||||
public static readonly Vector3 ZAxis = new(0.0f, 0.0f, 1.0f);
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
@@ -152,7 +152,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="Vector3"/> that represents the vector specified by the <paramref name="value"/> parameter.</returns>
|
||||
public static Vector3 Parse(string value)
|
||||
{
|
||||
Regex r = new Regex(@"\((?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.Singleline);
|
||||
Regex r = new(@"\((?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.Singleline);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -179,7 +179,7 @@ namespace Framework.GameMath
|
||||
/// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
|
||||
public static bool TryParse(string value, out Vector3 result)
|
||||
{
|
||||
Regex r = new Regex(@"\((?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.Singleline);
|
||||
Regex r = new(@"\((?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.Singleline);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -901,7 +901,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.</returns>
|
||||
public static explicit operator List<float>(Vector3 vector)
|
||||
{
|
||||
List<float> list = new List<float>(3);
|
||||
List<float> list = new(3);
|
||||
list.Add(vector.X);
|
||||
list.Add(vector.Y);
|
||||
list.Add(vector.Z);
|
||||
@@ -915,7 +915,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.</returns>
|
||||
public static explicit operator LinkedList<float>(Vector3 vector)
|
||||
{
|
||||
LinkedList<float> list = new LinkedList<float>();
|
||||
LinkedList<float> list = new();
|
||||
list.AddLast(vector.X);
|
||||
list.AddLast(vector.Y);
|
||||
list.AddLast(vector.Z);
|
||||
@@ -1089,7 +1089,7 @@ namespace Framework.GameMath
|
||||
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
||||
{
|
||||
StandardValuesCollection svc =
|
||||
new StandardValuesCollection(new object[4] { Vector3.Zero, Vector3.XAxis, Vector3.YAxis, Vector3.ZAxis });
|
||||
new(new object[4] { Vector3.Zero, Vector3.XAxis, Vector3.YAxis, Vector3.ZAxis });
|
||||
|
||||
return svc;
|
||||
}
|
||||
|
||||
@@ -100,23 +100,23 @@ namespace Framework.GameMath
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point zero vector.
|
||||
/// </summary>
|
||||
public static readonly Vector4 Zero = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
public static readonly Vector4 Zero = new(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point X-Axis vector.
|
||||
/// </summary>
|
||||
public static readonly Vector4 XAxis = new Vector4(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
public static readonly Vector4 XAxis = new(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point Y-Axis vector.
|
||||
/// </summary>
|
||||
public static readonly Vector4 YAxis = new Vector4(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
public static readonly Vector4 YAxis = new(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point Y-Axis vector.
|
||||
/// </summary>
|
||||
public static readonly Vector4 ZAxis = new Vector4(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
public static readonly Vector4 ZAxis = new(0.0f, 0.0f, 1.0f, 0.0f);
|
||||
/// <summary>
|
||||
/// 4-Dimentional single-precision floating point Y-Axis vector.
|
||||
/// </summary>
|
||||
public static readonly Vector4 WAxis = new Vector4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
public static readonly Vector4 WAxis = new(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
@@ -185,7 +185,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="Vector4"/> that represents the vector specified by the <paramref name="value"/> parameter.</returns>
|
||||
public static Vector4 Parse(string value)
|
||||
{
|
||||
Regex r = new Regex(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.Singleline);
|
||||
Regex r = new(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.Singleline);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -213,7 +213,7 @@ namespace Framework.GameMath
|
||||
/// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
|
||||
public static bool TryParse(string value, out Vector4 result)
|
||||
{
|
||||
Regex r = new Regex(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.Singleline);
|
||||
Regex r = new(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.Singleline);
|
||||
Match m = r.Match(value);
|
||||
if (m.Success)
|
||||
{
|
||||
@@ -806,7 +806,7 @@ namespace Framework.GameMath
|
||||
|
||||
public static Vector4 operator *(Vector4 vector, Matrix4 M)
|
||||
{
|
||||
Vector4 result = new Vector4();
|
||||
Vector4 result = new();
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
result[i] = 0.0f;
|
||||
@@ -914,7 +914,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.</returns>
|
||||
public static explicit operator List<float>(Vector4 vector)
|
||||
{
|
||||
List<float> list = new List<float>(4);
|
||||
List<float> list = new(4);
|
||||
list.Add(vector.X);
|
||||
list.Add(vector.Y);
|
||||
list.Add(vector.Z);
|
||||
@@ -929,7 +929,7 @@ namespace Framework.GameMath
|
||||
/// <returns>A <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.</returns>
|
||||
public static explicit operator LinkedList<float>(Vector4 vector)
|
||||
{
|
||||
LinkedList<float> list = new LinkedList<float>();
|
||||
LinkedList<float> list = new();
|
||||
list.AddLast(vector.X);
|
||||
list.AddLast(vector.Y);
|
||||
list.AddLast(vector.Z);
|
||||
@@ -1025,7 +1025,7 @@ namespace Framework.GameMath
|
||||
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
||||
{
|
||||
StandardValuesCollection svc =
|
||||
new StandardValuesCollection(new object[5] { Vector4.Zero, Vector4.XAxis, Vector4.YAxis, Vector4.ZAxis, Vector4.WAxis });
|
||||
new(new object[5] { Vector4.Zero, Vector4.XAxis, Vector4.YAxis, Vector4.ZAxis, Vector4.WAxis });
|
||||
|
||||
return svc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user