private static void CullRecursive(
                List <T> elements,
                CullContext context,
                PointQuadTree <QuadTreeItem> .Node node)
            {
                var intersection =
                    CheckIntersection(context, ToRect(node.Bounds));

                if (intersection == Intersection.Contain)
                {
#if DEBUG_PRINT_CULLING_PROCESS
                    if (_enablePrintCullingProcess)
                    {
                        Logger.Debug(
                            $"{node.DebugDisplayName} fully contained by view, adding itself and all descendants");

                        if (node.Element != null)
                        {
                            Logger.Debug($"\tADDED {node.DebugDisplayName} {node.Element.Element}");
                        }

                        foreach (var descendant in node.EnumerateDescendantNodes())
                        {
                            if (descendant.Element != null)
                            {
                                Logger.Debug($"\tADDED {descendant.DebugDisplayName} {descendant.Element.Element}");
                            }
                        }
                    }
#endif
                    if (node.Element != null)
                    {
                        elements.Add(node.Element.Element);
                    }

                    elements.AddRange(node.EnumerateDescendants().Where(i => i.Element != null).Select(i => i.Element));
                }
                else if (intersection == Intersection.Intersect)
                {
                    var viewPosition = context.ViewState.WorldToViewMatrix.Transform(ToWpfPoint(node.Point));
                    if (context.CullRect.Contains(viewPosition) && node.Element != null)
                    {
#if DEBUG_PRINT_CULLING_PROCESS
                        if (_enablePrintCullingProcess)
                        {
                            Logger.Debug(
                                $"{node.DebugDisplayName} intersects with view, and its Point is contained by view, adding");
                            Logger.Debug($"\tADDED {node.DebugDisplayName} {node.Element.Element}");
                        }
#endif
                        elements.Add(node.Element.Element);
                    }

                    foreach (var subnode in node.Subnodes)
                    {
                        CullRecursive(elements, context, subnode);
                    }
                }
#if DEBUG_PRINT_CULLING_PROCESS
                else
                {
                    if (_enablePrintCullingProcess)
                    {
                        Logger.Debug($"{node.DebugDisplayName} does not intersect with view, ruled out");
                        if (node.Element != null)
                        {
                            Logger.Debug($"\tRULE-OUT {node.DebugDisplayName} {node.Element.Element}");
                        }

                        foreach (var descendant in node.EnumerateDescendantNodes())
                        {
                            if (descendant.Element != null)
                            {
                                Logger.Debug($"\tRULE-OUT {descendant.DebugDisplayName} {descendant.Element.Element}");
                            }
                        }
                    }
                }
#endif
            }
 public QuadTreeCuller(PointQuadTree <QuadTreeItem> quadTree)
 {
     this.QuadTree = quadTree;
 }