private int growTree(PointCloud cloud, List<List<BranchSegment>> treesSegments) {
        quadTree = new BranchQuadTree(new AABB(Point.ZERO, new Point(QUADTREE_EXTENTS, QUADTREE_EXTENTS)));
        for (List<BranchSegment> segments : treesSegments)
            for (BranchSegment seg : segments)
                quadTree.insert(seg);

        int itrCount;
        boolean changed = true;
        for (itrCount = 0; itrCount < maxIterations && changed && cloud.hasPoints(); itrCount++) {
            changed = false;

            for (int i = 0; i < treesSegments.size(); i++) {
                List<BranchSegment> segments = treesSegments.get(i);

                Map<BranchSegment, Point> grow = new HashMap<>();
                findGrowList(cloud, grow, i);

                for (Map.Entry<BranchSegment, Point> e : grow.entrySet()) {
                    Point pos = e.getValue().nor().mul(segmentLength).add(e.getKey().getPosition());
                    BranchSegment seg = new BranchSegment(e.getKey(), pos, i);
                    if (segments.add(seg))
                        quadTree.insert(seg);

                    changed = true;
                }
            }
        }

        return itrCount;
    }