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 Vertices { get; set; } = new List(); public bool Contains(float x, float y, float z) { if (MinY.HasValue && y < MinY.Value) { return false; } if (MaxY.HasValue && y > MaxY.Value) { return false; } int count = Vertices.Count; if (count < 3) { return false; } bool flag = false; int num = 0; int index = count - 1; while (num < count) { float x2 = Vertices[num].X; float z2 = Vertices[num].Z; float x3 = Vertices[index].X; float z3 = Vertices[index].Z; if (z2 > z != z3 > z && x < (x3 - x2) * (z - z2) / (z3 - z2) + x2) { flag = !flag; } index = num++; } return flag; } }