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 "memvirtu.h"
00044 #include "lowparam.h"
00045 #include "lowsolid.h"
00046 #include "lowmacro.h"
00047
00048 extern SPTYPE objary;
00049
00050 SPTYPE MSD_lowFindSolidByName(char *nam)
00051 {
00052 SPTYPE sptr;
00053
00054 for (AllSolids(sptr))
00055 {
00056 if (!strcmp(nam, SolName(sptr)))
00057 {
00058 return(sptr);
00059 }
00060 }
00061 return(SNIL);
00062 }
00063
00064 Id MSD_getSolidIdFromName(char *name)
00065 {
00066 SPTYPE s;
00067
00068 for (AllSolids(s))
00069 {
00070 if (!strcmp(name, SolName(s)))
00071 {
00072 return(SolSolidNo(s));
00073 }
00074 }
00075 return((Id) - 1);
00076 }
00077
00078 SPTYPE MSD_getSolid(Id sn)
00079 {
00080 SPTYPE s;
00081
00082 if (objary == SNIL)
00083 {
00084 return(SNIL);
00085 }
00086 for (s = objary; s != SNIL; s = SolNxt(s))
00087 {
00088 if (SolSolidNo(s) == sn)
00089 {
00090 return(s);
00091 }
00092 }
00093 return(SNIL);
00094 }
00095
00096 DPTYPE MSD_getShell(SPTYPE s, Id dn)
00097 {
00098 DPTYPE d;
00099
00100 for (AllShellsSolid(s, d))
00101 {
00102 if (SheShellNo(d) == dn)
00103 {
00104 return(d);
00105 }
00106 }
00107 return(DNIL);
00108 }
00109
00110 LPTYPE MSD_getLoop(FPTYPE f, Id vn, HPTYPE *h)
00111 {
00112 HPTYPE he;
00113 LPTYPE l;
00114
00115 for (AllLoopsFace(f, l))
00116 {
00117 he = LooLEdg(l);
00118 do
00119 {
00120 if (VerVertexNo(HalVtx(he)) == vn)
00121 {
00122 *h = he;
00123 return(l);
00124 }
00125 } while ((he = HalNxt(he)) != LooLEdg(l));
00126 }
00127 return(LNIL);
00128 }
00129
00130 LPTYPE MSD_getEdge(FPTYPE f, Id v1, Id v2, HPTYPE *ptr)
00131 {
00132 HPTYPE he;
00133 LPTYPE l;
00134
00135 for (AllLoopsFace(f, l))
00136 {
00137 he = LooLEdg(l);
00138 do
00139 {
00140 if ((VerVertexNo(HalVtx(he)) == v1) &&
00141 (VerVertexNo(HalVtx(HalNxt(he))) == v2))
00142 {
00143 *ptr = he;
00144 return(l);
00145 }
00146 } while ((he = HalNxt(he)) != LooLEdg(l));
00147 }
00148 return(LNIL);
00149 }
00150
00151 LPTYPE MSD_getHalfedge(FPTYPE f1, FPTYPE f2, Id v1, Id v2, HPTYPE *ptr)
00152 {
00153 HPTYPE he;
00154 LPTYPE l;
00155
00156 for (AllLoopsFace(f1, l))
00157 {
00158 he = LooLEdg(l);
00159 do
00160 {
00161 if ((VerVertexNo(HalVtx(he)) == v1) &&
00162 (VerVertexNo(HalVtx(HalNxt(he))) == v2))
00163 {
00164 *ptr = he;
00165 if (HalEdg(he) == ENIL)
00166 {
00167 return(l);
00168 }
00169 if (LooLFace(HalWLoop(mate(he))) == f2)
00170 {
00171 return(l);
00172 }
00173 }
00174 } while ((he = HalNxt(he)) != LooLEdg(l));
00175 }
00176 return(LNIL);
00177 }
00178
00179 FPTYPE MSD_getFace(SPTYPE s, Id fn)
00180 {
00181 DPTYPE d;
00182 FPTYPE f;
00183
00184 for (AllShellsSolid(s, d))
00185 {
00186 for (AllFacesShell(d, f))
00187 {
00188 if (FacFaceNo(f) == fn)
00189 {
00190 return(f);
00191 }
00192 }
00193 }
00194 return(FNIL);
00195 }
00196
00197 Id MSD_getMaxSolidId(void)
00198 {
00199 return(maxs++);
00200 }
00201
00202
00203
00204 Id MSD_getMaxFaceId(SPTYPE s)
00205 {
00206 return(maxf);
00207 }
00208
00209
00210
00211 Id MSD_getMaxShellId(SPTYPE s)
00212 {
00213 return(maxd);
00214 }
00215
00216
00217
00218 Id MSD_getMaxVertexId(SPTYPE s)
00219 {
00220 return(maxv);
00221 }