public void Test_BarnesHutTree_ctor()
        {
            var bht = new BarnesHutTree(new ArborPoint(-1, -1), new ArborPoint(+1, +1), 0.5f);

            Assert.IsNotNull(bht);

            bht.Reset();
            Assert.AreEqual(0, bht.Root.Mass);
            Assert.AreEqual(ArborPoint.Zero, bht.Root.Pt);
        }
Example #2
0
        private void ApplyBarnesHutRepulsion()
        {
            fBHTree.Reset();

            int nodesCount = fNodes.Count;

            for (int i = 0; i < nodesCount; i++)
            {
                ArborNode node = fNodes[i];
                fBHTree.Insert(node);
            }

            for (int i = 0; i < nodesCount; i++)
            {
                ArborNode node = fNodes[i];
                fBHTree.ApplyForces(node, fRepulsion);
            }
        }