-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathMathUtils.cs
More file actions
37 lines (32 loc) · 809 Bytes
/
Copy pathMathUtils.cs
File metadata and controls
37 lines (32 loc) · 809 Bytes
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
30
31
32
33
34
35
36
37
// Copyright (c) 2026 Nenkai
// SPDX-License-Identifier: MIT
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
namespace PDTools.Utils;
public static class MathUtils
{
public static float GetAxis(this Vector3 vec, int axis)
{
if (axis == 0)
return vec.X;
else if (axis == 1)
return vec.Y;
else
return vec.Z;
}
public static void SetAxis(this ref Vector3 vec, int axis, float value)
{
if (axis == 0)
vec.X = value;
else if (axis == 1)
vec.Y = value;
else
vec.Z = value;
}
public static float Lerp(float value1, float value2, float amount)
{
return (value1 * (1f - amount)) + (value2 * amount);
}
}