edge_set transform_figure(edge_set es, float A[4][4]) { size_t s = es.size(); edge_set to_return(s); for (int i = 0 ; i < s ; i++) { to_return[i] = EDGE(transform(es.at(i).first, A), transform(es.at(i).second, A)); } return to_return; }
//generate the evidence for satisfiable formulas string sat_solver::set_to_string(edge_set atoms) { string res = ""; edge_set::iterator it; for(it = atoms.begin(); it != atoms.end(); it ++) { res += (*it)->to_string(); } return res; }
edge_set translate_figure(edge_set es, float dx, float dy, float dz) { float A[4][4]; generate_translation_matrix(A, dx, dy, dz); size_t s = es.size(); edge_set to_return(s); for (int i = 0 ; i < s ; i++) { to_return[i] = EDGE(transform(es.at(i).first, A), transform(es.at(i).second, A)); } return to_return; }
edge_set rotate_figure(edge_set es, int axis, float angle) { float A[4][4]; generate_rotation_matrix(A, axis, angle); size_t s = es.size(); edge_set to_return(s); for (int i = 0 ; i < s ; i++) { to_return[i] = EDGE(transform(es.at(i).first, A), transform(es.at(i).second, A)); } return to_return; }
void InitializeGraph() { sp_group = new task_group; vertices.resize(N); edges.resize(N); predecessor.resize(N); g_distance.resize(N); f_distance.resize(N); locks.resize(N); task_scheduler_init init(get_default_num_threads()); if (verbose) printf("Generating vertices...\n"); #if __TBB_LAMBDAS_PRESENT parallel_for(blocked_range<size_t>(0,N,64), [&](blocked_range<size_t>& r) { utility::FastRandom my_random(r.begin()); for (size_t i=r.begin(); i!=r.end(); ++i) { vertices[i] = generate_random_point(my_random); } }, simple_partitioner()); #else parallel_for(blocked_range<size_t>(0,N,64), gen_vertices(), simple_partitioner()); #endif if (verbose) printf("Generating edges...\n"); #if __TBB_LAMBDAS_PRESENT parallel_for(blocked_range<size_t>(0,N,64), [&](blocked_range<size_t>& r) { utility::FastRandom my_random(r.begin()); for (size_t i=r.begin(); i!=r.end(); ++i) { for (size_t j=0; j<i; ++j) { if (die_toss(i, j, my_random)) edges[i].push_back(j); } } }, simple_partitioner()); #else parallel_for(blocked_range<size_t>(0,N,64), gen_edges(), simple_partitioner()); #endif for (size_t i=0; i<N; ++i) { for (size_t j=0; j<edges[i].size(); ++j) { vertex_id k = edges[i][j]; edges[k].push_back(i); } } if (verbose) printf("Done.\n"); }
static bool is_edge_annotated (const edge e, const edge_set &annotated) { return annotated.find (e) != annotated.end (); }