コード例 #1
0
ファイル: FRotator.cs プロジェクト: yimengfan/USharp
        /// <summary>
        /// Convert a rotation into a unit vector facing in its direction.
        /// </summary>
        /// <returns>Rotation as a unit direction vector.</returns>
        public FVector Vector()
        {
            float cp, sp, cy, sy;

            FMath.SinCos(out sp, out cp, FMath.DegreesToRadians(Pitch));
            FMath.SinCos(out sy, out cy, FMath.DegreesToRadians(Yaw));
            return(new FVector(cp * cy, cp * sy, sp));
        }
コード例 #2
0
ファイル: FVector2D.cs プロジェクト: zwywilliam/USharp
        /// <summary>
        /// Rotates around axis (0,0,1)
        /// </summary>
        /// <param name="angleDeg">Angle to rotate (in degrees)</param>
        /// <returns>Rotated Vector</returns>
        public FVector2D GetRotated(float angleDeg)
        {
            // Based on FVector::RotateAngleAxis with Axis(0,0,1)

            float s, c;

            FMath.SinCos(out s, out c, FMath.DegreesToRadians(angleDeg));

            float omc = 1.0f - c;

            return(new FVector2D(
                       c * X - s * Y,
                       s * X + c * Y));
        }