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

RotateY() public static méthode

get a matrix used to rotate object specific angle on Y direction
public static RotateY ( double angle ) : Matrix4
angle double rotate angle
Résultat Matrix4
        public static Matrix4 RotateY(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[0, 0] = cos;
            rotateX.Matrix[0, 2] = -sin;

            rotateX.Matrix[2, 0] = 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);
        }