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 "eulerops.h"
00048 #include "genfunc_.h"
00049 #include "disdispl.h"
00050 #include "mancommd.h"
00051
00052 #ifdef __Extended_Version
00053 void MSD_execNameMerge(void)
00054 {
00055 char name1[30], name2[30];
00056
00057 while (2 != sscanf(restbuf, "%s %s", name1, name2))
00058 {
00059 printf("merge: nome1 nome2\n");
00060 if (!lineins("? "))
00061 {
00062 return;
00063 }
00064 }
00065 MSD_highNameMerge(name1, name2);
00066 }
00067
00068 #endif
00069
00070 int MSD_highNameMerge(char *name1, char *name2)
00071 {
00072 int sn1, sn2;
00073
00074 if ((sn1 = MSD_getSolidIdFromName(name1)) == -1)
00075 {
00076 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_MergeSolid, name1);
00077 return(ERROR);
00078 }
00079 if ((sn2 = MSD_getSolidIdFromName(name2)) == -1)
00080 {
00081 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_MergeSolid, name2);
00082 return(ERROR);
00083 }
00084 return(MSD_highMerge(sn1, sn2));
00085 }
00086
00087 #ifdef __Extended_Version
00088 void MSD_execMerge(void)
00089 {
00090 int sn1, sn2;
00091
00092 while (sscanf(restbuf, "%d %d", &sn1, &sn2) != 2)
00093 {
00094 printf("merge: sid1 sid2");
00095 if (!lineins("? "))
00096 {
00097 return;
00098 }
00099 }
00100 MSD_highMerge(sn1, sn2);
00101 }
00102
00103 #endif
00104
00105 int MSD_highMerge(Id sn1, Id sn2)
00106 {
00107 SPTYPE s1;
00108 SPTYPE s2;
00109
00110 if ((s1 = MSD_getSolid(sn1)) == SNIL)
00111 {
00112 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_MergeSolid, sn1);
00113 return(ERROR);
00114 }
00115 if ((s2 = MSD_getSolid(sn2)) == SNIL)
00116 {
00117 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_MergeSolid, sn2);
00118 return(ERROR);
00119 }
00120 MSD_lowMerge(s1, s2);
00121 return(SUCCESS);
00122 }
00123
00124 void MSD_lowMerge(SPTYPE s1, SPTYPE s2)
00125 {
00126 DPTYPE d2;
00127 int maxd, maxf, maxv;
00128
00129 maxd = MSD_getMaxShellId(s1);
00130 maxf = MSD_getMaxFaceId(s1);
00131 maxv = MSD_getMaxVertexId(s1);
00132 while ((d2 = SolSShells(s2)) != DNIL)
00133 {
00134 MSD_lowShellDetach(s2, s1, d2, maxd++, maxf, maxv);
00135 }
00136 }