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 "memvirtu.h"
00043 #include "lowparam.h"
00044 #include "lowmacro.h"
00045 #include "lowsolid.h"
00046 #include "genfunc_.h"
00047 #include "hiegroup.h"
00048 #include "vectorop.h"
00049 #include "mancommd.h"
00050
00051 void MSD_execNameNCopySolid(void)
00052 {
00053 int ip, n;
00054 char name[30];
00055 float th, mv, x1, y1, z1, x2, y2, z2;
00056
00057 for (ip = 0; ip == 0;)
00058 {
00059 switch (optin())
00060 {
00061 case 'l':
00062 if (8 == sscanf(restbuf, "%s %f %f %f %f %f %f %d", name,
00063 &x1, &y1, &z1, &x2, &y2, &z2, &n))
00064 {
00065 MSD_highNameNCopySolidTranslate(name, x1, y1, z1, x2, y2, z2, n);
00066 ip = 1;
00067 }
00068 break;
00069
00070 case 's':
00071 if (10 == sscanf(restbuf, "%s %f %f %f %f %f %f %f %f %d",
00072 name, &x1, &y1, &z1, &x2, &y2, &z2, &th, &mv, &n))
00073 {
00074 MSD_highNameNCopySolidSpiral(name, x1, y1, z1, x2, y2, z2, th, mv, n);
00075 ip = 1;
00076 }
00077 break;
00078 }
00079 if (ip == 0)
00080 {
00081 printf("-l Objeto Pos_ini Pos_final N_vezes\n");
00082 printf("-s Objeto Pto_axis Direcao Ang Pos N_vezes\n");
00083 if (!lineins("? "))
00084 {
00085 return;
00086 }
00087 }
00088 }
00089 }
00090
00091 int MSD_highNameNCopySolidTranslate(char *name, real Xi, real Yi, real Zi, real Xd, \
00092 real Yd, real Zd, int n)
00093 {
00094 vector omove, dmove;
00095
00096 makevec(omove, Xi, Yi, Zi, 1.0);
00097 makevec(dmove, Xd, Yd, Zd, 1.0);
00098 return(MSD_lowNameNCopySolidTranslate(name, omove, dmove, n));
00099 }
00100
00101 int MSD_lowNameNCopySolidTranslate(char *name, vector omove, vector dmove, int n)
00102 {
00103 SPTYPE s;
00104 char defname[30];
00105 vector disp;
00106 int i;
00107
00108 veccopy(disp, omove);
00109 for (i = 0; i < n; ++i)
00110 {
00111 MSD_lowRequestNewName(defname);
00112 MSD_highNameCopySolid(name, defname);
00113 s = MSD_lowFindSolidByName(defname);
00114 MSD_lowTranslate(s, disp[0], disp[1], disp[2]);
00115 vecplus(disp, dmove, disp);
00116 }
00117 return(TRUE);
00118 }
00119
00120 int MSD_highNameNCopySolidSpiral(char *name, real Xi, real Yi, real Zi, real Xd,
00121 real Yd, real Zd, real dth, real dmv, int n)
00122 {
00123 vector omove, dmove;
00124
00125 makevec(omove, Xi, Yi, Zi, 1.0);
00126 makevec(dmove, Xd, Yd, Zd, 1.0);
00127 normalize(dmove);
00128 return(MSD_lowNameNCopySolidSpiral(name, omove, dmove, dth, dmv, n));
00129 }
00130
00131 int MSD_lowNameNCopySolidSpiral(char *name, vector cpos, vector vect, real dth, real dmv, int n)
00132 {
00133 SPTYPE s;
00134 char defname[30];
00135 vector disp;
00136 real th;
00137 int i;
00138
00139 veczer(disp);
00140 for (th = 0.0, i = 0; i < n; ++i, th += dth)
00141 {
00142 MSD_lowRequestNewName(defname);
00143 MSD_highNameCopySolid(name, defname);
00144 s = MSD_lowFindSolidByName(defname);
00145 MSD_lowRotateSolidAxis(s, cpos, vect, th);
00146 vecpe(vect, disp, disp, dmv);
00147 MSD_lowTranslate(s, disp[0], disp[1], disp[2]);
00148 }
00149 return(TRUE);
00150 }
00151
00152 void MSD_lowRequestNewName(char *name)
00153 {
00154 sprintf(name, "obj_%d", ++defonum);
00155 }