172 | | void triangulate(bool should_integrate) |
173 | | { |
174 | | for(list<polyhedron*>::iterator child_ref = children.begin();child_ref!=children.end();child_ref++) |
175 | | { |
176 | | set<double> simplex_integrals; |
177 | | |
178 | | for(list<set<vertex*>>::iterator t_ref = (*child_ref)->triangulation.begin();t_ref!=(*child_ref)->triangulation.end();t_ref++) |
179 | | { |
180 | | set<vertex*> new_simplex; |
181 | | new_simplex.insert((*t_ref).begin(),(*t_ref).end()); |
182 | | |
183 | | pair<set<vertex*>::iterator,bool> ret_val = new_simplex.insert(*vertices.begin()); |
184 | | |
185 | | if(ret_val.second == true) |
186 | | { |
187 | | triangulation.push_back(new_simplex); |
188 | | |
189 | | if(should_integrate) |
190 | | { |
191 | | toprow* as_toprow = (toprow*)this; |
192 | | |
193 | | vertex* base_vertex = (*new_simplex.begin()); |
194 | | |
195 | | double a_0 = base_vertex->get_coordinates()*as_toprow->condition(1,as_toprow->condition.size()-1)+as_toprow->condition[0]; |
196 | | list<double> as; |
197 | | |
198 | | for(set<vertex*>::iterator vert_ref = (++new_simplex.begin()); vert_ref!=new_simplex.end();vert_ref++) |
199 | | { |
200 | | vec relative_coords = (*vert_ref)->get_coordinates()-base_vertex->get_coordinates(); |
201 | | |
202 | | double new_a = relative_coords*as_toprow->condition(1,as_toprow->condition.size()-1); |
203 | | |
204 | | as.push_back(new_a); |
205 | | } |
206 | | |
207 | | for(list<double>::iterator as_ref = as.begin();as_ref!=as.end();as_ref++) |
208 | | { |
209 | | //TODO DODELAT VYPOCET! |
210 | | } |
211 | | } |
212 | | } |
213 | | } |
214 | | |
215 | | if(should_integrate) |
216 | | { |
217 | | ((toprow*)this)->probability = 0.0; |
218 | | |
219 | | for(set<double>::iterator integ_ref = simplex_integrals.begin();integ_ref!=simplex_integrals.end();integ_ref++) |
220 | | { |
221 | | ((toprow*)this)->probability += (*integ_ref); |
222 | | } |
223 | | } |
224 | | } |
225 | | } |
| 173 | void triangulate(bool should_integrate); |
| 174 | |