• API
• FAQ
• Tools
• Trends
• Archive
daily pastebin goal
62%
SHARE
TWEET

# Untitled

a guest Aug 12th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. private Cell3D[] SplitCell(Cell3D cell)
2.         {
3.             //spodni stena
4.             Point3D mid01 = new Point3D((cell.points[0].x + cell.points[1].x)*0.5,(cell.points[0].y + cell.points[1].y)*0.5,(cell.points[0].z + cell.points[1].z)*0.5);
5.             double val01 = (cell.values[0] + cell.values[1]) * 0.5;
6.             int ind01 = (cell.indexy[0] + cell.indexy[1]) >> 1;
7.
8.             Point3D mid12 = new Point3D((cell.points[1].x + cell.points[2].x)*0.5,(cell.points[1].y + cell.points[2].y)*0.5,(cell.points[1].z + cell.points[2].z)*0.5);
9.             double val12 = (cell.values[1] + cell.values[2]) * 0.5;
10.             int ind12 = (cell.indexy[1] + cell.indexy[2]) >> 1;
11.
12.             Point3D mid23 = new Point3D((cell.points[2].x + cell.points[3].x)*0.5,(cell.points[2].y + cell.points[3].y)*0.5,(cell.points[2].z + cell.points[3].z)*0.5);
13.             double val23 = (cell.values[2] + cell.values[3]) * 0.5;
14.             int ind23 = (cell.indexy[2] + cell.indexy[3]) >> 1;
15.
16.             Point3D mid30 = new Point3D((cell.points[3].x + cell.points[0].x)*0.5,(cell.points[3].y + cell.points[0].y)*0.5,(cell.points[3].z + cell.points[0].z)*0.5);
17.             double val30 = (cell.values[3] + cell.values[0]) * 0.5;
18.             int ind30 = (cell.indexy[3] + cell.indexy[0]) >> 1;
19.
20.             //horni stena
21.             Point3D mid45 = new Point3D((cell.points[4].x + cell.points[5].x)*0.5,(cell.points[4].y + cell.points[5].y)*0.5,(cell.points[4].z + cell.points[5].z)*0.5);
22.             double val45 = (cell.values[4] + cell.values[5]) * 0.5;
23.             int ind45 = (cell.indexy[4] + cell.indexy[5]) >> 1;
24.
25.             Point3D mid56 = new Point3D((cell.points[5].x + cell.points[6].x)*0.5,(cell.points[5].y + cell.points[6].y)*0.5,(cell.points[5].z + cell.points[6].z)*0.5);
26.             double val56 = (cell.values[5] + cell.values[6]) * 0.5;
27.             int ind56 = (cell.indexy[5] + cell.indexy[6]) >> 1;
28.
29.             Point3D mid67 = new Point3D((cell.points[6].x + cell.points[7].x)*0.5,(cell.points[6].y + cell.points[7].y)*0.5,(cell.points[6].z + cell.points[7].z)*0.5);
30.             double val67 = (cell.values[6] + cell.values[7]) * 0.5;
31.             int ind67 = (cell.indexy[6] + cell.indexy[7]) >> 1;
32.
33.             Point3D mid74 = new Point3D((cell.points[7].x + cell.points[4].x)*0.5,(cell.points[7].y + cell.points[4].y)*0.5,(cell.points[7].z + cell.points[4].z)*0.5);
34.             double val74 = (cell.values[7] + cell.values[4]) * 0.5;
35.             int ind74 = (cell.indexy[7] + cell.indexy[4]) >> 1;
36.
37.             //svisle
38.             Point3D mid04 = new Point3D((cell.points[0].x + cell.points[4].x)*0.5,(cell.points[0].y + cell.points[4].y)*0.5,(cell.points[0].z + cell.points[4].z)*0.5);
39.             double val04 = (cell.values[0] + cell.values[4]) * 0.5;
40.             int ind04 = (cell.indexy[0] + cell.indexy[4]) >> 1;
41.
42.             Point3D mid15 = new Point3D((cell.points[1].x + cell.points[5].x)*0.5,(cell.points[1].y + cell.points[5].y)*0.5,(cell.points[1].z + cell.points[5].z)*0.5);
43.             double val15 = (cell.values[1] + cell.values[5]) * 0.5;
44.             int ind15 = (cell.indexy[1] + cell.indexy[5]) >> 1;
45.
46.             Point3D mid26 = new Point3D((cell.points[2].x + cell.points[6].x)*0.5,(cell.points[2].y + cell.points[6].y)*0.5,(cell.points[2].z + cell.points[6].z)*0.5);
47.             double val26 = (cell.values[2] + cell.values[6]) * 0.5;
48.             int ind26 = (cell.indexy[2] + cell.indexy[6]) >> 1;
49.
50.             Point3D mid37 = new Point3D((cell.points[3].x + cell.points[7].x)*0.5,(cell.points[3].y + cell.points[7].y)*0.5,(cell.points[3].z + cell.points[7].z)*0.5);
51.             double val37 = (cell.values[3] + cell.values[7]) * 0.5;
52.             int ind37 = (cell.indexy[3] + cell.indexy[7]) >> 1;
53.
54.             //stredy sten
55.             Point3D mid0347 = new Point3D((mid30.x + mid74.x)*0.5,(mid30.y + mid74.y)*0.5,(mid30.z + mid74.z)*0.5);
56.             double val0347 = (val30 + val74) * 0.5;
57.             int ind0347 = (ind30 + ind74) >> 1;
58.
59.             Point3D mid2367 = new Point3D((mid23.x + mid67.x)*0.5,(mid23.y + mid67.y)*0.5,(mid23.z + mid67.z)*0.5);
60.             double val2367 = (val23 + val67) * 0.5;
61.             int ind2367 = (ind23 + ind67) >> 1;
62.
63.             Point3D mid0123 = new Point3D((mid01.x + mid23.x)*0.5,(mid01.y + mid23.y)*0.5,(mid01.z + mid23.z)*0.5);
64.             double val0123 = (val01 + val23) * 0.5;
65.             int ind0123 = (ind01 + ind23) >> 1;
66.
67.             Point3D mid1256 = new Point3D((mid12.x + mid56.x)*0.5,(mid12.y + mid56.y)*0.5,(mid12.z + mid56.z)*0.5);
68.             double val1256 = (val12 + val56) * 0.5;
69.             int ind1256 = (ind12 + ind56) >> 1;
70.
71.             Point3D mid0145 = new Point3D((mid01.x + mid45.x)*0.5,(mid01.y + mid45.y)*0.5,(mid01.z + mid45.z)*0.5);
72.             double val0145 = (val01 + val45) * 0.5;
73.             int ind0145 = (ind01 + ind45) >> 1;
74.
75.             Point3D mid4567 = new Point3D((mid45.x + mid67.x)*0.5,(mid45.y + mid67.y)*0.5,(mid45.z + mid67.z)*0.5);
76.             double val4567 = (val45 + val67) * 0.5;
77.             int ind4567 = (ind45 + ind67) >> 1;
78.
79.             //prostredek
80.             Point3D mid01234567 = new Point3D((mid0347.x + mid1256.x)*0.5,(mid0347.y + mid1256.y)*0.5,(mid0347.z + mid1256.z)*0.5);
81.             double val01234567 = (val0347 + val1256) * 0.5;
82.             int ind01234567 = (ind0347 + ind1256) >> 1;
83.
84.             Cell3D A0 = new Cell3D();
85.             A0.points[0] = cell.points[0];
86.             A0.values[0] = cell.values[0];
87.             A0.indexy[0] = cell.indexy[0];
88.
89.             A0.points[1] = mid01;
90.             A0.values[1] = val01;
91.             A0.indexy[1] = ind01;
92.
93.             A0.points[2] = mid0123;
94.             A0.values[2] = val0123;
95.             A0.indexy[2] = ind0123;
96.
97.             A0.points[3] = mid30;
98.             A0.values[3]= val30;
99.             A0.indexy[3] = ind30;
100.
101.             A0.points[4] = mid04;
102.             A0.values[4] = val04;
103.             A0.indexy[4] = ind04;
104.
105.             A0.points[5] = mid0145;
106.             A0.values[5] = val0145;
107.             A0.indexy[5] = ind0145;
108.
109.             A0.points[6] = mid01234567;
110.             A0.values[6] = val01234567;
111.             A0.indexy[6] = ind01234567;
112.
113.             A0.points[7] = mid0347;
114.             A0.values[7] = val0347;
115.             A0.indexy[7] = ind0347;
116.
117.             Cell3D A1 = new Cell3D();
118.             A1.points[0] = mid01;
119.             A1.values[0] = val01;
120.             A1.indexy[0] = ind01;
121.
122.             A1.points[1] = cell.points[1];
123.             A1.values[1] = cell.values[1];
124.             A1.indexy[1] = cell.indexy[1];
125.
126.             A1.points[2] = mid12;
127.             A1.values[2] = val12;
128.             A1.indexy[2] = ind12;
129.
130.             A1.points[3] = mid0123;
131.             A1.values[3] = val0123;
132.             A1.indexy[3] = ind0123;
133.
134.             A1.points[4] = mid0145;
135.             A1.values[4] = val0145;
136.             A1.indexy[4] = ind0145;
137.
138.             A1.points[5] = mid15;
139.             A1.values[5] = val15;
140.             A1.indexy[5] = ind15;
141.
142.             A1.points[6] = mid1256;
143.             A1.values[6] = val1256;
144.             A1.indexy[6] = ind1256;
145.
146.             A1.points[7] = mid01234567;
147.             A1.values[7] = val01234567;
148.             A1.indexy[7] = ind01234567;
149.
150.             Cell3D A2 = new Cell3D();
151.             A2.points[0] = mid0123;
152.             A2.values[0] = val0123;
153.             A2.indexy[0] = ind0123;
154.
155.             A2.points[1] = mid12;
156.             A2.values[1] = val12;
157.             A2.indexy[1] = ind12;
158.
159.             A2.points[2] = cell.points[2];
160.             A2.values[2] = cell.values[2];
161.             A2.indexy[2] = cell.indexy[2];
162.
163.             A2.points[3] = mid23;
164.             A2.values[3] = val23;
165.             A2.indexy[3] = ind23;
166.
167.             A2.points[4] = mid01234567;
168.             A2.values[4] = val01234567;
169.             A2.indexy[4] = ind01234567;
170.
171.             A2.points[5] = mid1256;
172.             A2.values[5] = val1256;
173.             A2.indexy[5] = ind1256;
174.
175.             A2.points[6] = mid26;
176.             A2.values[6] = val26;
177.             A2.indexy[6] = ind26;
178.
179.             A2.points[7] = mid2367;
180.             A2.values[7] = val2367;
181.             A2.indexy[7] = ind2367;
182.
183.             Cell3D A3 = new Cell3D();
184.             A3.points[0] = mid30;
185.             A3.values[0] = val30;
186.             A3.indexy[0] = ind30;
187.
188.             A3.points[1] = mid0123;
189.             A3.values[1] = val0123;
190.             A3.indexy[1] = ind0123;
191.
192.             A3.points[2] = mid23;
193.             A3.values[2] = val23;
194.             A3.indexy[2] = ind23;
195.
196.             A3.points[3] = cell.points[3];
197.             A3.values[3] = cell.values[3];
198.             A3.indexy[3] = cell.indexy[3];
199.
200.             A3.points[4] = mid0347;
201.             A3.values[4] = val0347;
202.             A3.indexy[4] = ind0347;
203.
204.             A3.points[5] = mid01234567;
205.             A3.values[5] = val01234567;
206.             A3.indexy[5] = ind01234567;
207.
208.             A3.points[6] = mid2367;
209.             A3.values[6] = val2367;
210.             A3.indexy[6] = ind2367;
211.
212.             A3.points[7] = mid37;
213.             A3.values[7] = val37;
214.             A3.indexy[7] = ind37;
215.
216.             Cell3D A4 = new Cell3D();
217.             A4.points[0] = mid04;
218.             A4.values[0] = val04;
219.             A4.indexy[0] = ind04;
220.
221.             A4.points[1] = mid0145;
222.             A4.values[1] = val0145;
223.             A4.indexy[1] = ind0145;
224.
225.             A4.points[2] = mid01234567;
226.             A4.values[2] = val01234567;
227.             A4.indexy[2] = ind01234567;
228.
229.             A4.points[3] = mid0347;
230.             A4.values[3] = val0347;
231.             A4.indexy[3] = ind0347;
232.
233.             A4.points[4] = cell.points[4];
234.             A4.values[4] = cell.values[4];
235.             A4.indexy[4] = cell.indexy[4];
236.
237.             A4.points[5] = mid45;
238.             A4.values[5] = val45;
239.             A4.indexy[5] = ind45;
240.
241.             A4.points[6] = mid4567;
242.             A4.values[6] = val4567;
243.             A4.indexy[6] = ind4567;
244.
245.             A4.points[7] = mid74;
246.             A4.values[7] = val74;
247.             A4.indexy[7] = ind74;
248.
249.             Cell3D A5 = new Cell3D();
250.             A5.points[0] = mid0145;
251.             A5.values[0] = val0145;
252.             A5.indexy[0] = ind0145;
253.
254.             A5.points[1] = mid15;
255.             A5.values[1] = val15;
256.             A5.indexy[1] = ind15;
257.
258.             A5.points[2] = mid1256;
259.             A5.values[2] = val1256;
260.             A5.indexy[2] = ind1256;
261.
262.             A5.points[3] = mid01234567;
263.             A5.values[3] = val01234567;
264.             A5.indexy[3] = ind01234567;
265.
266.             A5.points[4] = mid45;
267.             A5.values[4] = val45;
268.             A5.indexy[4] = ind45;
269.
270.             A5.points[5] = cell.points[5];
271.             A5.values[5] = cell.values[5];
272.             A5.indexy[5] = cell.indexy[5];
273.
274.             A5.points[6] = mid56;
275.             A5.values[6] = val56;
276.             A5.indexy[6] = ind56;
277.
278.             A5.points[7] = mid4567;
279.             A5.values[7] = val4567;
280.             A5.indexy[7] = ind4567;
281.
282.             Cell3D A6 = new Cell3D();
283.             A6.points[0] = mid01234567;
284.             A6.values[0] = val01234567;
285.             A6.indexy[0] = ind01234567;
286.
287.             A6.points[1] = mid1256;
288.             A6.values[1] = val1256;
289.             A6.indexy[1] = ind1256;
290.
291.             A6.points[2] = mid26;
292.             A6.values[2] = val26;
293.             A6.indexy[2] = ind26;
294.
295.             A6.points[3] = mid2367;
296.             A6.values[3] = val2367;
297.             A6.indexy[3] = ind2367;
298.
299.             A6.points[4] = mid4567;
300.             A6.values[4] = val4567;
301.             A6.indexy[4] = ind4567;
302.
303.             A6.points[5] = mid56;
304.             A6.values[5] = val56;
305.             A6.indexy[5] = ind56;
306.
307.             A6.points[6] = cell.points[6];
308.             A6.values[6] = cell.values[6];
309.             A6.indexy[6] = cell.indexy[6];
310.
311.             A6.points[7] = mid67;
312.             A6.values[7] = val67;
313.             A6.indexy[7] = ind67;
314.
315.             Cell3D A7 = new Cell3D();
316.             A7.points[0] = mid0347;
317.             A7.values[0] = val0347;
318.             A7.indexy[0] = ind0347;
319.
320.             A7.points[1] = mid01234567;
321.             A7.values[1] = val01234567;
322.             A7.indexy[1] = ind01234567;
323.
324.             A7.points[2] = mid2367;
325.             A7.values[2] = val2367;
326.             A7.indexy[2] = ind2367;
327.
328.             A7.points[3] = mid37;
329.             A7.values[3] = val37;
330.             A7.indexy[3] = ind37;
331.
332.             A7.points[4] = mid74;
333.             A7.values[4] = val74;
334.             A7.indexy[4] = ind74;
335.
336.             A7.points[5] = mid4567;
337.             A7.values[5] = val4567;
338.             A7.indexy[5] = ind4567;
339.
340.             A7.points[6] = mid67;
341.             A7.values[6] = val67;
342.             A7.indexy[6] = ind67;
343.
344.             A7.points[7] = cell.points[7];
345.             A7.values[7] = cell.values[7];
346.             A7.indexy[7] = cell.indexy[7];
347.
348.             Cell3D[] cellArray = new Cell3D[8] {A0,A1,A2,A3,A4,A5,A6,A7};
349.             return cellArray;
350.         }
RAW Paste Data
Top