Create a Y-axis rotation matrix as in transforms.cpp
| 51 | |
| 52 | // Create a Y-axis rotation matrix as in transforms.cpp |
| 53 | Tensor createYRotationMatrix(float angle_radians) { |
| 54 | Tensor rotMat = Tensor::eye(4, Device::CPU); |
| 55 | float cos_angle = std::cos(angle_radians); |
| 56 | float sin_angle = std::sin(angle_radians); |
| 57 | |
| 58 | rotMat[0][0] = cos_angle; |
| 59 | rotMat[0][1] = 0.0f; |
| 60 | rotMat[0][2] = sin_angle; |
| 61 | rotMat[1][0] = 0.0f; |
| 62 | rotMat[1][1] = 1.0f; |
| 63 | rotMat[1][2] = 0.0f; |
| 64 | rotMat[2][0] = -sin_angle; |
| 65 | rotMat[2][1] = 0.0f; |
| 66 | rotMat[2][2] = cos_angle; |
| 67 | |
| 68 | return rotMat; |
| 69 | } |
| 70 | |
| 71 | torch::Tensor createYRotationMatrixTorch(float angle_radians) { |
| 72 | float cos_angle = std::cos(angle_radians); |