Beispiel #1
0
        public void TestFirstAxisIsAxisOfMaximumSpread()
        {
            KdNode <IVector> n = new KdNode <IVector>();

            n.Vectors        = new List <IVector>(new IVector[] { Vector.Create(-10.0f, 0.5), Vector.Create(1.0f, -1.0), Vector.Create(1.0f, 2.0), Vector.Create(1.0f, 1.5) });
            n.InternalBounds = new AABB(2);
            n.InternalBounds.Enlarge <IVector>(n.Vectors);
            n.InternalBounds = new AABB(n.InternalBounds);
            AxisOfMaximumSpreadSelector s = new AxisOfMaximumSpreadSelector();

            Assert.AreEqual(0, s.Select(n));
        }
Beispiel #2
0
 public void TestTrivialSplitsForEndlessRecursion() {
   // Test when split bounds is non-empty, but all contained points are degenerate
   KdNode<IVector> n = new KdNode<IVector>();
   n.Vectors = new List<IVector>(new IVector[] { Vector.Create(-1, -5), Vector.Create(-1, -5) });
   n.InternalBounds = new AABB(Vector.Create(-1.25, -5), Vector.Create(-1, -5));
   n.InternalBounds = new AABB(2);
   n.InternalBounds.Enlarge<IVector>(n.Vectors);
   AxisOfMaximumSpreadSelector aom = new AxisOfMaximumSpreadSelector();
   PeriodicAxisSelector pas = new PeriodicAxisSelector();
   NUnitExtensions.Assert.Throws(typeof(DegenerateDatasetException), delegate { aom.Select(n); });
   NUnitExtensions.Assert.Throws(typeof(DegenerateDatasetException), delegate { pas.Select(n); });
 }
Beispiel #3
0
        public void TestAllCoordinatesSame()
        {
            KdNode <IVector> n = new KdNode <IVector>();

            n.Vectors        = new List <IVector>(new IVector[] { Vector.Create(1.0f), Vector.Create(1.0f), Vector.Create(1.0f), Vector.Create(1.0f) });
            n.InternalBounds = new AABB(1);
            n.InternalBounds.Enlarge <IVector>(n.Vectors);
            n.InternalBounds = new AABB(n.InternalBounds);
            AxisOfMaximumSpreadSelector s = new AxisOfMaximumSpreadSelector();

            s.Select(n);
        }