/// <summary>
        ///     Gets the intersection between two non-rotated Cubes cube A and cube B.
        /// </summary>
        /// <param name="cubeA">
        ///     The cube A.
        /// </param>
        /// <param name="cubeB">
        ///     The cube B.
        /// </param>
        /// <returns>
        /// </returns>
        public GetIntersectionResponse GetIntersection(Cube cubeA, Cube cubeB)
        {
            GetIntersectionResponse result = null;

            if (cubeA == null)
            {
                throw new ArgumentNullException(nameof(cubeA));
            }

            if (cubeB == null)
            {
                throw new ArgumentNullException(nameof(cubeB));
            }

            IIntersector <Entity.Shape.Cube, Entity.Shape.Cube> intersector = _intersectorRegistry.GetIntersector <Entity.Shape.Cube, Entity.Shape.Cube>();
            var intersection = intersector.GetIntersection(cubeA.ToDomain(), cubeB.ToDomain());

            result = intersection != null
                ? new GetIntersectionResponse
            {
                Intersection = GetApplicationModel((Entity.Shape.Cube)intersection),
                Intersect    = true
            }
                : new GetIntersectionResponse
            {
                Intersect = false
            };

            return(result);
        }
Exemplo n.º 2
0
 protected IntersectionVisitor(
     IIntersector intersector,
     VisitorType type = VisitorType.IntersectionVisitor,
     TraversalModeType traversalMode = TraversalModeType.TraverseActiveChildren)
     : base(type, traversalMode)
 {
     SetIntersector(intersector);
 }
Exemplo n.º 3
0
        public static IIntersectionVisitor Create(
            IIntersector intersector,
            VisitorType type = VisitorType.IntersectionVisitor,
            TraversalModeType traversalMode = TraversalModeType.TraverseActiveChildren)

        {
            return(new IntersectionVisitor(intersector, type, traversalMode));
        }
Exemplo n.º 4
0
        public void SetIntersector(IIntersector intersector)
        {
            _intersectorStack.Clear();

            if (null != intersector)
            {
                _intersectorStack.Push(intersector);
            }
        }