00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include <stdio.h>
00042 #include <string.h>
00043 #include "mensagem.h"
00044 #include "memvirtu.h"
00045 #include "lowparam.h"
00046 #include "lowsolid.h"
00047 #include "eulerops.h"
00048 #include "vectorop.h"
00049 #include "mancommd.h"
00050 #include "shpshape.h"
00051 #include "basrov__.h"
00052
00053 int MSD_highNameRotaciona(char *name, real ax, real ay, real az);
00054 int MSD_highRotaciona(Id sn, real ax, real ay, real az);
00055
00056 void MSD_execNameRotaciona(void)
00057 {
00058 char name[30];
00059 float ax, ay, az;
00060
00061 while (4 != sscanf(restbuf, "%s %f %f %f", name, &ax, &ay, &az))
00062 {
00063 printf("ROV.rotaciona nome ax ay az\n");
00064 if (!lineins("? "))
00065 {
00066 return;
00067 }
00068 }
00069 MSD_highNameRotaciona(name, ax, ay, az);
00070 }
00071
00072 int MSD_highNameRotaciona(char *name, real ax, real ay, real az)
00073 {
00074 int sn;
00075
00076 if ((sn = MSD_getSolidIdFromName(name)) == -1)
00077 {
00078 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_RovRotate, name);
00079 return(ERROR);
00080 }
00081 return(MSD_highRotaciona(sn, ax, ay, az));
00082 }
00083
00084 int MSD_highRotaciona(Id sn, real ax, real ay, real az)
00085 {
00086 SPTYPE s;
00087 vector dir;
00088 matrix mat;
00089
00090 if ((s = MSD_getSolid(sn)) == SNIL)
00091 {
00092 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_RovRotate, sn);
00093 return(ERROR);
00094 }
00095
00096 MSD_lowRotate(s, ax, ay, az);
00097 if (SolPerfil(s) != -1)
00098 {
00099 MSD_lowRotate(MSD_getSolid(SolPerfil(s)), ax, ay, az);
00100 }
00101
00102 switch (SolType(s))
00103 {
00104 case SOLIDO_TIPO_SOLID:
00105 switch (SolGeometria(s))
00106 {
00107 case SOLIDO_GEOM_CONE:
00108 matident(mat);
00109 matrotat(mat, ax, ay, az);
00110 veccopy(dir, SolPrincDir(s));
00111 vecmult(dir, dir, mat);
00112 veccopy(SolPrincDir(s), dir);
00113 break;
00114 }
00115 break;
00116
00117 case SOLIDO_TIPO_BARRA:
00118 matident(mat);
00119 matrotat(mat, ax, ay, az);
00120 veccopy(dir, SolPrincDir(s));
00121 vecmult(dir, dir, mat);
00122 veccopy(SolPrincDir(s), dir);
00123 break;
00124
00125 case SOLIDO_TIPO_PLACA:
00126 matident(mat);
00127 matrotat(mat, ax, ay, az);
00128 veccopy(dir, SolPrincDir(s));
00129 vecmult(dir, dir, mat);
00130 veccopy(SolPrincDir(s), dir);
00131 break;
00132 }
00133
00134 return(SUCCESS);
00135 }