Exemple #1
0
        public void It_Returns_False_IfAPoint_Is_Outside_TheBoundingBox()
        {
            // Arrange
            var externalPt = new Point3(12.4, 5.0, 0.0);
            var bBox       = new BoundingBox(BoundingBoxCollection.BoundingBox2D());

            // Act
            var containsResult = bBox.Contains(externalPt, false);

            // Assert
            containsResult.Should().BeFalse();
        }
Exemple #2
0
        public void Union_Returns_ValidBoundingBox_If_Other_IsNotValid()
        {
            // Arrange
            var bBox1 = BoundingBox.Unset;
            var bBox2 = new BoundingBox(BoundingBoxCollection.BoundingBox2D());

            // Act
            var bBoxResult = BoundingBox.Union(bBox1, bBox2);

            // Assert
            bBoxResult.Should().Be(bBox2);
        }
Exemple #3
0
        public void It_Returns_True_If_A_Point_Is_Contained_Into_TheBoundingBox()
        {
            // Arrange
            var conteinedPt = new Point3(2.5, 4.5, 0.0);
            var bBox        = new BoundingBox(BoundingBoxCollection.BoundingBox2D());

            // Act
            var containsResult = bBox.Contains(conteinedPt, false);

            // Assert
            containsResult.Should().BeTrue();
        }
Exemple #4
0
        public void Intersect_Returns_BBox_As_Intersection_Of_Two_BBoxes()
        {
            // Arrange
            var pt1  = new Point3(5d, 5d, 0);
            var pt2  = new Point3(15d, 15d, 0);
            var pts2 = new List <Point3> {
                pt1, pt2
            };
            var bBox1 = new BoundingBox(BoundingBoxCollection.BoundingBox2D());
            var bBox2 = new BoundingBox(pts2);

            // Act
            var bBoxResult = bBox1.Intersect(bBox2);

            // Assert
            bBoxResult.IsValid.Should().BeTrue();
            bBoxResult.Max.Should().BeEquivalentTo(bBox1.Max);
            bBoxResult.Min.Should().BeEquivalentTo(bBox2.Min);
        }
Exemple #5
0
        public void It_Returns_BooleanUnion_Between_Two_BoundingBoxes()
        {
            // Arrange
            var pt1 = new Point3(5d, 5d, 0);
            var pt2 = new Point3(-15d, -13d, -5);
            var pts = new List <Point3> {
                pt1, pt2
            };
            var pMax  = new Point3(10, 10, 0);
            var bBox1 = new BoundingBox(BoundingBoxCollection.BoundingBox2D());
            var bBox2 = new BoundingBox(pts);

            // Act
            var bBoxResult = bBox1.Union(bBox2);

            // Assert
            bBoxResult.IsValid.Should().BeTrue();
            bBoxResult.Max.Should().BeEquivalentTo(pMax);
            bBoxResult.Min.Should().BeEquivalentTo(pt2);
        }