16 double zcoord, zmin, zmax, minv, maxv;
17 int indx, inode, jnode, iside, zlevel;
18 int isc_color_scale_num_labels = COLOR_SCALE_NUM_LABELS;
25 minv =
min( s [ 0 ],
min(s [ 1 ], s [ 2 ]) );
26 maxv =
max( s [ 0 ],
max(s [ 1 ], s [ 2 ]) );
28 ft = EMGetAssocFringeTable( ESIModel() );
29 ColorFringesMinMax(ft, & minv, & maxv);
30 delta = ( maxv - minv ) / isc_color_scale_num_labels;
31 zcoord = minv + delta / 2;
33 for ( zlevel = 1; zlevel <= isc_color_scale_num_labels; zlevel++ ) {
35 if ( ( zcoord <= minv ) || ( zcoord >= maxv ) ) {
39 for ( iside = 1; iside <= 3; iside++ ) {
41 jnode = ( iside == 3 ? 1 : iside + 1 );
42 zmin =
min(s [ inode - 1 ], s [ jnode - 1 ]);
43 zmax =
max(s [ inode - 1 ], s [ jnode - 1 ]);
44 if ( ( zmax > zcoord ) && ( zmin < zcoord ) ) {
46 double ix, iy, iz, jx, jy, jz;
49 ix = coords [ inode - 1 ].x;
50 iy = coords [ inode - 1 ].y;
52 jx = coords [ jnode - 1 ].x;
53 jy = coords [ jnode - 1 ].y;
56 edgeLength = sqrt( ( ix - jx ) * ( ix - jx ) + ( iy - jy ) * ( iy - jy ) );
57 t = ( zcoord - s [ inode - 1 ] ) * edgeLength / ( s [ jnode - 1 ] - s [ inode - 1 ] );
60 p [ indx ].x = ( FPNum ) ix + t * ( jx - ix );
61 p [ indx ].y = ( FPNum ) iy + t * ( jy - iy );
65 color = ColorFringeRangeToColor( ColorFringeValueToRange(ft, zcoord) );
66 EASValsSetColor(color);
69 EGWithMaskChangeAttributes(LAYER_MASK | WIDTH_MASK | COLOR_MASK, tr);
70 EMAddGraphicsToModel(ESIModel(), tr);
88 double zcoord, zmin, zmax, minv, maxv;
89 int i, indx, inode, jnode, iside, zlevel;
90 int isc_color_scale_num_labels = COLOR_SCALE_NUM_LABELS;
97 minv = maxv = s [ 0 ];
98 for ( i = 1; i < 4; i++ ) {
99 minv =
min(minv, s [ i ]);
100 maxv =
max(maxv, s [ i ]);
103 ft = EMGetAssocFringeTable( ESIModel() );
104 ColorFringesMinMax(ft, & minv, & maxv);
105 delta = ( maxv - minv ) / isc_color_scale_num_labels;
106 zcoord = minv + delta / 2;
108 for ( zlevel = 1; zlevel <= isc_color_scale_num_labels; zlevel++ ) {
110 if ( ( zcoord <= minv ) || ( zcoord >= maxv ) ) {
114 for ( iside = 1; iside <= 4; iside++ ) {
116 jnode = ( iside == 4 ? 1 : iside + 1 );
117 zmin =
min(s [ inode - 1 ], s [ jnode - 1 ]);
118 zmax =
max(s [ inode - 1 ], s [ jnode - 1 ]);
119 if ( ( zmax > zcoord ) && ( zmin < zcoord ) ) {
121 double ix, iy, iz, jx, jy, jz;
122 double t, edgeLength;
124 ix = ( FPNum ) coords [ inode - 1 ].x;
125 iy = ( FPNum ) coords [ inode - 1 ].y;
127 jx = ( FPNum ) coords [ jnode - 1 ].x;
128 jy = ( FPNum ) coords [ jnode - 1 ].y;
132 edgeLength = sqrt( ( ix - jx ) * ( ix - jx ) + ( iy - jy ) * ( iy - jy ) );
133 t = ( zcoord - s [ inode - 1 ] ) * edgeLength / ( s [ jnode - 1 ] - s [ inode - 1 ] );
136 p [ indx ].x = ( FPNum ) ix + t * ( jx - ix );
137 p [ indx ].y = ( FPNum ) iy + t * ( jy - iy );
146 color = ColorFringeRangeToColor( ColorFringeValueToRange(ft, zcoord) );
147 EASValsSetColor(color);
150 tr = CreateLine3D(p);
151 EGWithMaskChangeAttributes(LAYER_MASK | WIDTH_MASK | COLOR_MASK, tr);
152 EMAddGraphicsToModel(ESIModel(), tr);
153 }
else if ( indx == 4 ) {
155 if ( s [ 0 ] > zcoord ) {
157 pp [ 0 ].x = p [ 0 ].x;
158 pp [ 0 ].y = p [ 0 ].y;
159 pp [ 0 ].z = p [ 0 ].z;
160 pp [ 1 ].x = p [ 3 ].x;
161 pp [ 1 ].y = p [ 3 ].y;
162 pp [ 1 ].z = p [ 3 ].z;
163 tr = CreateLine3D(pp);
164 EGWithMaskChangeAttributes(LAYER_MASK | WIDTH_MASK | COLOR_MASK, tr);
165 EMAddGraphicsToModel(ESIModel(), tr);
167 pp [ 0 ].x = p [ 1 ].x;
168 pp [ 0 ].y = p [ 1 ].y;
169 pp [ 0 ].z = p [ 1 ].z;
170 pp [ 1 ].x = p [ 2 ].x;
171 pp [ 1 ].y = p [ 2 ].y;
172 pp [ 1 ].z = p [ 2 ].z;
173 tr = CreateLine3D(pp);
174 EGWithMaskChangeAttributes(LAYER_MASK | WIDTH_MASK | COLOR_MASK, tr);
175 EMAddGraphicsToModel(ESIModel(), tr);
178 pp [ 0 ].x = p [ 0 ].x;
179 pp [ 0 ].y = p [ 0 ].y;
180 pp [ 0 ].z = p [ 0 ].z;
181 pp [ 1 ].x = p [ 1 ].x;
182 pp [ 1 ].y = p [ 1 ].y;
183 pp [ 1 ].z = p [ 1 ].z;
184 tr = CreateLine3D(pp);
185 EGWithMaskChangeAttributes(LAYER_MASK | WIDTH_MASK | COLOR_MASK, tr);
186 EMAddGraphicsToModel(ESIModel(), tr);
188 pp [ 0 ].x = p [ 3 ].x;
189 pp [ 0 ].y = p [ 3 ].y;
190 pp [ 0 ].z = p [ 3 ].z;
191 pp [ 1 ].x = p [ 2 ].x;
192 pp [ 1 ].y = p [ 2 ].y;
193 pp [ 1 ].z = p [ 2 ].z;
194 tr = CreateLine3D(pp);
195 EGWithMaskChangeAttributes(LAYER_MASK | WIDTH_MASK | COLOR_MASK, tr);
196 EMAddGraphicsToModel(ESIModel(), tr);
int max(int i, int j)
Returns bigger value form two given decimals.
void oofeg_drawIsoLinesOnQuad(WCRec coords[4], double s[4])
void oofeg_drawIsoLinesOnTriangle(WCRec coords[3], double s[3])
int min(int i, int j)
Returns smaller value from two given decimals.
the oofem namespace is to define a context or scope in which all oofem names are defined.