rotate along y-axis normal_map: np.array, shape=(H, W, 3) in [-1, 1] angle: float, in degree
(normal_map: np.ndarray, angle: float)
| 96 | return mesh.verts_list()[0], mesh.faces_list()[0], mesh.textures.verts_features_packed() |
| 97 | |
| 98 | def rotate_normalmap_by_angle(normal_map: np.ndarray, angle: float): |
| 99 | """ |
| 100 | rotate along y-axis |
| 101 | normal_map: np.array, shape=(H, W, 3) in [-1, 1] |
| 102 | angle: float, in degree |
| 103 | """ |
| 104 | angle = angle / 180 * np.pi |
| 105 | R = np.array([[np.cos(angle), 0, np.sin(angle)], [0, 1, 0], [-np.sin(angle), 0, np.cos(angle)]]) |
| 106 | return np.dot(normal_map.reshape(-1, 3), R.T).reshape(normal_map.shape) |
| 107 | |
| 108 | # from view coord to front view world coord |
| 109 | def rotate_normals(normal_pils, return_types='np', rotate_direction=1) -> np.ndarray: # [0, 255] |
no outgoing calls
no test coverage detected