Rotate mesh around x-axis

        :param float deg: Rotation angle (degree)
        :return:
769039
def rotate_x(self, deg):
        
        rad = math.radians(deg)
        mat = numpy.array([
            [1, 0, 0, 0],
            [0, math.cos(rad), math.sin(rad), 0],
            [0, -math.sin(rad), math.cos(rad), 0],
            [0, 0, 0, 1]
        ])
        self.vectors = self.vectors.dot(mat)
        return self
62037
def rotatePolygon(polygon, theta, origin=None):
    
    if origin is None:
        origin = np.mean(polygon, axis=0, dtype=polygon.dtype)
    #polygon = polygon.copy()
    polygon -= origin
    for n, corner in enumerate(polygon):
        polygon[n] = corner[0] * np.cos(theta) - corner[1] * np.sin(theta), corner[
            0] * np.sin(theta) + corner[1] * np.cos(theta)
    polygon += origin
    return polygon
33747
def rotated(self, angle_degrees_ccw):
        """"""
        angle = angle_degrees_ccw / 180.0 * pi
        c, s = cos(angle), sin(angle)
        return self @ PdfMatrix((c, s, -s, c, 0, 0))
1290170
def rotateZ(self, angle, axis_point=(0, 0, 0), rad=False):
        """"""
        if rad:
            angle *= 57.29578
        self.RotateZ(angle)
        if self.trail:
            self.updateTrail()
        return self
757276
def do(self, x_orig):
        
        if self.scales is None:
            return x_orig
        else:
            return np.dot(self.rotation.transpose(), x_orig)*self.scales
398714
def rotateX(self, angle, axis_point=(0, 0, 0), rad=False):
        """"""
        if rad:
            angle *= 57.29578
        self.RotateX(angle)
        if self.trail:
            self.updateTrail()
        return self
1022764
def rotate_du_by_yaw(self, du, heading):
        """"""
        mask = (self.pmts.du == du)
        dom_ids = np.unique(self.pmts.dom_id[mask])
        for dom_id in dom_ids:
            self.rotate_dom_by_yaw(dom_id, heading)
        self.reset_caches()
246281
public Quaternionf rotateX(float angle, Quaternionf dest) {
        float sin = (float) Math.sin(angle * 0.5);
        float cos = (float) Math.cosFromSin(sin, angle * 0.5);
        dest.set(w * sin + x * cos,
                 y * cos + z * sin,
                 z * cos - y * sin,
                 w * cos - x * sin);
        return dest;
    }
494740
function skewDEG(ax, ay) {
    return skew(ax * Math.PI / 180, ay * Math.PI / 180);
}
117196
def from_axis_angle(axis, angle):
    

    sincomp = math.sin(angle / 2.0)
    return Quaternion(
      axis.x * sincomp, axis.y * sincomp,
      axis.z * sincomp, math.cos(angle / 2.0))
1264428
def rotate(self, axis, angleDeg):
        
        ax = Vector(axis[0], axis[1], axis[2]).unit()
        cosAngle = math.cos(math.pi * angleDeg / 180.)
        sinAngle = math.sin(math.pi * angleDeg / 180.)

        def newVector(v):
            vA = v.dot(ax)
            vPerp = v.minus(ax.times(vA))
            vPerpLen = vPerp.length()
            if vPerpLen == 0:
                # vector is parallel to axis, no need to rotate
                return v
            u1 = vPerp.unit()
            u2 = u1.cross(ax)
            vCosA = vPerpLen*cosAngle
            vSinA = vPerpLen*sinAngle
            return ax.times(vA).plus(u1.times(vCosA).plus(u2.times(vSinA)))

        for poly in self.polygons:
            for vert in poly.vertices:
                vert.pos = newVector(vert.pos)
                normal = vert.normal
                if normal.length() > 0:
                    vert.normal = newVector(vert.normal)
911154
def rotation_df(ATT):
    ''''''
    r = Matrix3()
    r.from_euler(radians(ATT.Roll), radians(ATT.Pitch), radians(ATT.Yaw))
    return r
1348995
public Matrix4x3d rotateAround(Quaterniondc quat, double ox, double oy, double oz, Matrix4x3d dest) {
        if ((properties & PROPERTY_IDENTITY) != 0)
            return rotationAround(quat, ox, oy, oz);
        return rotateAroundAffine(quat, ox, oy, oz, dest);
    }
638501
public Matrix3f rotateX(float ang, Matrix3f dest) {
        float sin, cos;
        if (ang == (float) Math.PI || ang == -(float) Math.PI) {
            cos = -1.0f;
            sin = 0.0f;
        } else if (ang == (float) Math.PI * 0.5f || ang == -(float) Math.PI * 1.5f) {
            cos = 0.0f;
            sin = 1.0f;
        } else if (ang == (float) -Math.PI * 0.5f || ang == (float) Math.PI * 1.5f) {
            cos = 0.0f;
            sin = -1.0f;
        } else {
            sin = (float) Math.sin(ang);
            cos = (float) Math.cosFromSin(sin, ang);
        }
        float rm11 = cos;
        float rm21 = -sin;
        float rm12 = sin;
        float rm22 = cos;

        // add temporaries for dependent values
        float nm10 = m10 * rm11 + m20 * rm12;
        float nm11 = m11 * rm11 + m21 * rm12;
        float nm12 = m12 * rm11 + m22 * rm12;
        // set non-dependent values directly
        dest.m20 = m10 * rm21 + m20 * rm22;
        dest.m21 = m11 * rm21 + m21 * rm22;
        dest.m22 = m12 * rm21 + m22 * rm22;
        // set other values
        dest.m10 = nm10;
        dest.m11 = nm11;
        dest.m12 = nm12;
        dest.m00 = m00;
        dest.m01 = m01;
        dest.m02 = m02;

        return dest;
    }
734959
function rounddeg(angle) {
    var result = 360.0 * (angle / 360.0 - Math.floor(angle / 360.0));
    if (result < 0.0) {
        result += 360.0;
    }
    if (result >= 360.0) {
        result -= 360.0;
    }
    return result;
}
1349418
def dihedral(x, dih):
    
    x = np.rot90(x, dih%4)
    return x if dih<4 else np.fliplr(x)
1045782
function(node,x,y,size,context) {
    var rotate = Math.PI*45/180; // 45 deg rotation of a diamond shape
    context.moveTo(x+size*Math.sin(rotate), y-size*Math.cos(rotate)); // first point on outer radius, dwangle 'rotate'
    for(var i=1; i<4; i++) {
      context.lineTo(x+Math.sin(rotate+2*Math.PI*i/4)*size, y-Math.cos(rotate+2*Math.PI*i/4)*size);
    }
  }