// CDynamicAABBTree - [2020-04-13 11:57:46]
#ifndef _CDYNAMICAABBTREE_H_
#define _CDYNAMICAABBTREE_H_

#include "FTTPair.h"
#include "FTTList.h"
#include "FTTVector.h"
#include "FTTUPtr.h"
#include "TAABB.h"

/*
00198C88 CDynamicAABBTree<uint>::CDynamicAABBTree(uint,float)
00198E3A CDynamicAABBTree<uint>::Query(TAABB const&)
00198E94 CDynamicAABBTree<uint>::Insert(TAABB,uint)
001A4ECC CDynamicAABBTree<uint>::Query(TDynamicAABBNode<uint> *,TAABB const&, FTTVector<FTTPair<uint,TDynamicAABBNode<uint> *>> &)
001A510A CDynamicAABBTree<uint>::Balance(TDynamicAABBNode<uint> *)
001A519E CDynamicAABBTree<uint>::RotateLeft(TDynamicAABBNode<uint> *)
001A522C CDynamicAABBTree<uint>::RotateRightLeft(TDynamicAABBNode<uint> *)
001A5318 CDynamicAABBTree<uint>::RotateRight(TDynamicAABBNode<uint> *)
001A53A8 CDynamicAABBTree<uint>::RotateLeftRight(TDynamicAABBNode<uint> *)

00198CFE CDynamicAABBTree<FTTList<TEdgeGroup>::Iterator>::CDynamicAABBTree(uint,float)
0019918C CDynamicAABBTree<FTTList<TEdgeGroup>::Iterator>::Query(TAABB const&)
00199294 CDynamicAABBTree<FTTList<TEdgeGroup>::Iterator>::Remove(TDynamicAABBNode<FTTList<TEdgeGroup>::Iterator> *)
0019933C CDynamicAABBTree<FTTList<TEdgeGroup>::Iterator>::Insert(TAABB,FTTList<TEdgeGroup>::Iterator)
001A549C CDynamicAABBTree<FTTList<TEdgeGroup>::Iterator>::Query(TDynamicAABBNode<FTTList<TEdgeGroup>::Iterator> *,TAABB const&,FTTVector<FTTPair<FTTList<TEdgeGroup>::Iterator,TDynamicAABBNode<FTTList<TEdgeGroup>::Iterator> *>> &)
001A5624 CDynamicAABBTree<FTTList<TEdgeGroup>::Iterator>::Balance(TDynamicAABBNode<FTTList<TEdgeGroup>::Iterator> *)
001A56CA CDynamicAABBTree<FTTList<TEdgeGroup>::Iterator>::RotateLeft(TDynamicAABBNode<FTTList<TEdgeGroup>::Iterator> *)
001A576C CDynamicAABBTree<FTTList<TEdgeGroup>::Iterator>::RotateRightLeft(TDynamicAABBNode<FTTList<TEdgeGroup>::Iterator> *)
001A5874 CDynamicAABBTree<FTTList<TEdgeGroup>::Iterator>::RotateRight(TDynamicAABBNode<FTTList<TEdgeGroup>::Iterator> *)
001A5914 CDynamicAABBTree<FTTList<TEdgeGroup>::Iterator>::RotateLeftRight(TDynamicAABBNode<FTTList<TEdgeGroup>::Iterator> *)

00000000 TDynamicAABBNode<uint> struc @ (sizeof=0x2C, mappedto_1869)
00000000 t_0:.long ?
00000004 aabb_8:TAABB ?
0000001C depth_20:.byte ?
0000001D field_21:.byte ?
0000001E field_22:.byte ?
0000001F field_23:.byte ?
00000020 LeftNode_24:.long ?
00000024 MiddleNode_28:.long ?
00000028 RightNode_2C:.long ?
0000002C TDynamicAABBNode<uint> ends
*/

//-------------------------------------------------------------------------------------------------
// 00198C88 CDynamicAABBTree<uint> 0x2C
template <typename T>
struct TDynamicAABBNode {
  TDynamicAABBNode() {
    LeftNode_24 = NULL;
    MiddleNode_28 = NULL;
    RightNode_2C = NULL;
    depth_20 = 0;
  }

  T t_0;
  TAABB aabb_8;

  uint8 depth_20;
  uint8 field_21;
  uint8 field_22;
  uint8 field_23;

  TDynamicAABBNode<T>* LeftNode_24;
  TDynamicAABBNode<T>* MiddleNode_28;
  TDynamicAABBNode<T>* RightNode_2C;
};
//-------------------------------------------------------------------------------------------------
template <typename T>
class CDynamicAABBTree {
public:
  // 001a5624 001a510a ^_-
  TDynamicAABBNode<T>* Balance(TDynamicAABBNode<T>* node1) {
    TDynamicAABBNode<T>* node_r0 = node1->MiddleNode_28;
    TDynamicAABBNode<T>* node_r1 = node1->RightNode_2C;

    int tmp_r5 = node_r1->depth_20 - node_r0->depth_20;
    // 1a5638
    if (tmp_r5 != -2) {
      // 1a563c
      if (tmp_r5 == 2) {
        node_r0 = node_r1->RightNode_2C;
        node_r1 = node_r1->MiddleNode_28;
        // 1a5642 1a564e
        if (node_r0 && node_r1->depth_20 < node_r0->depth_20) {
          // 1a5656
          RotateLeft(node1);
        } else {
          // 1a56a6
          RotateRightLeft(node1);
        }
      } else {
        // 1a5678
        if (node_r1) {
          // 1a567a
          node1->depth_20 = max(node_r1->depth_20, node_r0->depth_20) + 1;
          memcpy(&node1->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
          node1->aabb_8.Expand(node_r1->aabb_8);
        }
        return node1;
      }
    } else {
      // 1a565e
      if (node_r0->RightNode_2C &&
          node_r0->RightNode_2C->depth_20 < node_r0->MiddleNode_28->depth_20) {
        // 1a5672
        RotateRight(node1);
      } else {
        // 1a56b4
        RotateLeftRight(node1);
      }
    }
    // 1a56ba
    if (node_0.GetObj() == node1)
      node_0.SetObj(node1->LeftNode_24);

    return node1->LeftNode_24;
  }
  //-----------------------------------------------------------------------------------------------
  // 00198cfe 00198c88  ^_-
  // 00198C88 _ZN16CDynamicAABBTreeIjEC2Ejf CDynamicAABBTree<unsigned int>::CDynamicAABBTree(unsigned int, float)
  CDynamicAABBTree(unsigned int ui1, float f2) {
    node_8.SetObj(nullptr);
    field_C = f2;
    NodeCount_10 = ui1;

    TDynamicAABBNode<T>* r9_pNode = new TDynamicAABBNode<T>[ui1];
    // node_8.Delete();
    // FTTUPtr<TDynamicAABBNode<unsigned int> []>::operator=(TDynamicAABBNode<unsigned int>*)
    node_8 = (TDynamicAABBNode<T>(*)[])r9_pNode;  // 00198CD4
    node_4.SetObj(node_8.GetObj());

    // 198d64
    for (uint tmp_r0 = 0; tmp_r0 < ui1 - 1; tmp_r0++) {
      // 198d58 loc_198CE2
      TDynamicAABBNode<T>* pNode = (TDynamicAABBNode<T>*)node_8.GetObj();
      pNode[tmp_r0].LeftNode_24 = &pNode[tmp_r0 + 1];
    }

    node_0.SetObj(nullptr);
  }
  //-----------------------------------------------------------------------------------------------
  // 0019933c 00198e94  ^_-
  TDynamicAABBNode<T>* Insert(TAABB aabb1, T t2) {
    TDynamicAABBNode<T>* node_r4 = node_4.GetObj();
    TDynamicAABBNode<T>* node_r6;
    node_4 = node_r4->LeftNode_24;
    node_r4->t_0 = t2;

    node_r4->aabb_8 = aabb1;

    node_r4->aabb_8.Inflate(field_C);
    node_r4->depth_20 = 0;

    TAABB* aabbptr_8;
    TDynamicAABBNode<T>* node_r8 = node_0.GetObj();
    // 199382
    if (node_r8) {
      // 19938a
      TDynamicAABBNode<T>* node_sl;
      // 199396
      while ((node_sl = node_r8->RightNode_2C) != NULL) {
        // 19939e
        TDynamicAABBNode<T>* node_fp = node_r8->MiddleNode_28;

        TAABB aabb_28(node_r8->aabb_8);
        // 1993c2
        aabb_28.Expand(node_r4->aabb_8);

        aabbptr_8 = &node_r8->aabb_8;
        // 1993cc
        float tmp_s16 = node_r8->aabb_8.SurfaceArea();
        // 1993d6
        float tmp_s18 = aabb_28.SurfaceArea();
        tmp_s16 = (tmp_s18 - tmp_s16) + (tmp_s18 - tmp_s16);
        float tmp_s0;
        // 1993e6
        if (node_fp->RightNode_2C) {
          // 1993ee
          TAABB aabb_10(node_fp->aabb_8);
          // 199408
          aabb_10.Expand(node_r4->aabb_8);

          // 19940e 199418
          tmp_s0 = aabb_10.SurfaceArea() - node_fp->aabb_8.SurfaceArea();
          // 199424
        } else {
          // 199426
          TAABB aabb_10(node_fp->aabb_8);
          // 199440
          aabb_10.Expand(node_r4->aabb_8);
          // 199446
          tmp_s0 = aabb_10.SurfaceArea();
          // 19944a
        }

        float tmp_s20 = tmp_s18 + tmp_s18;
        tmp_s18 = tmp_s16 * tmp_s0;
        // 19945a
        if (node_sl->RightNode_2C) {
          // 19945c
          TAABB aabb_10(node_sl->aabb_8);
          // 199476
          aabb_10.Expand(node_r4->aabb_8);
          // 19947c 199486
          tmp_s0 = aabb_10.SurfaceArea() + node_sl->aabb_8.SurfaceArea();
        } else {
          // 199494
          TAABB aabb_10(node_sl->aabb_8);
          // 1994ae
          aabb_10.Expand(node_r4->aabb_8);
          // 1994b4
          tmp_s0 = aabb_10.SurfaceArea();
        }

        tmp_s0 += tmp_s16;
        // 1994bc 1994ca
        if (tmp_s20 < tmp_s18 && tmp_s20 < tmp_s0)
          break;

        // 1994d4
        if (tmp_s18 < tmp_s0)
          node_r8 = node_r8->MiddleNode_28;
        else
          node_r8 = node_r8->RightNode_2C;

        // 1994e6
        if (!node_r8)
          goto FuncExit;  //-> 19956c
      }
      // 199396
      if (node_sl == NULL)
        aabbptr_8 = &node_r8->aabb_8;

      // 199506
      node_r6 = node_4.GetObj();
      node_4 = node_r6->LeftNode_24;

      node_r6->LeftNode_24 = node_r8->LeftNode_24;
      node_r6->MiddleNode_28 = node_r8;
      node_r6->RightNode_2C = node_r4;

      memcpy(&node_r6->aabb_8, aabbptr_8, sizeof(TAABB));
      // 199530
      node_r6->aabb_8.Expand(node_r4->aabb_8);
      // 19953c
      node_r6->depth_20 = max(node_r8->depth_20, node_r4->depth_20) + 1;

      // 19954a
      if (node_r8 != node_0.GetObj()) {  // 19954e
        TDynamicAABBNode<T>* node_r0 = node_r8->LeftNode_24;
        // 199556
        if (node_r0->MiddleNode_28 == node_r8)
          node_r0->MiddleNode_28 = node_r6;
        else
          node_r0->RightNode_2C = node_r6;
      } else {
        // 19955e
        node_0 = node_r6;
      }
      node_r4->LeftNode_24 = node_r6;
      node_r8->LeftNode_24 = node_r6;
      // 19956a
      node_r8 = node_r4;

    FuncExit:
      // 19956c

      // 19957e
      for (; node_r8->LeftNode_24;) {
        // 199574
        node_r8 = Balance(node_r8->LeftNode_24);
      }
      return node_r4;
    } else {
      // 1994f0
      node_0 = node_r4;
      node_r4->LeftNode_24 = NULL;
      return node_r4;
    }
  }
  //-----------------------------------------------------------------------------------------------
  // 0019918c 00198e3a  ^_-
  // 00198E3A _ZN16CDynamicAABBTreeIjE5QueryERK5TAABB
  FTTVector<FTTPair<T, TDynamicAABBNode<T>*>> Query(TAABB const& aabb1) {
    FTTVector<FTTPair<T, TDynamicAABBNode<T>*>> vector;
    // 1991a4 1991aa 1991ae
    if (node_0.GetObj() != nullptr && TAABB::Overlap(node_0.GetObj()->aabb_8, aabb1)) {
      Query(node_0.GetObj(), aabb1, vector);
    }

    return vector;
  }
  //-----------------------------------------------------------------------------------------------
  // 001a549c 001a4ecc  ^_-
  void Query(TDynamicAABBNode<T>* node1, const TAABB& aabb2, FTTVector<FTTPair<T, TDynamicAABBNode<T>*>>& vector3) {
    // 1a54aa
    if (node1->RightNode_2C) {
      // 1a54b2
      bool tmp_r7 = TAABB::Overlap(node1->MiddleNode_28->aabb_8, aabb2);
      // 1a54be
      bool tmp_r4 = TAABB::Overlap(node1->RightNode_2C->aabb_8, aabb2);
      // 1a54c4
      if (tmp_r7) {
        // 1a54ce
        Query(node1->MiddleNode_28, aabb2, vector3);
      }
      // 1a54d2
      if (tmp_r4) {
        // 1a54e2
        Query(node1->RightNode_2C, aabb2, vector3);
      }
    } else {  // 1a54e6
      FTTPair<T, TDynamicAABBNode<T>*> pair_0(T(node1->t_0), node1);

      vector3.Insert((FTTPair<T, TDynamicAABBNode<T>*> &&) pair_0);
    }
  }
  //-----------------------------------------------------------------------------------------------
  // 00199294  ^_-
  void Remove(TDynamicAABBNode<T>* node1) {
    TDynamicAABBNode<T>* node_r0 = node_0.GetObj();
    TDynamicAABBNode<T>* node_r1;
    TDynamicAABBNode<T>* node_r2;

    // 19929c
    if (node_r0 != node1) {  // 1992a0
      // 1992a2
      if (node1->LeftNode_24 != node_0.GetObj()) {
        // 1992a6
        node_r2 = node1->LeftNode_24;

        node_r1 = node_r2->LeftNode_24;
        node_r0 = node_r2->MiddleNode_28;
        // 1992aa
        if (node_r0 == node1)
          node_r0 = node_r2->RightNode_2C;

        // 1992b6
        if (node_r1->MiddleNode_28 != node_r2)
          node_r1->RightNode_2C = node_r0;
        else
          node_r1->MiddleNode_28 = node_r0;

        node_r0->LeftNode_24 = node_r1;
        node_r2->LeftNode_24 = node_4.GetObj();
        node_4.SetObj(node_r2);
        for (; node_r1;) {
          // 1992ce
          node_r1 = Balance(node_0.GetObj())->LeftNode_24;
        }
      } else {
        // 1992e2
        node_r1 = node_r0->MiddleNode_28;

        // 1992e6
        if (node_r1 == node1)
          node_r1 = node_r0->RightNode_2C;
        node_0 = node_r1;

        node_r1->LeftNode_24 = NULL;

        node_r0->LeftNode_24 = node_4.GetObj();
        node_4.SetObj(node_r0);
      }
    } else {
      // 1992dc
      node_0.SetObj(NULL);
    }

    node1->LeftNode_24 = node_4.GetObj();
    node_4.SetObj(node1);
    return;
  }
  //-----------------------------------------------------------------------------------------------
  // 001a56ca 001a519e  ^_-
  void RotateLeft(TDynamicAABBNode<T>* node1) {
    TDynamicAABBNode<T>* node_r4 = node1->RightNode_2C;
    TDynamicAABBNode<T>* node_r0 = node1->LeftNode_24;
    TDynamicAABBNode<T>* node_r2 = node_r4->MiddleNode_28;

    node1->LeftNode_24 = node_r4;
    node1->RightNode_2C = node_r2;
    // 1a56d4
    if (node_r2)
      node_r2->LeftNode_24 = node1;

    node_r4->LeftNode_24 = node_r0;
    node_r4->MiddleNode_28 = node1;
    // 1a56dc
    if (node_r0) {
      // 1a56e6 1a56e8
      if (node_r0->MiddleNode_28 && node_r0->MiddleNode_28 == node1)
        node_r0->MiddleNode_28 = node_r4;

      // 1a56f0 1a56f2
      if (node_r0->RightNode_2C && node_r0->RightNode_2C == node1)
        node_r0->RightNode_2C = node_r4;
    }

    node_r0 = node1->MiddleNode_28;
    TDynamicAABBNode<T>* node_ip = node1->RightNode_2C;

    // 1a5704
    node1->depth_20 = max(node_r0->depth_20, node_ip->depth_20) + 1;
    memcpy(&node1->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
    // 1a572c
    node1->aabb_8.Expand(node_ip->aabb_8);

    node_r0 = node_r4->MiddleNode_28;
    TDynamicAABBNode<T>* node_r1 = node_r4->RightNode_2C;
    // 1a573e
    node_r4->depth_20 = max(node_r0->depth_20, node_r1->depth_20) + 1;
    memcpy(&node_r4->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
    // 1a5766
    node_r4->aabb_8.Expand(node_r1->aabb_8);
  }
  //-----------------------------------------------------------------------------------------------
  // 001a5914 001a53a8  ^_-
  void RotateLeftRight(TDynamicAABBNode<T>* node1) {
    TDynamicAABBNode<T>* node_ip = node1->LeftNode_24;
    TDynamicAABBNode<T>* node_r1 = node1->MiddleNode_28;
    TDynamicAABBNode<T>* node_lr = node1->RightNode_2C;

    TDynamicAABBNode<T>* node_r2 = node_r1->MiddleNode_28;
    TDynamicAABBNode<T>* node_r5 = node_r1->RightNode_2C;

    TDynamicAABBNode<T>* node_r0 = node_r5->MiddleNode_28;
    TDynamicAABBNode<T>* node_r3 = node_r5->RightNode_2C;

    node_r1->RightNode_2C = node_r0;
    node_r1->LeftNode_24 = node_r5;

    node_r5->LeftNode_24 = node_ip;
    node_r5->MiddleNode_28 = node_r1;
    node_r5->RightNode_2C = node1;
    node1->LeftNode_24 = node_r5;
    node1->MiddleNode_28 = node_r3;
    node1->RightNode_2C = node_lr;
    // 1a5928
    if (node_r2)
      node_r2->LeftNode_24 = node_r1;
    // 1a5940
    if (node_r0)
      node_r0->LeftNode_24 = node_r1;
    // 1a5944
    if (node_r3)
      node_r3->LeftNode_24 = node1;
    // 1a5948
    if (node_lr)
      node_lr->LeftNode_24 = node1;
    // 1a5952
    if (node_ip) {
      // 1a595c 1a595e
      if (node_ip->MiddleNode_28 && node_ip->MiddleNode_28 == node1)
        node_ip->MiddleNode_28 = node_r5;
      // 1a596a 1a596c
      if (node_ip->RightNode_2C && node_ip->RightNode_2C == node1)
        node_ip->RightNode_2C = node_r5;
    }

    node_r0 = node_r1->MiddleNode_28;
    node_ip = node_r1->RightNode_2C;
    node_r1->depth_20 = max(node_ip->depth_20, node_r0->depth_20) + 1;

    memcpy(&node_r1->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
    // 1a59ae
    node_r1->aabb_8.Expand(node_ip->aabb_8);

    node_r0 = node1->MiddleNode_28;
    node_r1 = node1->RightNode_2C;
    node1->depth_20 = max(node_r0->depth_20, node_r1->depth_20) + 1;
    memcpy(&node1->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
    // 1a59e2
    node1->aabb_8.Expand(node_r1->aabb_8);

    node_r0 = node_r5->MiddleNode_28;
    node_r1 = node_r5->RightNode_2C;
    node_r5->depth_20 = max(node_r0->depth_20, node_r1->depth_20) + 1;
    memcpy(&node_r5->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
    // 1a5a1c
    node_r5->aabb_8.Expand(node_r1->aabb_8);
  }
  //-----------------------------------------------------------------------------------------------
  // 001a5874 001a5318  ^_-
  void RotateRight(TDynamicAABBNode<T>* node1) {
    TDynamicAABBNode<T>* node_r0 = node1->LeftNode_24;
    TDynamicAABBNode<T>* node_r4 = node1->MiddleNode_28;
    TDynamicAABBNode<T>* node_r2 = node_r4->RightNode_2C;

    node1->LeftNode_24 = node_r4;
    node1->MiddleNode_28 = node_r2;
    // 1a587c
    if (node_r2)
      node_r2->LeftNode_24 = node1;

    node_r4->RightNode_2C = node1;
    node_r4->LeftNode_24 = node_r0;
    // 1a5886
    if (node_r0) {
      // 1a5890 1a5892
      if (node_r0->MiddleNode_28 && node_r0->MiddleNode_28 == node1)
        node_r0->MiddleNode_28 = node_r4;
      // 1a589a 1a589c
      if (node_r0->RightNode_2C && node_r0->RightNode_2C == node1)
        node_r0->RightNode_2C = node_r4;
    }

    node_r0 = node1->MiddleNode_28;
    TDynamicAABBNode<T>* node_ip = node1->RightNode_2C;
    node1->depth_20 = max(node_ip->depth_20, node_r0->depth_20) + 1;
    memcpy(&node1->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
    // 1a58d6
    node1->aabb_8.Expand(node_ip->aabb_8);

    node_r0 = node_r4->MiddleNode_28;
    TDynamicAABBNode<T>* node_r1 = node_r4->RightNode_2C;
    node_r4->depth_20 = max(node_r0->depth_20, node_r1->depth_20) + 1;
    memcpy(&node_r4->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
    // 1a5910
    node_r1->aabb_8.Expand(node_r1->aabb_8);
  }
  //-----------------------------------------------------------------------------------------------
  // 001a576c 001a522c  ^_-
  void RotateRightLeft(TDynamicAABBNode<T>* node1) {
    TDynamicAABBNode<T>* node_ip = node1->LeftNode_24;
    TDynamicAABBNode<T>* node_lr = node1->MiddleNode_28;
    TDynamicAABBNode<T>* node_r5 = node1->RightNode_2C;

    TDynamicAABBNode<T>* node_r4 = node_r5->MiddleNode_28;
    TDynamicAABBNode<T>* node_r2 = node_r5->RightNode_2C;

    TDynamicAABBNode<T>* node_r0 = node_r4->MiddleNode_28;
    TDynamicAABBNode<T>* node_r3 = node_r4->RightNode_2C;

    node1->RightNode_2C = node_r0;
    node1->LeftNode_24 = node_r4;

    node_r4->LeftNode_24 = node_ip;
    node_r4->MiddleNode_28 = node1;
    node_r4->RightNode_2C = node_r5;

    node_r5->LeftNode_24 = node_r4;
    node_r5->MiddleNode_28 = node_r3;
    node_r5->RightNode_2C = node_r2;
    // 1a5772
    if (node_lr)
      node_lr->LeftNode_24 = node1;

    // 1a5796
    if (node_r0)
      node_r0->LeftNode_24 = node1;

    // 1a579a
    if (node_r3)
      node_r3->LeftNode_24 = node_r5;

    // 1a579e
    if (node_r2)
      node_r2->LeftNode_24 = node_r5;

    // 1a57a2
    if (node_ip) {
      // 1a57ac 1a57ae
      if (node_ip->MiddleNode_28 && node_ip->MiddleNode_28 == node1)
        node_ip->MiddleNode_28 = node_r4;

      // 1a57ba 1a57bc
      if (node_ip->RightNode_2C && node_ip->RightNode_2C == node1)
        node_ip->RightNode_2C = node_r4;
    }

    node_r0 = node1->MiddleNode_28;
    node_ip = node1->RightNode_2C;
    node1->depth_20 = max(node_r0->depth_20, node_ip->depth_20) + 1;
    memcpy(&node1->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
    // 1a57fe
    node1->aabb_8.Expand(node_ip->aabb_8);

    node_r0 = node_r5->MiddleNode_28;
    TDynamicAABBNode<T>* node_r1 = node_r5->RightNode_2C;
    node_r5->depth_20 = max(node_r0->depth_20, node_r1->depth_20) + 1;
    memcpy(&node_r5->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
    // 1a5832
    node_r5->aabb_8.Expand(node_r1->aabb_8);

    node_r0 = node_r4->MiddleNode_28;
    node_r1 = node_r4->RightNode_2C;
    node_r4->depth_20 = max(node_r0->depth_20, node_r1->depth_20) + 1;
    memcpy(&node_r4->aabb_8, &node_r0->aabb_8, sizeof(TAABB));
    // 1a586c
    node_r4->aabb_8.Expand(node_r1->aabb_8);
  }
  //-----------------------------------------------------------------------------------------------
  FTTUPtr<TDynamicAABBNode<T>> node_0;
  FTTUPtr<TDynamicAABBNode<T>[]> node_4;
  FTTUPtr<TDynamicAABBNode<T>[]> node_8;

  float field_C;
  unsigned int NodeCount_10;
};

#endif  //_CDYNAMICAABBTREE_H_