Esempio n. 1
0
        public void StringCompatibility()
        {
            const string s = "123.123 -123.987 0.000001 -0.111111";
            var          a = new SFVec4f(123.123f, -123.987f, 0.000001f, -0.111111f);

            Assert.AreEqual(s, a.ToString());
        }
Esempio n. 2
0
        public void HashCode()
        {
            var a = new SFVec4f();
            var b = new SFVec4f();

            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
        }
Esempio n. 3
0
        public void ObjectEquality()
        {
            var a = new SFVec4f(1234567.123456f, -1234567.987654f, 0.000001f, -0.111111f);
            var b = new SFVec4f(1234567.123456f, -1234567.987654f, 0.000001f, -0.111111f);
            var c = new SFVec4f(1234567.987654f, -1234567.123456f, 0.000001f, -0.111111f);

            Assert.AreEqual(a, b);
            Assert.AreNotEqual(a, c);
            Assert.AreNotEqual(b, c);
            Assert.AreEqual(a, a);
            Assert.AreEqual(c, c);

            Assert.AreNotEqual(c, false);
        }
Esempio n. 4
0
        public void Constructor()
        {
            var a = new SFVec4f();

            Assert.IsTrue(Math.Abs(a.X - 0.0f) < EPSILON);
            Assert.IsTrue(Math.Abs(a.Y - 0.0f) < EPSILON);
            Assert.IsTrue(Math.Abs(a.Z - 0.0f) < EPSILON);
            Assert.IsTrue(Math.Abs(a.Homegeneous - 1.0f) < EPSILON);

            var b = new SFVec4f(1, 1, 1, 0);

            Assert.IsTrue(Math.Abs(b.X - 1.0f) < EPSILON);
            Assert.IsTrue(Math.Abs(b.Y - 1.0f) < EPSILON);
            Assert.IsTrue(Math.Abs(b.Z - 1.0f) < EPSILON);
            Assert.IsTrue(Math.Abs(b.Homegeneous - 0.0f) < EPSILON);
        }
Esempio n. 5
0
 internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
 {
     if (id == "enabled")
     {
         Enabled = parser.ParseBoolValue();
     }
     else if (id == "plane")
     {
         Plane = parser.ParseSFVec4fValue();
     }
     else
     {
         return(false);
     }
     return(true);
 }
Esempio n. 6
0
        internal SFVec4f ParseSFVec4fValue()
        {
            // float float float float

            try
            {
                SFVec4f ret = new SFVec4f();
                ret.X = ParseDoubleValue();
                ret.Y = ParseDoubleValue();
                ret.Z = ParseDoubleValue();
                ret.W = ParseDoubleValue();
                return(ret);
            }
            catch (UserCancellationException) { throw; }
            catch (Exception ex)
            {
                ErrorParsingField(VRMLReaderError.SFVec4fInvalid, ex);
            }

            return(null);
        }
Esempio n. 7
0
 public x3dClipPlane()
 {
     Enabled = true;
     Plane   = new SFVec4f(0, 1, 0, 0);
 }