// Token: 0x0600267F RID: 9855 RVA: 0x001AB000 File Offset: 0x001A9200 private RecastBBTreeBox RemoveBox(RecastBBTreeBox c, RecastMeshObj mesh, Rect bounds, ref bool found) { if (!RecastBBTree.RectIntersectsRect(c.rect, bounds)) { return(c); } if (c.mesh == mesh) { found = true; return(null); } if (c.mesh == null && !found) { c.c1 = this.RemoveBox(c.c1, mesh, bounds, ref found); if (c.c1 == null) { return(c.c2); } if (!found) { c.c2 = this.RemoveBox(c.c2, mesh, bounds, ref found); if (c.c2 == null) { return(c.c1); } } if (found) { c.rect = RecastBBTree.ExpandToContain(c.c1.rect, c.c2.rect); } } return(c); }
// Token: 0x060005CC RID: 1484 RVA: 0x000358FC File Offset: 0x00033CFC public RecastBBTreeBox(RecastBBTree tree, RecastMeshObj mesh) { this.mesh = mesh; Vector3 min = mesh.bounds.min; Vector3 max = mesh.bounds.max; this.rect = Rect.MinMaxRect(min.x, min.z, max.x, max.z); }
// Token: 0x06002682 RID: 9858 RVA: 0x001AB204 File Offset: 0x001A9404 private static float ExpansionRequired(Rect r, Rect r2) { float num = Mathf.Min(r.xMin, r2.xMin); float num2 = Mathf.Max(r.xMax, r2.xMax); float num3 = Mathf.Min(r.yMin, r2.yMin); float num4 = Mathf.Max(r.yMax, r2.yMax); return((num2 - num) * (num4 - num3) - RecastBBTree.RectArea(r)); }
private void QueryBoxInBounds(RecastBBTreeBox box, Rect bounds, List <RecastMeshObj> boxes) { if (box.mesh != null) { if (RecastBBTree.RectIntersectsRect(box.rect, bounds)) { boxes.Add(box.mesh); } } else { if (RecastBBTree.RectIntersectsRect(box.c1.rect, bounds)) { this.QueryBoxInBounds(box.c1, bounds, boxes); } if (RecastBBTree.RectIntersectsRect(box.c2.rect, bounds)) { this.QueryBoxInBounds(box.c2, bounds, boxes); } } }
// Token: 0x06002680 RID: 9856 RVA: 0x001AB0BC File Offset: 0x001A92BC public void Insert(RecastMeshObj mesh) { RecastBBTreeBox recastBBTreeBox = new RecastBBTreeBox(mesh); if (this.root == null) { this.root = recastBBTreeBox; return; } RecastBBTreeBox recastBBTreeBox2 = this.root; for (;;) { recastBBTreeBox2.rect = RecastBBTree.ExpandToContain(recastBBTreeBox2.rect, recastBBTreeBox.rect); if (recastBBTreeBox2.mesh != null) { break; } float num = RecastBBTree.ExpansionRequired(recastBBTreeBox2.c1.rect, recastBBTreeBox.rect); float num2 = RecastBBTree.ExpansionRequired(recastBBTreeBox2.c2.rect, recastBBTreeBox.rect); if (num < num2) { recastBBTreeBox2 = recastBBTreeBox2.c1; } else if (num2 < num) { recastBBTreeBox2 = recastBBTreeBox2.c2; } else { recastBBTreeBox2 = ((RecastBBTree.RectArea(recastBBTreeBox2.c1.rect) < RecastBBTree.RectArea(recastBBTreeBox2.c2.rect)) ? recastBBTreeBox2.c1 : recastBBTreeBox2.c2); } } recastBBTreeBox2.c1 = recastBBTreeBox; RecastBBTreeBox c = new RecastBBTreeBox(recastBBTreeBox2.mesh); recastBBTreeBox2.c2 = c; recastBBTreeBox2.mesh = null; }
public RecastBBTreeBox (RecastBBTree tree, RecastMeshObj mesh) { this.mesh = mesh; Vector3 min = mesh.bounds.min; Vector3 max = mesh.bounds.max; rect = Rect.MinMaxRect (min.x,min.z,max.x,max.z); }
private static bool RectIntersectsCircle(Rect r, Vector3 p, float radius) { return(float.IsPositiveInfinity(radius) || RecastBBTree.RectContains(r, p) || RecastBBTree.XIntersectsCircle(r.xMin, r.xMax, r.yMin, p, radius) || RecastBBTree.XIntersectsCircle(r.xMin, r.xMax, r.yMax, p, radius) || RecastBBTree.ZIntersectsCircle(r.yMin, r.yMax, r.xMin, p, radius) || RecastBBTree.ZIntersectsCircle(r.yMin, r.yMax, r.xMax, p, radius)); }