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 "lowmacro.h"
00047 #include "lowsolid.h"
00048 #include "eulerops.h"
00049 #include "mancommd.h"
00050 #include "shpshape.h"
00051 #include "disdispl.h"
00052 #include "genfunc_.h"
00053 #include "sethmain.h"
00054
00055 void MSD_execNameIntersection(void)
00056 {
00057 char name1[15], name2[15], name3[15];
00058
00059 while (3 != sscanf(restbuf, "%s %s %s", name1, name2, name3))
00060 {
00061 printf("Nome1 Nome2 NomeR\n");
00062 if (!lineins("? "))
00063 {
00064 return;
00065 }
00066 }
00067 MSD_highNameIntersection(name1, name2, name3);
00068 }
00069
00070 void MSD_highNameIntersection(char *name1, char *name2, char *name)
00071 {
00072 Id sn1, sn2, sn;
00073
00074 if (MSD_getSolidIdFromName(name) != -1)
00075 {
00076 fprintf(stderr, MEN_SolidoJaExiste, NAM_SetIntersection, name);
00077 return;
00078 }
00079 if ((sn1 = MSD_getSolidIdFromName(name1)) == -1)
00080 {
00081 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_SetIntersection, name1);
00082 return;
00083 }
00084 if ((sn2 = MSD_getSolidIdFromName(name2)) == -1)
00085 {
00086 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_SetIntersection, name2);
00087 return;
00088 }
00089 if ((sn = MSD_highIntersection(sn1, sn2)) != -1)
00090 {
00091 MSD_highName(sn, name, SOLID);
00092 }
00093 }
00094
00095 #ifdef __Extended_Version
00096 void MSD_execIntersection(void)
00097 {
00098 int sn1, sn2, sn;
00099
00100 while (3 != sscanf(restbuf, "%d %d %d", &sn1, &sn2, &sn))
00101 {
00102 printf("intersection: Sid1 Sid2\n");
00103 if (!lineins("? "))
00104 {
00105 return;
00106 }
00107 }
00108 maxs = sn;
00109 printf("Id = %d\n", MSD_highIntersection(sn1, sn2));
00110 }
00111
00112 #endif
00113
00114 Id MSD_highIntersection(Id sn1, Id sn2)
00115 {
00116 SPTYPE optr1;
00117 SPTYPE optr2;
00118 SPTYPE optr3;
00119 Id sn;
00120
00121 if ((optr1 = MSD_getSolid(sn1)) == SNIL)
00122 {
00123 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_SetIntersection, sn1);
00124 return(-1);
00125 }
00126 if ((optr2 = MSD_getSolid(sn2)) == SNIL)
00127 {
00128 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_SetIntersection, sn2);
00129 return(-1);
00130 }
00131 sn = MSD_getMaxSolidId();
00132 if (MSD_lowSetOp(optr1, optr2, sn, &optr3, USP_INTERSECT) == SUCCESS)
00133 {
00134 if (optr3 != SNIL)
00135 {
00136 MSD_lowCleanSolid(optr3);
00137 MSD_lowDisplayMonitor('o', optr3, GNIL);
00138 MSD_lowModifyIds(optr3, sn1);
00139 }
00140 return(sn1);
00141 }
00142 return(-1);
00143 }