Exemple #1
0
        public void TestMap_NotNormalized()
        {
            Graph.SinMap1DNode map1DNode = new Graph.SinMap1DNode(false, 0);

            SomeMap <float, float> map = map1DNode.ValueForOutput <SomeMap <float, float> >("value", null, null) as SomeMap <float, float>;

            Assert.NotNull(map);

            Assert.AreEqual(Mathf.Sin(0), map.ValueFor(0), .001f);
            Assert.AreEqual(Mathf.Sin(0.3f * 2.0f * Mathf.PI), map.ValueFor(0.3f), .001f);
        }
        public void TestMap_YAxis()
        {
            Graph.SinMap1DNode     map1DNode     = new Graph.SinMap1DNode(false, 0);
            Graph.Map1DToMap2DNode transformNode = new Graph.Map1DToMap2DNode(Axis2D.Y);
            map1DNode.AddOutput("value", transformNode, "value");

            SomeMap <Vector2, float> map = transformNode.ValueForOutput <SomeMap <Vector2, float> >("value", null, null) as SomeMap <Vector2, float>;

            Assert.NotNull(map);

            Assert.AreEqual(Mathf.Sin(0), map.ValueFor(new Vector2(0.5f, 0)));
            Assert.AreEqual(Mathf.Sin(0.3f * 2.0f * Mathf.PI), map.ValueFor(new Vector2(0.5f, 0.3f)), .001f);
        }
Exemple #3
0
        public void TestMap_Normalized()
        {
            Graph.SinMap1DNode map1DNode = new Graph.SinMap1DNode(true, 0);

            SomeMap <float, float> map = map1DNode.ValueForOutput <SomeMap <float, float> >("value", null, null) as SomeMap <float, float>;

            Assert.NotNull(map);

            Assert.AreEqual(0.5f, map.ValueFor(0), .001f);
            Assert.AreEqual(1.0f, map.ValueFor(0.25f), .001f);
            Assert.AreEqual(0, map.ValueFor(0.75f), .001f);
            Assert.AreEqual(0.5f, map.ValueFor(1.0f), .001f);
        }
        public void TestMap()
        {
            Graph.SinMap1DNode     map1DNode     = new Graph.SinMap1DNode(false, 0);
            Graph.Map1DToMap2DNode transformNode = new Graph.Map1DToMap2DNode(Axis2D.X);
            map1DNode.AddOutput("value", transformNode, "value");

            var factor       = 3.0f;
            var multiplyNode = new Graph.MultiplyMap2DNode(factor);

            transformNode.AddOutput("value", multiplyNode, "value");

            SomeMap <Vector2, float> map = multiplyNode.ValueForOutput <SomeMap <Vector2, float> >("value", null, null) as SomeMap <Vector2, float>;

            Assert.NotNull(map);

            Assert.AreEqual(Mathf.Sin(0) * factor, map.ValueFor(new Vector2(0, 0.5f)));
            Assert.AreEqual(Mathf.Sin(0.3f * 2.0f * Mathf.PI) * factor, map.ValueFor(new Vector2(0.3f, 0.5f)), .001f);
        }