public x3dRigidBody()
 {
     AngularDampingFactor = 0.001;
     AngularVelocity      = new SFVec3f(0, 0, 0);
     AutoDamp             = false;
     AutoDisable          = false;
     CenterOfMass         = new SFVec3f(0, 0, 0);
     DisableAngularSpeed  = 0;
     DisableLinearSpeed   = 0;
     DisableTime          = 0;
     Enabled            = true;
     FiniteRotationAxis = new SFVec3f(0, 0, 0);
     Fixed               = false;
     Forces              = new List <SFVec3f>();
     Geometry            = new List <X3DNBodyCollidableNode>();
     Inertia             = new SFMatrix3f(new List <double>(new double[] { 1, 0, 0, 0, 1, 0, 0, 0, 1 }));
     LinearDampingFactor = 0.001;
     LinearVelocity      = new SFVec3f(0, 0, 0);
     Mass              = 1;
     Orientation       = new SFRotation(0, 0, 1, 0);
     Position          = new SFVec3f(0, 0, 0);
     Torques           = new List <SFVec3f>();
     UseFiniteRotation = false;
     UseGlobalGravity  = true;
 }
Beispiel #2
0
        public void StringCompatibility()
        {
            var mat = new SFMatrix3f();
            var str = mat.ToString();

            Assert.AreEqual(mat.ToString(), "1 0 0 0 1 0 0 0 1");
        }
Beispiel #3
0
        public void Equals()
        {
            var mat1 = new SFMatrix3f();
            var mat2 = new SFMatrix3f();

            Assert.AreEqual(mat1, mat2);

            var test = new SFFloat[, ] {
                { 1, 1, 1 }, { 0, 0, 0 }, { -1, -1, -1 }
            };

            mat1 = new SFMatrix3f(test);
            mat2 = new SFMatrix3f(test);

            Assert.AreEqual(mat1.GetHashCode(), mat2.GetHashCode());
        }
Beispiel #4
0
        public void Constructors()
        {
            var mat = new SFMatrix3f();

            Assert.IsTrue(Math.Abs(mat.Elements[0, 0] - 1) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[0, 1] - 0) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[0, 2] - 0) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[1, 0] - 0) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[1, 1] - 1) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[1, 2] - 0) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[2, 0] - 0) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[2, 1] - 0) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[2, 2] - 1) < EPSILON);

            var test = new SFFloat[, ] {
                { 1, 1, 1 }, { 0, 0, 0 }, { -1, -1, -1 }
            };

            mat = new SFMatrix3f(test);

            Assert.IsTrue(Math.Abs(mat.Elements[0, 0] - 1) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[0, 1] - 1) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[0, 2] - 1) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[1, 0] - 0) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[1, 1] - 0) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[1, 2] - 0) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[2, 0] + 1) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[2, 1] + 1) < EPSILON);
            Assert.IsTrue(Math.Abs(mat.Elements[2, 2] + 1) < EPSILON);

            try
            {
                var element = new SFFloat[, ] {
                    { 1 }, { 0 }
                };
                new SFMatrix3f(element);
                Assert.Fail();
            }
            catch (ArgumentException)
            {
            }
        }
Beispiel #5
0
        internal SFMatrix3f ParseSFMatrix3fValue()
        {
            // 9x float

            try
            {
                SFMatrix3f ret = new SFMatrix3f();
                for (int i = 0; i < 9; i++)
                {
                    ret.Value.Add(ParseDoubleValue());
                }
                return(ret);
            }
            catch (UserCancellationException) { throw; }
            catch (Exception ex)
            {
                ErrorParsingField(VRMLReaderError.SFMatrix3fInvalid, ex);
            }

            return(null);
        }