24 #include <grass/gis.h>
25 #include <grass/gstypes.h>
93 fprintf(stderr,
"Invalid face code %d\n", face);
97 return face * A * (A * C - B *
D) >= 0;
110 float t, At = 0, Bt = 0, Ct = 0, Dt = 0, a,
b;
117 a = (v[4] - v[0]) * (v[6] - v[2]) - (v[7] - v[3]) * (v[5] - v[1]);
118 b = v[2] * (v[4] - v[0]) + v[0] * (v[6] - v[2])
119 - v[1] * (v[7] - v[3]) - v[3] * (v[5] - v[1]);
125 At = v[0] + (v[4] - v[0]) * t;
126 Bt = v[3] + (v[7] - v[3]) * t;
127 Ct = v[2] + (v[6] - v[2]) * t;
128 Dt = v[1] + (v[5] - v[1]) * t;
154 t = v[0] / (v[0] - v[1]);
156 Bt = v[3] + (v[2] - v[3]) * t;
157 Ct = v[7] + (v[6] - v[7]) * t;
158 Dt = v[4] + (v[5] - v[4]) * t;
161 t = v[1] / (v[1] - v[2]);
163 Bt = v[0] + (v[3] - v[0]) * t;
164 Ct = v[4] + (v[7] - v[4]) * t;
165 Dt = v[5] + (v[6] - v[5]) * t;
168 t = v[2] / (v[2] - v[3]);
170 Bt = v[1] + (v[0] - v[1]) * t;
171 Ct = v[5] + (v[4] - v[5]) * t;
172 Dt = v[6] + (v[7] - v[6]) * t;
175 t = v[3] / (v[3] - v[0]);
177 Bt = v[2] + (v[1] - v[2]) * t;
178 Ct = v[6] + (v[5] - v[6]) * t;
179 Dt = v[7] + (v[4] - v[7]) * t;
182 t = v[4] / (v[4] - v[5]);
184 Bt = v[7] + (v[6] - v[7]) * t;
185 Ct = v[3] + (v[2] - v[3]) * t;
186 Dt = v[0] + (v[1] - v[0]) * t;
189 t = v[5] / (v[5] - v[6]);
191 Bt = v[4] + (v[7] - v[4]) * t;
192 Ct = v[0] + (v[3] - v[0]) * t;
193 Dt = v[1] + (v[2] - v[1]) * t;
196 t = v[6] / (v[6] - v[7]);
198 Bt = v[5] + (v[4] - v[5]) * t;
199 Ct = v[1] + (v[0] - v[1]) * t;
200 Dt = v[2] + (v[3] - v[2]) * t;
203 t = v[7] / (v[7] - v[4]);
205 Bt = v[6] + (v[5] - v[6]) * t;
206 Ct = v[2] + (v[1] - v[2]) * t;
207 Dt = v[3] + (v[0] - v[3]) * t;
210 t = v[0] / (v[0] - v[4]);
212 Bt = v[3] + (v[7] - v[3]) * t;
213 Ct = v[2] + (v[6] - v[2]) * t;
214 Dt = v[1] + (v[5] - v[1]) * t;
217 t = v[1] / (v[1] - v[5]);
219 Bt = v[0] + (v[4] - v[0]) * t;
220 Ct = v[3] + (v[7] - v[3]) * t;
221 Dt = v[2] + (v[6] - v[2]) * t;
224 t = v[2] / (v[2] - v[6]);
226 Bt = v[1] + (v[5] - v[1]) * t;
227 Ct = v[0] + (v[4] - v[0]) * t;
228 Dt = v[3] + (v[7] - v[3]) * t;
231 t = v[3] / (v[3] - v[7]);
233 Bt = v[2] + (v[6] - v[2]) * t;
234 Ct = v[1] + (v[5] - v[1]) * t;
235 Dt = v[0] + (v[4] - v[0]) * t;
238 fprintf(stderr,
"Invalid edge %d\n", edge);
244 fprintf(stderr,
"Invalid ambiguous case %d\n",
m_case);
269 if (At * Ct < Bt * Dt)
281 if (At * Ct >= Bt * Dt)
441 switch (subconfig13[m_subconfig]) {
559 fprintf(stderr,
"Marching Cubes: Impossible case 13?\n");
#define OFFSET_T12_1_1_S1
#define OFFSET_T10_1_1_S2
#define OFFSET_T12_1_1_S2
int mc33_test_interior(char s, float *v)
ADD.
int mc33_process_cube(int c_ndx, float *v)
ADD.
int mc33_test_face(char face, float *v)
ADD.
#define OFFSET_T10_1_1_S1
unsigned char m_subconfig
CELL_ENTRY cell_table[256]