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 "mensagem.h"
00043 #include "memvirtu.h"
00044 #include "lowparam.h"
00045 #include "lowmacro.h"
00046 #include "lowsolid.h"
00047 #include "vectorop.h"
00048 #include "mancommd.h"
00049 #include "disdispl.h"
00050 #include "genfunc_.h"
00051 #include "shpshape.h"
00052 #include "hiegroup.h"
00053
00054 #ifdef __Extended_Version
00055 void MSD_execNameRotateGroup(void)
00056 {
00057 char name[30];
00058 float th, x1, y1, z1, x2, y2, z2;
00059
00060 if (8 != sscanf(restbuf, "%s %f %f %f %f %f %f %f", name,
00061 &x1, &y1, &z1, &x2, &y2, &z2, &th))
00062 {
00063 printf("Grupo Pto_axis Vector Angulo\n");
00064 if (!lineins("? "))
00065 {
00066 return;
00067 }
00068 }
00069 MSD_highNameRotateGroup(name, x1, y1, z1, x2, y2, z2, th);
00070 }
00071
00072 #endif
00073
00074 int MSD_highNameRotateGroup(char *name, real x1, real y1, real z1, \
00075 real x2, real y2, real z2, real th)
00076 {
00077 int gn;
00078
00079 if ((gn = MSD_getGroupIdFromName(name)) == -1)
00080 {
00081 fprintf(stderr, MEN_NaoEncontrouGroupNome, NAM_RotateGroup, name);
00082 return(ERROR);
00083 }
00084 return(MSD_highRotateGroup(gn, x1, y1, z1, x2, y2, z2, th));
00085 }
00086
00087 #ifdef __Extended_Version
00088 void MSD_execRotateGroup(void)
00089 {
00090 float th, x1, y1, z1, x2, y2, z2;
00091 int gn;
00092
00093 if (8 != sscanf(restbuf, "%d %f %f %f %f %f %f %f", &gn,
00094 &x1, &y1, &z1, &x2, &y2, &z2, &th))
00095 {
00096 printf("Grupo Pto_axis Vector Angulo\n");
00097 if (!lineins("? "))
00098 {
00099 return;
00100 }
00101 }
00102 MSD_highRotateGroup(gn, x1, y1, z1, x2, y2, z2, th);
00103 }
00104
00105 #endif
00106
00107 int MSD_highRotateGroup(Id gn, real x1, real y1, real z1, \
00108 real x2, real y2, real z2, real th)
00109 {
00110 GPTYPE gptr;
00111 vector center, vec;
00112
00113 if ((gptr = MSD_getGroup(gn)) == GNIL)
00114 {
00115 fprintf(stderr, MEN_NaoEncontrouGroupId, NAM_RotateGroup, gn);
00116 return(ERROR);
00117 }
00118 makevec(center, x1, y1, z1, 1.0);
00119 makevec(vec, x2, y2, z2, 1.0);
00120 normalize(vec);
00121 return(MSD_lowRotateGroup(gptr, center, vec, th));
00122 }
00123
00124 int MSD_lowRotateGroup(GPTYPE gptr, vector center, vector vec, real th)
00125 {
00126 SPTYPE optr;
00127 APTYPE aptr;
00128
00129 for (AllSolids(optr))
00130 {
00131 if (MSD_lowIsAncestorGroup(gptr, SolGroup(optr)))
00132 {
00133 MSD_lowRotateSolidAxis(optr, center, vec, th);
00134 }
00135 }
00136
00137 for (AllAxis(aptr))
00138 {
00139 if (MSD_lowIsAncestorGroup(gptr, MSD_getGroupAxis(aptr)))
00140 {
00141 MSD_lowRotateAxis(aptr, center, vec, th);
00142 }
00143 }
00144
00145 return(SUCCESS);
00146 }