当前位置: 首页>>代码示例>>C#>>正文


C# Vector3D.CrossProduct方法代码示例

本文整理汇总了C#中IrrlichtNETCP.Vector3D.CrossProduct方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3D.CrossProduct方法的具体用法?C# Vector3D.CrossProduct怎么用?C# Vector3D.CrossProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IrrlichtNETCP.Vector3D的用法示例。


在下文中一共展示了Vector3D.CrossProduct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CalcTargetFromPosition

        public static float CalcTargetFromPosition(ref Vector3D target, ref Vector3D position, ref Vector3D? front)
        {
            Vector3D f = new Vector3D(1, 0, 0);
            if (front != null)
                f = (Vector3D)front;

            Vector3D tar = target - position;
            tar.Z = 0;
            if (tar.LengthSQ > 0)
                tar.Normalize();

            float dotAngle;
            dotAngle = f.DotProduct(tar);
            //Vector3D.Dot(ref front, ref tar, out dotAngle);

            Vector3D cross;
            cross = f.CrossProduct(tar);
            //Vector3D.Cross(ref front, ref tar, out cross);

            float angle = (float)Math.Acos(dotAngle);
            if (cross.Z < 0)
                angle = MathHelper.TwoPI - angle;

            return angle;
        }
开发者ID:yooyke,项目名称:work,代码行数:25,代码来源:Util.cs

示例2: BuildCameraLookAtMatrixRH

        /// <summary> Builds a right-handed look-at matrix.</summary>
        public void BuildCameraLookAtMatrixRH(Vector3D position, Vector3D target, Vector3D upVector)
        {
            Vector3D zaxis = position - target;
            zaxis.Normalize();

            Vector3D xaxis = upVector.CrossProduct(zaxis);
            xaxis.Normalize();

            Vector3D yaxis = zaxis.CrossProduct(xaxis);

            SetMInsecure(0,0,xaxis.X);
            SetMInsecure(1,0,yaxis.X);
            SetMInsecure(2,0,zaxis.X);
            SetMInsecure(3,0,0);

            SetMInsecure(0,1,xaxis.Y);
            SetMInsecure(1,1,yaxis.Y);
            SetMInsecure(2,1,zaxis.Y);
            SetMInsecure(3,1,0);

            SetMInsecure(0,2,xaxis.Z);
            SetMInsecure(1,2,yaxis.Z);
            SetMInsecure(2,2,zaxis.Z);
            SetMInsecure(3,2,0);

            SetMInsecure(0,3,-xaxis.DotProduct(position));
            SetMInsecure(1,3,-yaxis.DotProduct(position));
            SetMInsecure(2,3,-zaxis.DotProduct(position));
            SetMInsecure(3,3,1.0f);
        }
开发者ID:Paulus,项目名称:irrlichtnetcp,代码行数:31,代码来源:Matrix4.cs

示例3: UserAvatarMoveMouse

        private void UserAvatarMoveMouse(Position2D _position)
        {
            if (Reference.Viewer.GuiManager.Focused)
            {
                Reference.Viewer.ProtocolManager.AvatarConnection.Forward = false;
                return;
            }

            // Get target position from mouse cursor position.
            Vector3D targetPosition = new Vector3D();
            Triangle3D triangle = new Triangle3D();
            bool find = FindPositionFromMousePosition(_position, out targetPosition, out triangle);
            if (find == false)
            {
                return;
            }

            targetPosition.Y = 0;

            // Get user avatar position.
            Vector3D userPosition = m_userPosition; //userObject.Node.Position;
            userPosition.Y = 0;

            bool isRunLenght = false;

            // Create target vector.
            Vector3D targetVec = targetPosition - userPosition;
            if (targetVec.LengthSQ < (ignoreMoveArea * ignoreMoveArea))
            {
                return;
            }
            else
            {
                if (targetVec.LengthSQ > (runLength * runLength))
                    isRunLenght = true;

                targetVec.Normalize();
            }

            Vector3D baseVector = new Vector3D(0, 0, -1);
            Vector3D verticalVector = baseVector.CrossProduct(targetVec);

            bool flipVector = verticalVector.Y > 0;
            if (flipVector == false)
            {
                baseVector = new Vector3D(0, 0, 1);
            }

            radHeading = baseVector.DotProduct(targetVec) * div2pi;
            radHeadingSmoothReset = true;

            if (flipVector)
            {
                radHeading += pi;
            }

            UserAvatarRotation(0);

            Reference.Viewer.ProtocolManager.AvatarConnection.Forward = true;
            Reference.Viewer.ProtocolManager.AvatarConnection.Run = isRunLenght;
        }
开发者ID:foxracle,项目名称:3di-viewer-rei,代码行数:61,代码来源:AvatarManager.cs

示例4: Vector3D

        //! multiplication operator by a vector
        public static Vector3D operator *(Vector3D lhs, Quaternion rhs)
        {
            Vector3D uv, uuv;
               Vector3D qvec = new Vector3D(rhs.X, rhs.Y, rhs.Z);
               uv = qvec.CrossProduct(lhs);
               uuv = qvec.CrossProduct(uv);
               uv *= (2.0f * rhs.W);
               uuv *= 2.0f;

               return lhs + uv + uuv;
        }
开发者ID:Paulus,项目名称:irrlichtnetcp,代码行数:12,代码来源:Quaternion.cs


注:本文中的IrrlichtNETCP.Vector3D.CrossProduct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。