Example #1
0
        public IEnumerable <IBvhItem> GetTouching(Vector3 position, double error)
        {
            AxisAlignedBoundingBox bounds = GetAxisAlignedBoundingBox();

            if (bounds.Contains(position, error))
            {
                yield return(this);
            }
        }
Example #2
0
        public bool GetContained(List <IRayTraceable> results, AxisAlignedBoundingBox subRegion)
        {
            AxisAlignedBoundingBox bounds = GetAxisAlignedBoundingBox();

            if (bounds.Contains(subRegion))
            {
                results.Add(this);
                return(true);
            }

            return(false);
        }
        public bool GetContained(List <IBvhItem> results, AxisAlignedBoundingBox subRegion)
        {
            AxisAlignedBoundingBox bounds = GetAxisAlignedBoundingBox();

            if (bounds.Contains(subRegion))
            {
                bool resultA = this.nodeA.GetContained(results, subRegion);
                bool resultB = this.nodeB.GetContained(results, subRegion);
                return(resultA | resultB);
            }

            return(false);
        }
        public IEnumerable <IBvhItem> GetTouching(Vector3 position, double error)
        {
            AxisAlignedBoundingBox bounds = GetAxisAlignedBoundingBox();

            if (bounds.Contains(position, error))
            {
                foreach (var item in this.nodeA.GetTouching(position, error))
                {
                    yield return(item);
                }
                foreach (var item in this.nodeB.GetTouching(position, error))
                {
                    yield return(item);
                }
            }
        }
Example #5
0
        private string ReportEndStops(string arg)
        {
            var xMaxOpen = "open";

            if (xMaxTriggerRegion.Contains(CurrentPosition))
            {
                xMaxOpen = "TRIGGERED";
            }

            var status = "Reporting endstop status\n";

            status += $"x_min: open\n";
            status += $"x_max: {xMaxOpen}\n";
            status += $"y_min: open\n";
            status += $"z_min: open\n";
            status += "ok\n";
            return(status);
        }
        public void Contains(float x, float y, float z, bool expected)
        {
            var sut = new AxisAlignedBoundingBox(new Vector3(-2), new Vector3(2));

            Assert.Equal(expected, sut.Contains(new Vector3(x, y, z)));
        }