forked from aly/qstbak
102 lines
2.1 KiB
C#
102 lines
2.1 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace SmartNav.Model.Navigation;
|
|
|
|
public sealed class SubRegionDefinition
|
|
{
|
|
public string Id { get; set; } = string.Empty;
|
|
|
|
public string? Comment { get; set; }
|
|
|
|
public float? MinY { get; set; }
|
|
|
|
public float? MaxY { get; set; }
|
|
|
|
public List<SubRegionVertex> Vertices { get; set; } = new List<SubRegionVertex>();
|
|
|
|
public bool Contains(float x, float y, float z)
|
|
{
|
|
int num = ((!MinY.HasValue) ? 292211161 : 292211158);
|
|
float x2 = default(float);
|
|
float x3 = default(float);
|
|
float z2 = default(float);
|
|
float z3 = default(float);
|
|
int count = default(int);
|
|
int num7 = default(int);
|
|
int index = default(int);
|
|
bool flag = default(bool);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = 292211164;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 9:
|
|
num = ((!(x < (x2 - x3) * (z - z2) / (z3 - z2) + x3)) ? 292211166 : 292211160);
|
|
break;
|
|
case 10:
|
|
num = ((!(y < MinY.Value)) ? 292211161 : 292211153);
|
|
break;
|
|
case 13:
|
|
return false;
|
|
case 8:
|
|
count = Vertices.Count;
|
|
num = ((count >= 3) ? 292211165 : 292211159);
|
|
break;
|
|
case 2:
|
|
{
|
|
int num9 = num7;
|
|
num3 = 1;
|
|
num4 = num9;
|
|
num7 = (num4 | num3) + (num4 & num3);
|
|
index = num9;
|
|
num = 292211162;
|
|
break;
|
|
}
|
|
case 11:
|
|
return false;
|
|
case 5:
|
|
num = ((!MaxY.HasValue) ? 292211156 : 292211154);
|
|
break;
|
|
case 14:
|
|
num = ((!(y > MaxY.Value)) ? 292211156 : 292211163);
|
|
break;
|
|
case 12:
|
|
x3 = Vertices[num7].X;
|
|
z2 = Vertices[num7].Z;
|
|
x2 = Vertices[index].X;
|
|
z3 = Vertices[index].Z;
|
|
num = ((z2 > z == z3 > z) ? 292211166 : 292211157);
|
|
break;
|
|
case 3:
|
|
return flag;
|
|
case 1:
|
|
{
|
|
flag = false;
|
|
num7 = 0;
|
|
int num8 = count;
|
|
num3 = 1;
|
|
num4 = num8;
|
|
index = ~(~num4 + num3);
|
|
num = 292211162;
|
|
break;
|
|
}
|
|
case 7:
|
|
return false;
|
|
case 0:
|
|
num = 292211158;
|
|
break;
|
|
case 4:
|
|
flag = !flag;
|
|
num = 292211166;
|
|
break;
|
|
case 6:
|
|
num = ((num7 < count) ? 292211152 : 292211167);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|