You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.3 KiB
82 lines
2.3 KiB
using System;
|
|
using UnityEngine;
|
|
|
|
namespace MU3
|
|
{
|
|
// Token: 0x02000482 RID: 1154
|
|
public static class CustomMath
|
|
{
|
|
// Token: 0x06001C1E RID: 7198 RVA: 0x000B4DB4 File Offset: 0x000B4DB4
|
|
public static bool isZero(float x, float delta = 1E-05f)
|
|
{
|
|
return (x >= 0f) ? (x < delta) : (delta < x);
|
|
}
|
|
|
|
// Token: 0x06001C1F RID: 7199 RVA: 0x000B4DD0 File Offset: 0x000B4DD0
|
|
public static bool equals(float x0, float x1, float delta = 1E-05f)
|
|
{
|
|
return Mathf.Abs(x0 - x1) < delta;
|
|
}
|
|
|
|
// Token: 0x06001C20 RID: 7200 RVA: 0x000B4DE0 File Offset: 0x000B4DE0
|
|
public static bool equals2(Vector2 x0, Vector2 x1, float delta = 1E-05f)
|
|
{
|
|
return Mathf.Abs(x0.x - x1.x) < delta && Mathf.Abs(x0.y - x1.y) < delta;
|
|
}
|
|
|
|
// Token: 0x06001C21 RID: 7201 RVA: 0x000B4E18 File Offset: 0x000B4E18
|
|
public static bool equals3(Vector3 x0, Vector3 x1, float delta = 1E-05f)
|
|
{
|
|
return Mathf.Abs(x0.x - x1.x) < delta && Mathf.Abs(x0.y - x1.y) < delta && Mathf.Abs(x0.z - x1.z) < delta;
|
|
}
|
|
|
|
// Token: 0x06001C22 RID: 7202 RVA: 0x000B4E74 File Offset: 0x000B4E74
|
|
public static bool equals4(Vector4 x0, Vector4 x1, float delta = 1E-05f)
|
|
{
|
|
return Mathf.Abs(x0.x - x1.x) < delta && Mathf.Abs(x0.y - x1.y) < delta && Mathf.Abs(x0.z - x1.z) < delta && Mathf.Abs(x0.w - x1.w) < delta;
|
|
}
|
|
|
|
// Token: 0x06001C23 RID: 7203 RVA: 0x000B4EEC File Offset: 0x000B4EEC
|
|
public static int floatToInt32(float value)
|
|
{
|
|
return (int)value;
|
|
}
|
|
|
|
// Token: 0x06001C24 RID: 7204 RVA: 0x000B4EF4 File Offset: 0x000B4EF4
|
|
public static float int32ToFloat(int value)
|
|
{
|
|
return (float)value;
|
|
}
|
|
|
|
// Token: 0x06001C25 RID: 7205 RVA: 0x000B4EFC File Offset: 0x000B4EFC
|
|
public static float Abs(float x)
|
|
{
|
|
// return x & (float)int.MaxValue;
|
|
return (int)x & int.MaxValue;
|
|
}
|
|
|
|
// Token: 0x06001C26 RID: 7206 RVA: 0x000B4F18 File Offset: 0x000B4F18
|
|
public static Vector3 normalize(Vector3 v)
|
|
{
|
|
float num = Mathf.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
|
if (num <= 1E-06f)
|
|
{
|
|
return Vector3.zero;
|
|
}
|
|
num = 1f / num;
|
|
return v * num;
|
|
}
|
|
|
|
// Token: 0x06001C27 RID: 7207 RVA: 0x000B4F7C File Offset: 0x000B4F7C
|
|
public static Vector3 normalizeNoCheck(Vector3 v)
|
|
{
|
|
float num = Mathf.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
|
num = 1f / num;
|
|
return v * num;
|
|
}
|
|
|
|
// Token: 0x04004731 RID: 18225
|
|
public const float float_delta_ = 1E-05f;
|
|
}
|
|
}
|