1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-22 19:18:47 +00:00

Remove VectorExtensions and some QuaternionExtensions

These are now provided by X10D 3.2.0-nightly.145
This commit is contained in:
Oliver Booth 2022-12-06 02:20:16 +00:00
parent 68fa2203d6
commit 148fd22c7d
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
7 changed files with 9 additions and 68 deletions

View File

@ -59,7 +59,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0"/>
<PackageReference Include="System.Drawing.Common" Version="7.0.0"/>
<PackageReference Include="X10D" Version="3.2.0-nightly.144"/>
<PackageReference Include="X10D" Version="3.2.0-nightly.145"/>
<PackageReference Include="ZString" Version="2.5.0"/>
</ItemGroup>

View File

@ -3,6 +3,7 @@ using System.Numerics;
using VpSharp.Extensions;
using VpSharp.Internal;
using VpSharp.Internal.NativeAttributes;
using X10D.Numerics;
using static VpSharp.Internal.NativeMethods;
namespace VpSharp.Entities;

View File

@ -3,6 +3,7 @@ using VpSharp.Exceptions;
using VpSharp.Extensions;
using VpSharp.Internal;
using VpSharp.Internal.NativeAttributes;
using X10D.Numerics;
using static VpSharp.Internal.NativeMethods;
namespace VpSharp.Entities;

View File

@ -23,43 +23,16 @@ public static class QuaternionExtensions
}
/// <summary>
/// Converts this quaternion to a <see cref="Vector3d" /> containing an Euler representation of the rotation.
/// Converts this quaternion to an axis/angle pair.
/// </summary>
/// <param name="value">The quaternion to convert.</param>
/// <returns>The Euler representation of <paramref name="value" />.</returns>
public static Vector3 ToEulerAnglesF(this Quaternion value)
{
value = Quaternion.Normalize(value);
float x = MathF.Atan2(2 * (value.X * value.W - value.Y * value.Z), 1 - 2 * (value.X * value.X + value.Z * value.Z));
float y = MathF.Asin(2 * (value.X * value.Z + value.Y * value.W));
float z = MathF.Atan2(2 * (value.Z * value.W - value.X * value.Y), 1 - 2 * (value.Y * value.Y + value.Z * value.Z));
return new Vector3(x, y, z) * (180 / MathF.PI);
}
/// <param name="axis">The axis value.</param>
/// <param name="angle">The angle value.</param>
#pragma warning disable CA1021
/// <summary>
/// Converts this quaternion to an axis/angle pair.
/// </summary>
/// <param name="value">The quaternion to convert.</param>
/// <param name="axis">The axis value.</param>
/// <param name="angle">The angle value.</param>
/// <see href="https://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm"/>
public static void ToAxisAngle(this Quaternion value, out Vector3 axis, out float angle)
{
angle = 2 * MathF.Acos(value.W);
axis = Vector3.Normalize(new Vector3(value.X, value.Y, value.Z));
}
/// <summary>
/// Converts this quaternion to an axis/angle pair.
/// </summary>
/// <param name="value">The quaternion to convert.</param>
/// <param name="axis">The axis value.</param>
/// <param name="angle">The angle value.</param>
public static void ToAxisAngle(this Quaternion value, out Vector3d axis, out double angle)
#pragma warning restore CA1021
{
angle = 2 * Math.Acos(value.W);
axis = Vector3d.Normalize(new Vector3d(value.X, value.Y, value.Z));
}
#pragma warning restore CA1021
}

View File

@ -1,36 +0,0 @@
using System.Numerics;
namespace VpSharp.Extensions;
public static class VectorExtensions
{
/// <summary>
/// Deconstructs this vector.
/// </summary>
/// <param name="vector">The vector to deconstruct.</param>
/// <param name="x">The X component value.</param>
/// <param name="y">The Y component value.</param>
/// <param name="z">The Z component value.</param>
public static void Deconstruct(this Vector3 vector, out float x, out float y, out float z)
{
x = vector.X;
y = vector.Y;
z = vector.Z;
}
/// <summary>
/// Deconstructs this vector.
/// </summary>
/// <param name="vector">The vector to deconstruct.</param>
/// <param name="x">The X component value.</param>
/// <param name="y">The Y component value.</param>
/// <param name="z">The Z component value.</param>
/// <param name="w">The W component value.</param>
public static void Deconstruct(this Vector4 vector, out float x, out float y, out float z, out float w)
{
x = vector.X;
y = vector.Y;
z = vector.Z;
w = vector.W;
}
}

View File

@ -1,5 +1,6 @@
using Cysharp.Text;
using VpSharp.Extensions;
using X10D.Numerics;
namespace VpSharp.Internal.ValueConverters;

View File

@ -1,5 +1,6 @@
using Cysharp.Text;
using VpSharp.Extensions;
using X10D.Numerics;
namespace VpSharp.Internal.ValueConverters;