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


C# Matrix4x4.GetRow3方法代码示例

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


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

示例1: FromMatrix4

 public void FromMatrix4( Matrix4x4 a )
 {
     r0.FromVector4( a.GetRow0() ); r1.FromVector4( a.GetRow1() ); r2.FromVector4( a.GetRow2() ); r3.FromVector4( a.GetRow3() );
 }
开发者ID:Patapom,项目名称:GodComplex,代码行数:4,代码来源:MathStructs.cs

示例2: ComputeObjectDeltaPositionRotation

        /// <summary>
        /// Helper method that helps to compute the difference in translation and rotation of an object moving from one frame to the other
        /// This is essentially used for motion blur
        /// </summary>
        /// <param name="_Previous">The object's matrix at previous frame</param>
        /// <param name="_Current">The object's matrix at current frame</param>
        /// <param name="_DeltaPosition">Returns the difference in position from last frame</param>
        /// <param name="_DeltaRotation">Returns the difference in rotation from last frame</param>
        /// <param name="_Pivot">Returns the pivot position the object rotated about</param>
        public static void ComputeObjectDeltaPositionRotation( ref Matrix4x4 _Previous, ref Matrix4x4 _Current, out Vector _DeltaPosition, out Quat _DeltaRotation, out Vector _Pivot )
        {
            // Compute the rotation the matrix sustained
            Quat	PreviousRotation = QuatFromMatrix( _Previous );
            Quat	CurrentRotation = QuatFromMatrix( _Current );
            _DeltaRotation = QuatMultiply( QuatInvert( PreviousRotation ), CurrentRotation );

            Vector	PreviousPosition = (Vector) _Previous.GetRow3();
            Vector	CurrentPosition = (Vector) _Current.GetRow3();

            // Retrieve the pivot point about which that rotation occurred
            _Pivot = CurrentPosition;

            AngleAxis	AA = new AngleAxis( _DeltaRotation );
            float	RotationAngle = AA.Angle;
            if ( Math.Abs( RotationAngle ) > 1e-4f )
            {
                Vector	RotationAxis = AA.Axis;
                Vector	Previous2Current = CurrentPosition - PreviousPosition;
                float	L = Previous2Current.Length;
                if ( L > 1e-4f )
                {
                    Previous2Current /= L;
                    Vector	N = Previous2Current.Cross( RotationAxis );
                    N.Normalize();

                    Vector	MiddlePoint = 0.5f * (PreviousPosition + CurrentPosition);
                    float	Distance2Pivot = 0.5f * L / (float) Math.Tan( 0.5f * RotationAngle );
                    _Pivot = MiddlePoint + N * Distance2Pivot;
                }

                // Rotate previous position about pivot, this should yield us current position
                Vector	RotatedPreviousPosition = RotateAbout( PreviousPosition, _Pivot, _DeltaRotation );

            //				// Update previous position so the remaining position gap is filled by delta translation
            //				PreviousPosition = RotatedPreviousPosition;
                PreviousPosition = CurrentPosition;	// Close the gap so we have no delta translation
            }

            _DeltaPosition = CurrentPosition - PreviousPosition;	// Easy !
        }
开发者ID:Patapom,项目名称:GodComplex,代码行数:50,代码来源:Scene.cs


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