예제 #1
0
void Collision_detector::update_all(Uint32 time,Uint32 time_step)
{
	//update_mpfa();
	update_mpfa_opt();
	//update_mafa(); useless at the moment
	update_mcfa();
	update_mffa();
	update_active(time,time_step);
}
예제 #2
0
void separate_obstacles (vector<Mesh*> &obs_meshes,
                         const vector<Mesh*> &meshes) {
    
    SO::xold.clear();
    SO::nold.clear();
    build_node_lookup(SO::xold, obs_meshes);
	build_face_normal_lookup(SO::nold, obs_meshes);

    vector<AccelStruct*> obs_accs = create_accel_structs(obs_meshes, false),
                         accs = create_accel_structs(meshes, false);
    vector<Ixn> ixns;
    int iter;
    for (iter = 0; iter < max_iter; iter++) {
        if (!ixns.empty())
            update_active(accs, ixns);
        vector<Ixn> new_ixns = find_intersections(accs, obs_accs);
        if (new_ixns.empty())
            break;
        append(ixns, new_ixns);
        solve_ixns(ixns);
        for (int m = 0; m < (int)obs_meshes.size(); m++) {
            compute_ws_data(*obs_meshes[m]);
            update_accel_struct(*obs_accs[m]);
        }
    }
    if (iter == max_iter) {
        cerr << "Initial separation failed to converge!" << endl;
        exit(1);
    }
    for (int m = 0; m < (int)obs_meshes.size(); m++) {
        compute_ws_data(*obs_meshes[m]);
        update_x0(*obs_meshes[m]);
    }
    destroy_accel_structs(accs);
    destroy_accel_structs(obs_accs);
}