Exemple #1
0
        public void SingleBonePointsToLeftTarget()
        {
            var arm    = new Armature2D(new Bone(10, -90, 90));
            var solver = new TriangulationSolver2D(arm);

            //Target point is off to the left (and too close to actually reach).
            //Should point almost at the target
            var solution = solver.Solve(new Vector2(-5, 0)).ToArray();

            DrawArmature(arm, solution, new Vector2(-5, 0));

            Assert.AreEqual(-90, solution.Single(), 2);
        }
Exemple #2
0
        public void TwoBonesPointToRightTarget()
        {
            var arm    = new Armature2D(new Bone(10, -180, 180), new Bone(10, -180, 180));
            var solver = new TriangulationSolver2D(arm);

            //Target point is off to the right (and too close to actually reach).
            //Should point almost at the target
            var solution = solver.Solve(new Vector2(5, 0)).ToArray();

            DrawArmature(arm, solution, new Vector2(5, 0));

            Assert.AreEqual(14, solution[0], 2);
            Assert.AreEqual(150, solution[1], 2);
        }
Exemple #3
0
        public void TheFinalTest()
        {
            var arm = new Armature2D(
                new Bone(7, 0, 80),
                new Bone(7, -80, 80),
                new Bone(7, -80, 80)
                );
            var solver = new TriangulationSolver2D(arm);

            //Change this target point, grab the output from the test runner console
            var target = new Vector2(-15, 0);

            var solution = solver.Solve(target).ToArray();

            DrawArmature(arm, solution, target);
        }