Example #1
0
        public void InitializesWidthIndicesAndPhyllotaxisPositions()
        {
            var collide = new ForceCollide <Node>();
            var nodes   = new List <Node>
            {
                new Node(),
                new Node(),
                new Node(),
            };

            var f = new Simulation <Node>();

            f.Nodes = nodes;

            Assert.IsTrue(NodeEquals.Equals(nodes[0], new Node
            {
                X     = 7.0710678118654755,
                Y     = 0,
                Index = 0,
                Vx    = 0,
                Vy    = 0
            }));

            Assert.IsTrue(NodeEquals.Equals(nodes[1], new Node
            {
                X     = -9.03088751750192,
                Y     = 8.27303273571596,
                Index = 1,
                Vx    = 0,
                Vy    = 0
            }));

            Assert.IsTrue(NodeEquals.Equals(nodes[2], new Node
            {
                X     = 1.3823220809823638,
                Y     = -15.750847141167634,
                Index = 2,
                Vx    = 0,
                Vy    = 0
            }));
        }
Example #2
0
        public void FindOne()
        {
            var collide = new ForceCollide <Node>();
            var nodes   = new List <Node>
            {
                new Node {
                    X = 5, Y = 0
                },
                new Node {
                    X = 10, Y = 16
                },
                new Node {
                    X = -10, Y = -4
                },
            };

            var f = new Simulation <Node>();

            f.Nodes = nodes;

            Assert.AreEqual(nodes[0], f.Find(0, 0));
            Assert.AreEqual(nodes[1], f.Find(0, 20));
        }