< Summary

Class:DCLServices.MapRendererV2.Culling.MapCullingRectVisibilityChecker
Assembly:MapRendererV2
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLServices/MapRendererV2/Culling/MapCullingRectVisibilityChecker.cs
Covered lines:3
Uncovered lines:3
Coverable lines:6
Total lines:26
Line coverage:50% (3 of 6)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:3
Method coverage:33.3% (1 of 3)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
MapCullingRectVisibilityChecker(...)0%110100%
IsVisible[T](...)0%2100%
Intersects(...)0%20400%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLServices/MapRendererV2/Culling/MapCullingRectVisibilityChecker.cs

#LineLine coverage
 1using UnityEngine;
 2
 3namespace DCLServices.MapRendererV2.Culling
 4{
 5    internal class MapCullingRectVisibilityChecker : IMapCullingVisibilityChecker
 6    {
 7        internal readonly float size;
 8
 979        internal MapCullingRectVisibilityChecker(float size)
 10        {
 9711            this.size = size;
 9712        }
 13
 14        public bool IsVisible<T>(T obj, CameraState cameraState) where T: IMapPositionProvider
 15        {
 016            var objSize = Vector2.one * size;
 017            return Intersects(cameraState.Rect, new Rect((Vector2) obj.CurrentPosition - (objSize / 2f), objSize));
 18        }
 19
 20        private static bool Intersects(Rect r1, Rect r2) =>
 021            r1.min.x <= r2.max.x
 22            && r1.max.x >= r2.min.x
 23            && r1.min.y <= r2.max.y
 24            && r1.max.y >= r2.min.y;
 25    }
 26}