Пример #1
0
 public void EmptyConvexHullOfPoints()
 {
     ConvexHullOfPoints convexHullOfPoints = new ConvexHullOfPoints(Enumerable.Empty<Vector3F>());
       Assert.AreEqual(0, convexHullOfPoints.Points.Count);
       Assert.AreEqual(Vector3F.Zero, convexHullOfPoints.InnerPoint);
       Assert.AreEqual(new Aabb(), convexHullOfPoints.GetAabb(Pose.Identity));
 }
        public void EmptyConvexHullOfPoints()
        {
            ConvexHullOfPoints convexHullOfPoints = new ConvexHullOfPoints(Enumerable.Empty <Vector3>());

            Assert.AreEqual(0, convexHullOfPoints.Points.Count);
            Assert.AreEqual(Vector3.Zero, convexHullOfPoints.InnerPoint);
            Assert.AreEqual(new Aabb(), convexHullOfPoints.GetAabb(Pose.Identity));
        }
Пример #3
0
 public void OnePoint()
 {
     Vector3F point = new Vector3F(1, 0, 0);
       ConvexHullOfPoints convexHullOfPoints = new ConvexHullOfPoints(new[] { point });
       Assert.AreEqual(1, convexHullOfPoints.Points.Count);
       Assert.AreEqual(point, convexHullOfPoints.InnerPoint);
       Assert.AreEqual(new Aabb(point, point), convexHullOfPoints.GetAabb(Pose.Identity));
 }
        public void OnePoint()
        {
            Vector3            point = new Vector3(1, 0, 0);
            ConvexHullOfPoints convexHullOfPoints = new ConvexHullOfPoints(new[] { point });

            Assert.AreEqual(1, convexHullOfPoints.Points.Count);
            Assert.AreEqual(point, convexHullOfPoints.InnerPoint);
            Assert.AreEqual(new Aabb(point, point), convexHullOfPoints.GetAabb(Pose.Identity));
        }
        public void TwoPoints()
        {
            Vector3            point0             = new Vector3(1, 0, 0);
            Vector3            point1             = new Vector3(10, 0, 0);
            ConvexHullOfPoints convexHullOfPoints = new ConvexHullOfPoints(new[] { point0, point1 });

            Assert.AreEqual(2, convexHullOfPoints.Points.Count);
            Assert.AreEqual((point0 + point1) / 2, convexHullOfPoints.InnerPoint);
            Assert.AreEqual(new Aabb(point0, point1), convexHullOfPoints.GetAabb(Pose.Identity));
        }
        public void ThreePoints()
        {
            Vector3            point0             = new Vector3(1, 1, 1);
            Vector3            point1             = new Vector3(2, 1, 1);
            Vector3            point2             = new Vector3(1, 2, 1);
            ConvexHullOfPoints convexHullOfPoints = new ConvexHullOfPoints(new[] { point0, point1, point2 });

            Assert.AreEqual(3, convexHullOfPoints.Points.Count);
            Assert.AreEqual((point0 + point1 + point2) / 3, convexHullOfPoints.InnerPoint);
            Assert.AreEqual(new Aabb(new Vector3(1, 1, 1), new Vector3(2, 2, 1)), convexHullOfPoints.GetAabb(Pose.Identity));
        }
Пример #7
0
        public void Clone()
        {
            ConvexHullOfPoints convexHullOfPoints = new ConvexHullOfPoints(
            new[]
            {
              new Vector3F(0, 0, 0),
              new Vector3F(1, 0, 0),
              new Vector3F(0, 2, 0),
              new Vector3F(0, 0, 3),
              new Vector3F(1, 5, 0),
              new Vector3F(0, 1, 7),
            });
              ConvexHullOfPoints clone = convexHullOfPoints.Clone() as ConvexHullOfPoints;
              Assert.IsNotNull(clone);

              for (int i = 0; i < clone.Points.Count; i++)
            Assert.AreEqual(convexHullOfPoints.Points[i], clone.Points[i]);

              Assert.AreEqual(convexHullOfPoints.GetAabb(Pose.Identity).Minimum, clone.GetAabb(Pose.Identity).Minimum);
              Assert.AreEqual(convexHullOfPoints.GetAabb(Pose.Identity).Maximum, clone.GetAabb(Pose.Identity).Maximum);
        }
        public void Clone()
        {
            ConvexHullOfPoints convexHullOfPoints = new ConvexHullOfPoints(
                new[]
            {
                new Vector3(0, 0, 0),
                new Vector3(1, 0, 0),
                new Vector3(0, 2, 0),
                new Vector3(0, 0, 3),
                new Vector3(1, 5, 0),
                new Vector3(0, 1, 7),
            });
            ConvexHullOfPoints clone = convexHullOfPoints.Clone() as ConvexHullOfPoints;

            Assert.IsNotNull(clone);

            for (int i = 0; i < clone.Points.Count; i++)
            {
                Assert.AreEqual(convexHullOfPoints.Points[i], clone.Points[i]);
            }

            Assert.AreEqual(convexHullOfPoints.GetAabb(Pose.Identity).Minimum, clone.GetAabb(Pose.Identity).Minimum);
            Assert.AreEqual(convexHullOfPoints.GetAabb(Pose.Identity).Maximum, clone.GetAabb(Pose.Identity).Maximum);
        }
Пример #9
0
 public void TwoPoints()
 {
     Vector3F point0 = new Vector3F(1, 0, 0);
       Vector3F point1 = new Vector3F(10, 0, 0);
       ConvexHullOfPoints convexHullOfPoints = new ConvexHullOfPoints(new[] { point0, point1 });
       Assert.AreEqual(2, convexHullOfPoints.Points.Count);
       Assert.AreEqual((point0 + point1) / 2, convexHullOfPoints.InnerPoint);
       Assert.AreEqual(new Aabb(point0, point1), convexHullOfPoints.GetAabb(Pose.Identity));
 }
Пример #10
0
 public void ThreePoints()
 {
     Vector3F point0 = new Vector3F(1, 1, 1);
       Vector3F point1 = new Vector3F(2, 1, 1);
       Vector3F point2 = new Vector3F(1, 2, 1);
       ConvexHullOfPoints convexHullOfPoints = new ConvexHullOfPoints(new[] { point0, point1, point2 });
       Assert.AreEqual(3, convexHullOfPoints.Points.Count);
       Assert.AreEqual((point0 + point1 + point2) / 3, convexHullOfPoints.InnerPoint);
       Assert.AreEqual(new Aabb(new Vector3F(1, 1, 1), new Vector3F(2, 2, 1)), convexHullOfPoints.GetAabb(Pose.Identity));
 }