-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathVector4d.Extensions.cs
More file actions
29 lines (26 loc) · 1.1 KB
/
Copy pathVector4d.Extensions.cs
File metadata and controls
29 lines (26 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//=======================================================================
// Vector4d.Extensions.cs
//=======================================================================
// MIT License, Copyright (c) 2024–present David Oravsky (mrdav30)
// See LICENSE file in the project root for full license information.
//=======================================================================
using UnityEngine;
namespace FixedMathSharp
{
/// <summary>
/// Provides direct component conversions between Unity Vector4 and FixedMathSharp Vector4d.
/// </summary>
public static partial class Vector4dExtensions
{
/// <summary>
/// Converts a Unity Vector4 to a FixedMathSharp Vector4d.
/// </summary>
public static Vector4d ToVector4d(this Vector4 vec) =>
Vector4d.FromDouble(vec.x, vec.y, vec.z, vec.w);
/// <summary>
/// Converts a FixedMathSharp Vector4d to a Unity Vector4.
/// </summary>
public static Vector4 ToVector4(this Vector4d vec) =>
new Vector4((float)vec.X, (float)vec.Y, (float)vec.Z, (float)vec.W);
}
}