mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-22 14:08:49 +00:00
Remove VectorExtensions and some QuaternionExtensions
These are now provided by X10D 3.2.0-nightly.145
This commit is contained in:
parent
68fa2203d6
commit
148fd22c7d
@ -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>
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using Cysharp.Text;
|
||||
using VpSharp.Extensions;
|
||||
using X10D.Numerics;
|
||||
|
||||
namespace VpSharp.Internal.ValueConverters;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Cysharp.Text;
|
||||
using VpSharp.Extensions;
|
||||
using X10D.Numerics;
|
||||
|
||||
namespace VpSharp.Internal.ValueConverters;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user