博记:通过输入旋转角度得到。
已知向量vector1[][]={{1},{1},{1}};,经过旋转之后得到的向量matrix_result[][]表示;
程序实现如下:
#include "iostream"
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
const double pi=acos(-1.0);
#define SIZE_M 3
#define SIZE_N 3
#define SIZE_S 3
#define SIZE_T 3
#define J 1
int main()
{
double a;
cout<<"a="<>a;
double b;
cout<<"b="<>b;
double c;
cout<<"c="<>c;
double r1[SIZE_M] [SIZE_N]={{1, 0, 0},{0, cos(a*pi), sin(a*pi)},{0, -sin(a*pi), cos(a*pi)}};//a矩阵3X3
double r2[SIZE_N] [SIZE_S]={{cos(b*pi), 0, -sin(b*pi)},{0, 1, 0},{sin(b*pi), 0, cos(b*pi)}};//b矩阵3X3
double r3[SIZE_S][SIZE_T]={{cos(c*pi), sin(c*pi), 0},{-sin(c*pi), cos(c*pi), 0},{0, 0, 1}};//c矩阵3*3
double vector1[SIZE_T][J]={{1},{1},{1}};
double matrix_result[SIZE_M][SIZE_T];//旋转矩阵相乘之后的结果矩阵3*3
double matrix_result1[SIZE_M][J];//旋转之后的向量
for(int m=0;m
运行结果:
验证结果: