當前位置: 首頁>>代碼示例>>C#>>正文


C# AnimatTools.SetAttrib方法代碼示例

本文整理匯總了C#中AnimatTools.SetAttrib方法的典型用法代碼示例。如果您正苦於以下問題:C# AnimatTools.SetAttrib方法的具體用法?C# AnimatTools.SetAttrib怎麽用?C# AnimatTools.SetAttrib使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AnimatTools的用法示例。


在下文中一共展示了AnimatTools.SetAttrib方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SaveData

        public override void SaveData(ref AnimatTools.DataObjects.Simulation dsSim, ref AnimatTools.DataObjects.Physical.PhysicalStructure doStructure, ref AnimatTools.Interfaces.StdXml oXml)
        {
            base.SaveData (ref dsSim, ref doStructure, ref oXml);

            oXml.IntoElem();

            RigidBodies.RigidBody_DX rbParent = (RigidBodies.RigidBody_DX)this.Parent;
            Vector3 v3Rot = Util_DX.DecomposeXYZRotationMatrix(this.CombinedTransformationMatrix);;
            float x = Geometry.DegreeToRadian(180);

            if(!oXml.FindChildElement("Constraint", false))
                oXml.AddChildElement("Constraint");
            oXml.IntoElem();
            oXml.SetAttrib("Low",this.m_fltMinAngle);
            oXml.SetAttrib("High", this.m_fltMaxAngle);
            oXml.OutOfElem();

            oXml.AddChildElement("EnableMotor",this.m_bEnableMotor);
            oXml.AddChildElement("ServoMotor",this.m_bServoMotor);
            oXml.AddChildElement("ServoGain",this.m_fltServoGain);

            m_snMaxTorque.SaveData(ref oXml, "MaxTorque");
            m_snMaxVelocity.SaveData(ref oXml, "MaxVelocity");

            //			if(v3Rot.Y >= 180)
            //				m_v3Axis.TransformCoordinate(/*Matrix.RotationX(Geometry.DegreeToRadian(180))*  Matrix.RotationY(Geometry.DegreeToRadian(180)) * Matrix.RotationZ(Geometry.DegreeToRadian(180)) **/ Matrix.RotationX(v3Rot.X)* Matrix.RotationY(v3Rot.Y) * Matrix.RotationZ(v3Rot.Z));
            //			else
                //m_v3Axis.TransformCoordinate(Matrix.RotationX(Geometry.DegreeToRadian(180)) * Matrix.RotationY(Geometry.DegreeToRadian(180)) * Matrix.RotationZ(Geometry.DegreeToRadian(180)) * Matrix.RotationX(v3Rot.X)* Matrix.RotationY(v3Rot.Y) * Matrix.RotationZ(v3Rot.Z));
            Matrix m = this.CombinedTransformationMatrix;
            m.M41 = 0;
            m.M42 = 0;
            m.M43 = 0;
            //Quaternion q = Quaternion.RotationYawPitchRoll(v3Rot.Y, v3Rot.X, v3Rot.Z);
            //m_v3Axis.TransformCoordinate(Matrix.RotationQuaternion(q));
            m_v3Axis.TransformCoordinate(m);

            //Vec3d vRotationAxis = new Vec3d(null,1, 0, 0);
            Vec3d vRotationAxis = new Vec3d(null,m_v3Axis.X, m_v3Axis.Y, m_v3Axis.Z);
            Util.SaveVector(ref oXml, "RotationAxis", vRotationAxis);

            oXml.OutOfElem();
            m_v3Axis = new Vector3(0,0,1);
        }
開發者ID:NeuroRoboticTech,項目名稱:AnimatLabVersion1,代碼行數:43,代碼來源:Hinge_New.cs

示例2: SaveData

        public override void SaveData(ref AnimatTools.DataObjects.Simulation dsSim, ref AnimatTools.DataObjects.Physical.PhysicalStructure doStructure, ref AnimatTools.Interfaces.StdXml oXml)
        {
            base.SaveData (ref dsSim, ref doStructure, ref oXml);

            oXml.IntoElem();

            if(!oXml.FindChildElement("Constraint", false))
                oXml.AddChildElement("Constraint");
            oXml.IntoElem();
            oXml.SetAttrib("Low",this.m_fltMinMovement);
            oXml.SetAttrib("High", this.m_fltMaxMovement);
            oXml.OutOfElem();

            oXml.AddChildElement("Length", m_fltLength);
            oXml.AddChildElement("EnableMotor",this.m_bEnableMotor);
            oXml.AddChildElement("ServoMotor",this.m_bServoMotor);
            oXml.AddChildElement("ServoGain",this.m_fltServoGain);
            m_snMaxForce.SaveData(ref oXml, "MaxForce");
            m_snMaxVelocity.SaveData(ref oXml, "MaxVelocity");

            RigidBodies.RigidBody_DX rbParent = (RigidBodies.RigidBody_DX)this.Parent;
            Vector3 v3Rot = Util_DX.DecomposeXYZRotationMatrix(this.CombinedTransformationMatrix);;
            float x = Geometry.DegreeToRadian(180);
            m_v3Axis.TransformCoordinate(Matrix.RotationX(Geometry.DegreeToRadian(180)) * Matrix.RotationY(Geometry.DegreeToRadian(180)) * Matrix.RotationZ(Geometry.DegreeToRadian(180)) * Matrix.RotationX(v3Rot.X)* Matrix.RotationY(v3Rot.Y) * Matrix.RotationZ(v3Rot.Z));
            Vec3d vRotationAxis = new Vec3d(null,m_v3Axis.X, m_v3Axis.Y, m_v3Axis.Z);
            Util.SaveVector(ref oXml, "RotationAxis", vRotationAxis);
            m_v3Axis = new Vector3(0,0,1);

            oXml.OutOfElem();
        }
開發者ID:NeuroRoboticTech,項目名稱:AnimatLabVersion1,代碼行數:30,代碼來源:Prismatic.cs


注:本文中的AnimatTools.SetAttrib方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。