-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEpsilTet.c
226 lines (197 loc) · 8.63 KB
/
EpsilTet.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/* **************************************************************************
** All four discontinuity codes are different, so tetrahedron is divided up
** into four volumes by 4 complex break surfaces, which all meet at the
** Centroid.
**
**
** X - break plane intersections
**
** C........X.........D........X.........C
** . . X . . X .
** . . X . . X .
** . . X . . X .
** . . X X . . X X .
** X X X X X
** . X X . . X X . .
** . X . . X . .
** . X . . X . .
** . X .. X ..
** A.........X........B.........X........A
**
**
*************************************************************************** */
#include "xvt.h"
#include "noddy.h"
#include "allSurf.h"
extern long connect;
extern THREED_VIEW_OPTIONS threedViewOptions;
extern char clayer[81];/*global array for current layer name*/
/* External Functions */
#if XVT_CC_PROTO
extern double distanceToContact (double, double, double, OBJECT *);
extern void allDrawPlane(double [4][3]);
extern OBJECT *SetCLayer(unsigned char *, unsigned char *, int, int);
#else
extern double distanceToContact ();
extern void allDrawPlane();
extern OBJECT *SetCLayer();
#endif
#if XVT_CC_PROTO
double MidVal(double,double, double);
int EpsilonFindMids(double [8][3], double [6][3], double [3], TETINFO *);
int EpsilonBreakClean( double [8][3], double [6][3], double [3], int, TETINFO *);
#else
double MidVal();
int EpsilonFindMids();
int EpsilonBreakClean();
#endif
/* calculate strat surfaces if 2 sets of 2 corners of tet are part of same
** contiguous volume */
#if XVT_CC_PROTO
EpsilonCode(double Points[8][3],
int SeqCode[8], TETINFO *t)
#else
EpsilonCode(Points, SeqCode, t)
double Points[8][3];
int SeqCode[8];
TETINFO *t;
#endif
{
OBJECT *object,*Inevent,*Exevent;
int Inindex,Exindex;
unsigned int pflavor=0;
int mm, vert1, vert2;
double MidPoints[6][3];
double Centroid[3];
LAYER_PROPERTIES *inLayer,*exLayer;
int ExeventIndex,IneventIndex;
int numEvents = countObjects(NULL_WIN);
int break_code;
unsigned int InrockType,ExrockType;
int inRock, exRock;
int lDiff,eventCode,rock1,rock2;
STRATIGRAPHY_OPTIONS *InstratOptions,*ExstratOptions;
int sMax,sMin;
EpsilonFindMids(Points, MidPoints, Centroid, t);
for (mm = 0; mm < 6; mm++)
{
vert1 = SeqCode[LINES[TETLINES[t->tinc][mm]][0]];
vert2 = SeqCode[LINES[TETLINES[t->tinc][mm]][1]];
//if (object = SetCLayer((unsigned char *) &(t->cypher[vert1]),
// (unsigned char *) &(t->cypher[vert2]), vert1, vert2))
//{ /* draw break surfaces */
taste(numEvents, t->cypher[vert1], &InrockType, &IneventIndex);
taste(numEvents, t->cypher[vert2], &ExrockType, &ExeventIndex);
inLayer=whichLayer(IneventIndex, Points[LINES[TETLINES[t->tinc][mm]][0]][0], Points[LINES[TETLINES[t->tinc][mm]][0]][1], Points[LINES[TETLINES[t->tinc][mm]][0]][2]);
exLayer=whichLayer(ExeventIndex, Points[LINES[TETLINES[t->tinc][mm]][1]][0], Points[LINES[TETLINES[t->tinc][mm]][1]][1], Points[LINES[TETLINES[t->tinc][mm]][1]][2]);
break_code = lastdiff((unsigned char *) &(t->cypher[vert1]),
(unsigned char *) &(t->cypher[vert2]));
//sprintf(clayer,"BE_%03d_%c%c_%c%c",break_code,inLayer->unitName[0],inLayer->unitName[1],exLayer->unitName[0],exLayer->unitName[1]);
whichRock( Points[LINES[TETLINES[t->tinc][mm]][0]][0], Points[LINES[TETLINES[t->tinc][mm]][0]][1], Points[LINES[TETLINES[t->tinc][mm]][0]][2], &inRock, &IneventIndex);
whichRock( Points[LINES[TETLINES[t->tinc][mm]][1]][0], Points[LINES[TETLINES[t->tinc][mm]][1]][1], Points[LINES[TETLINES[t->tinc][mm]][1]][2], &exRock, &ExeventIndex);
whatDiff(Points[LINES[TETLINES[t->tinc][mm]][0]][0], Points[LINES[TETLINES[t->tinc][mm]][0]][1], Points[LINES[TETLINES[t->tinc][mm]][0]][2],
Points[LINES[TETLINES[t->tinc][mm]][1]][0], Points[LINES[TETLINES[t->tinc][mm]][1]][1], Points[LINES[TETLINES[t->tinc][mm]][1]][2],&lDiff,&eventCode,&rock1,&rock2);
taste(numEvents, (unsigned char *) &(t->cypher[vert1]), &pflavor, &Inindex);
taste(numEvents, (unsigned char *) &(t->cypher[vert2]), &pflavor, &Exindex);
sMax=getStratMax (Inindex);
if(Inindex-1>=0)
sMin=getStratMax (Inindex-1);
else
sMin=0;
if (Inevent = (OBJECT *) nthObject (NULL_WIN, Inindex))
if((Inevent->shape == STRATIGRAPHY) || (Inevent->shape == UNCONFORMITY))
inRock=sMin+sMax-inRock+1;
sMax=getStratMax (Exindex);
if(Exindex-1>=0)
sMin=getStratMax (Exindex-1);
else
sMin=0;
if (Exevent = (OBJECT *) nthObject (NULL_WIN, Exindex))
if((Exevent->shape == STRATIGRAPHY) || (Exevent->shape == UNCONFORMITY))
exRock=sMin+sMax-exRock+1;
if(inRock < exRock)
if(vert1 < vert2)
sprintf(clayer,"B_%03d_%03d_%03d_%03d_%03d_%03d",break_code,eventCode,vert1, vert2,inRock,exRock);
else
sprintf(clayer,"B_%03d_%03d_%03d_%03d_%03d_%03d",break_code,eventCode,vert2,vert1, inRock,exRock);
else
if(vert1 < vert2)
sprintf(clayer,"B_%03d_%03d_%03d_%03d_%03d_%03d",break_code,eventCode,vert1, vert2,exRock,inRock);
else
sprintf(clayer,"B_%03d_%03d_%03d_%03d_%03d_%03d",break_code,eventCode, vert2,vert1, exRock,inRock);
EpsilonBreakClean(Points, MidPoints, Centroid, mm, t);
// }
}
return (TRUE);
}
int
#if XVT_CC_PROTO
EpsilonFindMids(double Points[8][3], double MidPoints[6][3],
double Centroid[3], TETINFO *t)
#else
EpsilonFindMids(Points, MidPoints, Centroid, t)
double Points[8][3], MidPoints[6][3], Centroid[3];
TETINFO *t;
#endif
{
int mm;
for(mm=0;mm<6;mm++)
{
MidPoints[mm][0]=MidVal(Points[LINES[TETLINES[t->tinc][mm]][0]][0],Points[LINES[TETLINES[t->tinc][mm]][1]][0],0.5);
MidPoints[mm][1]=MidVal(Points[LINES[TETLINES[t->tinc][mm]][0]][1],Points[LINES[TETLINES[t->tinc][mm]][1]][1],0.5);
MidPoints[mm][2]=MidVal(Points[LINES[TETLINES[t->tinc][mm]][0]][2],Points[LINES[TETLINES[t->tinc][mm]][1]][2],0.5);
}
Centroid[0]=(Points[TETAPICES[t->tinc][0]][0]+
Points[TETAPICES[t->tinc][1]][0]+
Points[TETAPICES[t->tinc][2]][0]+
Points[TETAPICES[t->tinc][3]][0])/4.0;
Centroid[1]=(Points[TETAPICES[t->tinc][0]][1]+
Points[TETAPICES[t->tinc][1]][1]+
Points[TETAPICES[t->tinc][2]][1]+
Points[TETAPICES[t->tinc][3]][1])/4.0;
Centroid[2]=(Points[TETAPICES[t->tinc][0]][2]+
Points[TETAPICES[t->tinc][1]][2]+
Points[TETAPICES[t->tinc][2]][2]+
Points[TETAPICES[t->tinc][3]][2])/4.0;
return (TRUE);
}
int
#if XVT_CC_PROTO
EpsilonBreakClean( double Points[8][3], double MidPoints[6][3],
double Centroid[3], int mm, TETINFO *t)
#else
EpsilonBreakClean(Points, MidPoints, Centroid, mm, t)
double Points[8][3], MidPoints[6][3], Centroid[3];
int mm;
TETINFO *t;
#endif
{
double conlist[4][3];
int nn,icon;
conlist[0][0]=MidPoints[mm][0];
conlist[0][1]=MidPoints[mm][1];
conlist[0][2]=MidPoints[mm][2];
for(nn=0,icon=1;nn<4;nn++)
{
if(LINES[TETLINES[t->tinc][mm]][0] != TETAPICES[t->tinc][nn] &&
LINES[TETLINES[t->tinc][mm]][1] != TETAPICES[t->tinc][nn] )
{
conlist[icon][0]=(Points[TETAPICES[t->tinc][nn]][0]+
Points[LINES[TETLINES[t->tinc][mm]][0]][0]+
Points[LINES[TETLINES[t->tinc][mm]][1]][0])/3.0;
conlist[icon][1]=(Points[TETAPICES[t->tinc][nn]][1]+
Points[LINES[TETLINES[t->tinc][mm]][0]][1]+
Points[LINES[TETLINES[t->tinc][mm]][1]][1])/3.0;
conlist[icon][2]=(Points[TETAPICES[t->tinc][nn]][2]+
Points[LINES[TETLINES[t->tinc][mm]][0]][2]+
Points[LINES[TETLINES[t->tinc][mm]][1]][2])/3.0;
icon++;
}
}
allDrawPlane(conlist);
conlist[0][0]=Centroid[0];
conlist[0][1]=Centroid[1];
conlist[0][2]=Centroid[2];
allDrawPlane(conlist);
return (TRUE);
}