Revit.SDK.Samples.SlabShapeEditing.CS.Matrix4.RotateX C# (CSharp) Méthode

RotateX() public static méthode

get a matrix used to rotate object specific angle on X direction
public static RotateX ( double angle ) : Matrix4
angle double rotate angle
Résultat Matrix4
        public static Matrix4 RotateX(double angle)
        {
            Matrix4 rotateX = new Matrix4();
            rotateX.Type = MatrixType.Rotation;
            rotateX.Identity();
            double sin = (double)Math.Sin(angle);
            double cos = (double)Math.Cos(angle);
            rotateX.Matrix[1, 1] = cos;
            rotateX.Matrix[1, 2] = sin;

            rotateX.Matrix[2, 1] = -sin;
            rotateX.Matrix[2, 2] = cos;
            return rotateX;
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// rotate slab with specific angle
        /// </summary>
        /// <param name="xAngle">rotate angle in X direction</param>
        /// <param name="yAngle">rotate angle in Y direction</param>
        public void RotateFloor(double xAngle, double yAngle)
        {
            if (0 == xAngle && 0 == yAngle)
            {
                return;
            }
            m_rotateAngleX += xAngle;
            m_rotateAngleY += yAngle;

            Matrix4 rotateX      = Matrix4.RotateX(m_rotateAngleX);
            Matrix4 rotateY      = Matrix4.RotateY(m_rotateAngleY);
            Matrix4 rotateMatrix = Matrix4.Multiply(rotateX, rotateY);

            m_rotateMatrix = Matrix4.Multiply(m_MoveToPictureBoxCenter.Inverse(), rotateMatrix);
            m_rotateMatrix = Matrix4.Multiply(m_rotateMatrix, m_MoveToPictureBoxCenter);
        }