本文整理汇总了C++中Matrix3x3::identity方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3x3::identity方法的具体用法?C++ Matrix3x3::identity怎么用?C++ Matrix3x3::identity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3x3
的用法示例。
在下文中一共展示了Matrix3x3::identity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_input
void process_input(Matrix3x3 &M){
char command[1024];
bool done;
float theta, s, cx, cy;
float sx, sy, shx, shy, px, py;
int dx, dy;
/* build identity matrix */
M.identity();
for(done = false; !done;) {
/* prompt and accept input, converting text to lower case */
cout << "> ";
cin >> command;
lowercase(command);
/* parse the input command, and read parameters as needed */
if(strcmp(command, "d") == 0) {
done = true;
imageData = Manipulation::warper(imageData, M);
}
else if(strcmp(command, "n") == 0) {// twirl
if(cin >> s >> cx >> cy)
imageData = Manipulation::twirl(imageData, s, cx, cy);
else
cout << "invalid twirl parameter\n";
done = true;
}
else if(strlen(command) != 1) {
示例2: process_input
/*
Routine to build a projective transform from input text, display, or
write transformed image to a file
*/
void process_input(Matrix3x3 &M) {
char command[1024];
bool done;
float theta;
float inputX;
float inputY;
float inputZ;
/* build identity matrix */
M.identity();
for(done = false; !done;) {
/* prompt and accept input, converting text to lower case */
printf("> ");
scanf("%s", command);
lowercase(command);
/* parse the input command, and read parameters as needed */
if(strcmp(command, "d") == 0) {
done = true;
} else if(strlen(command) != 1) {
printf("invalid command, enter r, s, t, h, d\n");
} else {
switch(command[0]) {
case 'r': /* Rotation, accept angle in degrees */
if(scanf("%f", &theta) == 1)
Rotate(M, theta);
else
fprintf(stderr, "invalid rotation angle\n");
break;
case 's': /* Scale, accept scale factors */
if(scanf("%f %f", &inputX, &inputY))
Scale(M, inputX, inputY);
else
fprintf(stderr,"invalid scaling input\n");
break;
case 't': /* Translation, accept translations */
if(scanf("%f %f", &inputX, &inputY))
Translate(M, inputX, inputY);
else
fprintf(stderr,"invalid scaling input\n");
break;
case 'h': /* Shear, accept shear factors */
if(scanf("%f %f", &inputX, &inputY))
Shear(M, inputX, inputY);
else
fprintf(stderr,"invalid scaling input\n");
break;
//twirl mode on
case 'n':
if(scanf("%f %f %f", &inputX, &inputY, &inputZ)) {
manager.turnTwrilModeOn(inputX, inputY, inputZ);
} else {
fprintf(stderr, "invalid scaling input\n");
}
break;
case 'p':
if(scanf("%f %f", &inputX, &inputY))
Perspective(M, inputX, inputY);
else
fprintf(stderr,"invalid scaling input\n");
break;
case 'd': /* Done, that's all for now */
done = true;
break;
default:
printf("invalid command, enter r, s, t, h, d\n");
}
}
}
}