Revision: 47316 http://brlcad.svn.sourceforge.net/brlcad/?rev=47316&view=rev Author: abhi2011 Date: 2011-10-21 17:11:26 +0000 (Fri, 21 Oct 2011) Log Message: ----------- Indentations corrected in simulate files
Modified Paths: -------------- brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp brlcad/trunk/src/libged/simulate/simphysics.cpp brlcad/trunk/src/libged/simulate/simrt.c brlcad/trunk/src/libged/simulate/simrt.h brlcad/trunk/src/libged/simulate/simulate.c brlcad/trunk/src/libged/simulate/simulate.h brlcad/trunk/src/libged/simulate/simutils.c brlcad/trunk/src/libged/simulate/simutils.h Modified: brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp =================================================================== --- brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp 2011-10-21 16:58:44 UTC (rev 47315) +++ brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp 2011-10-21 17:11:26 UTC (rev 47316) @@ -40,7 +40,6 @@ //#define USE_PERSISTENT_CONTACTS 1 - btRTCollisionAlgorithm::btRTCollisionAlgorithm(btPersistentManifold* mf, const btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* obj0, @@ -78,7 +77,6 @@ //btCollisionObject* col1 = body1; - //quellage bu_log("%d", dispatchInfo.m_stepCount); @@ -100,11 +98,6 @@ //------------------- DEBUG --------------------------- - - - - - //------------------------------------------------------ #ifdef USE_PERSISTENT_CONTACTS Modified: brlcad/trunk/src/libged/simulate/simphysics.cpp =================================================================== --- brlcad/trunk/src/libged/simulate/simphysics.cpp 2011-10-21 16:58:44 UTC (rev 47315) +++ brlcad/trunk/src/libged/simulate/simphysics.cpp 2011-10-21 17:11:26 UTC (rev 47316) @@ -38,7 +38,9 @@ #include "simrt.h" - +/* This is kept global because it has to accessed by callbacks, though there may be + * a way to overcome this by inserting the pointer in the user world-info ptr of Bullet + */ struct simulation_params *sim_params; /** @@ -86,16 +88,16 @@ { bu_log("The world will soon tick by %f seconds\n", (float)timeStep); - int i; + int i; for (i=dynamicsWorld->getNumCollisionObjects()-1; i>=0; i--) { - btCollisionObject* obj = dynamicsWorld->getCollisionObjectArray()[i]; - btRigidBody* body = btRigidBody::upcast(obj); + btCollisionObject* obj = dynamicsWorld->getCollisionObjectArray()[i]; + btRigidBody* body = btRigidBody::upcast(obj); - btVector3 gravity(0,0, 10.0); - body->applyCentralForce(gravity); - } + btVector3 gravity(0,0, 10.0); + body->applyCentralForce(gravity); + } } @@ -122,7 +124,7 @@ */ int add_rigid_bodies(btDiscreteDynamicsWorld* dynamicsWorld, - btAlignedObjectArray<btCollisionShape*> collision_shapes) + btAlignedObjectArray<btCollisionShape*> collision_shapes) { struct rigid_body *current_node; fastf_t volume; @@ -133,7 +135,7 @@ for (current_node = sim_params->head_node; current_node != NULL; current_node = current_node->next) { - current_node->iter = sim_params->iter; + current_node->iter = sim_params->iter; // Check if we should add a ground plane if (strcmp(current_node->rb_namep, sim_params->ground_plane_name) == 0) { @@ -232,30 +234,30 @@ { int i; - bu_vls_printf(sim_params->result_str, "Simulation will run for %d steps.\n", sim_params->duration); + bu_vls_printf(sim_params->result_str, "Simulation will run for %d steps.\n", sim_params->duration); bu_vls_printf(sim_params->result_str, "----- Starting simulation -----\n"); for (i=0 ; i < sim_params->duration ; i++) { - bu_log("------------------------- Iteration %d -----------------------\n", i+1); + bu_log("------------------------- Iteration %d -----------------------\n", i+1); - //time step of 1/60th of a second(same as internal fixedTimeStep, maxSubSteps=10 to cover 1/60th sec.) - dynamicsWorld->stepSimulation(1/60.f, 10); + //time step of 1/60th of a second(same as internal fixedTimeStep, maxSubSteps=10 to cover 1/60th sec.) + dynamicsWorld->stepSimulation(1/60.f, 10); - /* for (j=dynamicsWorld->getNumCollisionObjects()-1; j>=0; j--) { + /* for (j=dynamicsWorld->getNumCollisionObjects()-1; j>=0; j--) { - btCollisionObject* obj = dynamicsWorld->getCollisionObjectArray()[j]; - btRigidBody* body = btRigidBody::upcast(obj); + btCollisionObject* obj = dynamicsWorld->getCollisionObjectArray()[j]; + btRigidBody* body = btRigidBody::upcast(obj); - btVector3 gravity(0,0, 10.1); - body->applyCentralForce(gravity); + btVector3 gravity(0,0, 10.1); + body->applyCentralForce(gravity); - //struct rigid_body *rbA = (struct rigid_body *)boxA->getUserPointer(); - //if( BU_STR_EQUAL(rt_mf->rbA->rb_namep, rbA->rb_namep) + //struct rigid_body *rbA = (struct rigid_body *)boxA->getUserPointer(); + //if( BU_STR_EQUAL(rt_mf->rbA->rb_namep, rbA->rb_namep) } -*/ - } + */ + } bu_log("----- Simulation Complete -----\n"); return 0; @@ -386,37 +388,37 @@ virtual bool needBroadphaseCollision(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1) const { - bool collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0; - collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask); + bool collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0; + collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask); - btVector3 aabbMin, aabbMax; + btVector3 aabbMin, aabbMax; - //This would prevent collision between proxy0 and proxy1 inspite of - //AABB overlap being detected - btRigidBody* boxA = (btRigidBody*)proxy0->m_clientObject; - btRigidBody* boxB = (btRigidBody*)proxy1->m_clientObject; + //This would prevent collision between proxy0 and proxy1 inspite of + //AABB overlap being detected + btRigidBody* boxA = (btRigidBody*)proxy0->m_clientObject; + btRigidBody* boxB = (btRigidBody*)proxy1->m_clientObject; - if (boxA != NULL && boxB != NULL) { + if (boxA != NULL && boxB != NULL) { - struct rigid_body *rbA = (struct rigid_body *)boxA->getUserPointer(); - struct rigid_body *rbB = (struct rigid_body *)boxB->getUserPointer(); + struct rigid_body *rbA = (struct rigid_body *)boxA->getUserPointer(); + struct rigid_body *rbB = (struct rigid_body *)boxB->getUserPointer(); - bu_log("broadphase_callback: %s & %s has overlapping AABBs", - rbA->rb_namep, rbB->rb_namep); + bu_log("broadphase_callback: %s & %s has overlapping AABBs", + rbA->rb_namep, rbB->rb_namep); - //Get the AABB for body A : will happen multiple times if there are multiple overlaps - boxA->getAabb(aabbMin, aabbMax); - VMOVE(rbA->btbb_min, aabbMin); - VMOVE(rbA->btbb_max, aabbMax); + //Get the AABB for body A : will happen multiple times if there are multiple overlaps + boxA->getAabb(aabbMin, aabbMax); + VMOVE(rbA->btbb_min, aabbMin); + VMOVE(rbA->btbb_max, aabbMax); - //Get the AABB for body B : will happen multiple times if there are multiple overlaps - boxB->getAabb(aabbMin, aabbMax); - VMOVE(rbB->btbb_min, aabbMin); - VMOVE(rbB->btbb_max, aabbMax); - } + //Get the AABB for body B : will happen multiple times if there are multiple overlaps + boxB->getAabb(aabbMin, aabbMax); + VMOVE(rbB->btbb_min, aabbMin); + VMOVE(rbB->btbb_max, aabbMax); + } - //add some additional logic here that modifies 'collides' - return collides; + //add some additional logic here that modifies 'collides' + return collides; } }; @@ -431,21 +433,21 @@ btDispatcherInfo& dispatchInfo) { - btRigidBody* boxA = (btRigidBody*)(collisionPair.m_pProxy0->m_clientObject); - btRigidBody* boxB = (btRigidBody*)(collisionPair.m_pProxy1->m_clientObject); + btRigidBody* boxA = (btRigidBody*)(collisionPair.m_pProxy0->m_clientObject); + btRigidBody* boxB = (btRigidBody*)(collisionPair.m_pProxy1->m_clientObject); - struct rigid_body *rbA = (struct rigid_body *)boxA->getUserPointer(); - struct rigid_body *rbB = (struct rigid_body *)boxB->getUserPointer(); + struct rigid_body *rbA = (struct rigid_body *)boxA->getUserPointer(); + struct rigid_body *rbB = (struct rigid_body *)boxB->getUserPointer(); - bu_log("nearphase_callback : Generating force for %s & %s\n", - rbA->rb_namep, - rbB->rb_namep); + bu_log("nearphase_callback : Generating force for %s & %s\n", + rbA->rb_namep, + rbB->rb_namep); - generate_force(sim_params, rbA, rbB); + generate_force(sim_params, rbA, rbB); - // Only dispatch the Bullet collision information if physics should continue - dispatcher.defaultNearCallback(collisionPair, dispatcher, dispatchInfo); + // Only dispatch the Bullet collision information if physics should continue + dispatcher.defaultNearCallback(collisionPair, dispatcher, dispatchInfo); } @@ -453,26 +455,26 @@ * Called whenever a contact pair is added to a manifold */ bool contact_added( - btManifoldPoint& pt, - const btCollisionObject* col0, - int partId0, - int index0, - const btCollisionObject* col1, - int partId1, - int index1) + btManifoldPoint& pt, + const btCollisionObject* col0, + int partId0, + int index0, + const btCollisionObject* col1, + int partId1, + int index1) { - //Get the user pointers to struct rigid_body, for printing the body name - struct rigid_body *rbA = (struct rigid_body *)col0->getUserPointer(); - struct rigid_body *rbB = (struct rigid_body *)col1->getUserPointer(); + //Get the user pointers to struct rigid_body, for printing the body name + struct rigid_body *rbA = (struct rigid_body *)col0->getUserPointer(); + struct rigid_body *rbB = (struct rigid_body *)col1->getUserPointer(); - btVector3 ptA = pt.getPositionWorldOnA(); - btVector3 ptB = pt.getPositionWorldOnB(); + btVector3 ptA = pt.getPositionWorldOnA(); + btVector3 ptB = pt.getPositionWorldOnB(); - bu_log("Contact added between %s(%f, %f, %f):%d,%d & %s(%f, %f, %f):%d,%d!", - rbA->rb_namep, V3ARGS(ptA), partId0, index0, - rbB->rb_namep, V3ARGS(ptB), partId1, index1); + bu_log("Contact added between %s(%f, %f, %f):%d,%d & %s(%f, %f, %f):%d,%d!", + rbA->rb_namep, V3ARGS(ptA), partId0, index0, + rbB->rb_namep, V3ARGS(ptB), partId1, index1); - return true; + return true; } @@ -482,19 +484,19 @@ */ bool contact_processed(btManifoldPoint& pt, void* col0, void* col1) { - //Get the user pointers to struct rigid_body, for printing the body name - struct rigid_body *rbA = (struct rigid_body *)((btCollisionObject*)col0)->getUserPointer(); - struct rigid_body *rbB = (struct rigid_body *)((btCollisionObject*)col1)->getUserPointer(); + //Get the user pointers to struct rigid_body, for printing the body name + struct rigid_body *rbA = (struct rigid_body *)((btCollisionObject*)col0)->getUserPointer(); + struct rigid_body *rbB = (struct rigid_body *)((btCollisionObject*)col1)->getUserPointer(); - btVector3 ptA = pt.getPositionWorldOnA(); - btVector3 ptB = pt.getPositionWorldOnB(); + btVector3 ptA = pt.getPositionWorldOnA(); + btVector3 ptB = pt.getPositionWorldOnB(); - bu_log("Contact processed between %s(%f, %f, %f) & %s(%f, %f, %f)!", - rbA->rb_namep, V3ARGS(ptA), - rbB->rb_namep, V3ARGS(ptB)); + bu_log("Contact processed between %s(%f, %f, %f) & %s(%f, %f, %f)!", + rbA->rb_namep, V3ARGS(ptA), + rbB->rb_namep, V3ARGS(ptB)); - return true; + return true; } @@ -503,8 +505,8 @@ */ bool contact_destroyed(void* userPersistentData) { - bu_log("CONTACT DESTROYED! %s", (char*)userPersistentData); - return true; + bu_log("CONTACT DESTROYED! %s", (char*)userPersistentData); + return true; } /** @@ -516,14 +518,14 @@ { //int i; - sim_params = sp; + sim_params = sp; - //for (i=0 ; i < sim_params->duration ; i++) { + //for (i=0 ; i < sim_params->duration ; i++) { //Make a new rt_i instance from the existing db_i structure if ((sim_params->rtip=rt_new_rti(sim_params->gedp->ged_wdbp->dbip)) == RTI_NULL) { - bu_log("run_simulation: rt_new_rti failed while getting new rt instance\n"); - return 1; + bu_log("run_simulation: rt_new_rti failed while getting new rt instance\n"); + return 1; } sim_params->rtip->useair = 1; Modified: brlcad/trunk/src/libged/simulate/simrt.c =================================================================== --- brlcad/trunk/src/libged/simulate/simrt.c 2011-10-21 16:58:44 UTC (rev 47315) +++ brlcad/trunk/src/libged/simulate/simrt.c 2011-10-21 17:11:26 UTC (rev 47316) @@ -44,17 +44,17 @@ bu_log("print_rayshot_results: -------\n"); bu_log("X bounds xr_min_x :%f, %f, %f \n", - V3ARGS(rt_result.xr_min_x)); + V3ARGS(rt_result.xr_min_x)); bu_log("X bounds xr_max_x :%f, %f, %f \n", - V3ARGS(rt_result.xr_max_x)); + V3ARGS(rt_result.xr_max_x)); bu_log("Y bounds xr_min_y :%f, %f, %f >>> (%f, %f, %f)\n", - V3ARGS(rt_result.xr_min_y_in), V3ARGS(rt_result.xr_min_y_out)); + V3ARGS(rt_result.xr_min_y_in), V3ARGS(rt_result.xr_min_y_out)); bu_log("Y bounds xr_max_y :%f, %f, %f >>> (%f, %f, %f)\n", - V3ARGS(rt_result.xr_max_y_in), V3ARGS(rt_result.xr_max_y_out)); + V3ARGS(rt_result.xr_max_y_in), V3ARGS(rt_result.xr_max_y_out)); bu_log("Z bounds xr_min_z :%f, %f, %f\n", - V3ARGS(rt_result.xr_min_z_in)); + V3ARGS(rt_result.xr_min_z_in)); bu_log("Z bounds xr_max_z :%f, %f, %f\n", - V3ARGS(rt_result.xr_max_z_in)); + V3ARGS(rt_result.xr_max_z_in)); } @@ -400,14 +400,14 @@ int init_rayshot_results(void) { - /* Initialize the result structure */ - rt_result.xr_min_x[X] = MAX_FASTF; - rt_result.xr_max_x[X] = -MAX_FASTF; - rt_result.xr_min_y_in[Y] = MAX_FASTF; - rt_result.xr_max_y_in[Y] = -MAX_FASTF; + /* Initialize the result structure */ + rt_result.xr_min_x[X] = MAX_FASTF; + rt_result.xr_max_x[X] = -MAX_FASTF; + rt_result.xr_min_y_in[Y] = MAX_FASTF; + rt_result.xr_max_y_in[Y] = -MAX_FASTF; - return GED_OK; + return GED_OK; } @@ -416,7 +416,7 @@ */ int traverse_xray_lists(struct simulation_params *sim_params, - point_t pt, point_t dir) + point_t pt, point_t dir) { struct overlap *ovp; /*struct hit_reg *hrp;*/ @@ -439,7 +439,7 @@ ovp->reg2->reg_name, ovp->index, V3ARGS(pt), V3ARGS(dir)); - line(sim_params->gedp, bu_vls_addr(®_vls), + line(sim_params->gedp, bu_vls_addr(®_vls), ovp->in_point, ovp->out_point, 0, 210, 0); @@ -451,26 +451,26 @@ /* The min x in the direction of the ray where it hit an overlap */ if(ovp->in_point[X] < rt_result.xr_min_x[X]){ - VMOVE(rt_result.xr_min_x, ovp->in_point); + VMOVE(rt_result.xr_min_x, ovp->in_point); } /* The max x in the direction of the ray where it hit an overlap, * could be on a different ray from above */ if((ovp->out_point[X] > rt_result.xr_max_x[X])){ - VMOVE(rt_result.xr_max_x, ovp->out_point); + VMOVE(rt_result.xr_max_x, ovp->out_point); } /* The min y where the x rays encountered overlap */ if(ovp->in_point[Y] < rt_result.xr_min_y_in[Y]){ - VMOVE(rt_result.xr_min_y_in, ovp->in_point); - VMOVE(rt_result.xr_min_y_out, ovp->out_point); + VMOVE(rt_result.xr_min_y_in, ovp->in_point); + VMOVE(rt_result.xr_min_y_out, ovp->out_point); } /* The max y for the same */ if(ovp->in_point[Y] > rt_result.xr_max_y_in[Y]){ - VMOVE(rt_result.xr_max_y_in, ovp->in_point); - VMOVE(rt_result.xr_max_y_out, ovp->out_point); + VMOVE(rt_result.xr_max_y_in, ovp->in_point); + VMOVE(rt_result.xr_max_y_out, ovp->out_point); } /* The min z where the x rays encountered overlap */ @@ -518,9 +518,9 @@ int shoot_x_rays(struct sim_manifold *current_manifold, - struct simulation_params *sim_params, - vect_t overlap_min, - vect_t overlap_max) + struct simulation_params *sim_params, + vect_t overlap_min, + vect_t overlap_max) { point_t r_pt, r_dir; fastf_t startz, starty, y, z; @@ -542,36 +542,36 @@ /* Is it thinner than TOLerance ? */ /*if(diff[Z] < TOL){*/ - /* Yep , so shoot rays only in a single plane in the middle of the overlap region*/ - startz = overlap_min[Z] + diff[Z]*0.5; + /* Yep , so shoot rays only in a single plane in the middle of the overlap region*/ + startz = overlap_min[Z] + diff[Z]*0.5; - /* The overlap region is too thin for generating 4 contacts points, 2 will do */ - for(z=startz; z<overlap_max[Z]; z += TOL){ - for(y=starty; y<(overlap_max[Y]+TOL); y += TOL){ + /* The overlap region is too thin for generating 4 contacts points, 2 will do */ + for(z=startz; z<overlap_max[Z]; z += TOL){ + for(y=starty; y<(overlap_max[Y]+TOL); y += TOL){ - /* Shooting towards lower x, so start from max x outside of overlap box */ - VSET(r_pt, overlap_min[X], y, z); + /* Shooting towards lower x, so start from max x outside of overlap box */ + VSET(r_pt, overlap_min[X], y, z); - bu_log("*****shoot_x_rays : From : (%f,%f,%f) >>> towards(%f,%f,%f)*******", - V3ARGS(r_pt), V3ARGS(r_dir)); + bu_log("*****shoot_x_rays : From : (%f,%f,%f) >>> towards(%f,%f,%f)*******", + V3ARGS(r_pt), V3ARGS(r_dir)); - shoot_ray(sim_params->rtip, r_pt, r_dir); + shoot_ray(sim_params->rtip, r_pt, r_dir); - /* Traverse the hit list and overlap list, drawing the ray segments - * for the current ray - */ - traverse_xray_lists(sim_params, r_pt, r_dir); + /* Traverse the hit list and overlap list, drawing the ray segments + * for the current ray + */ + traverse_xray_lists(sim_params, r_pt, r_dir); - print_rayshot_results(); + print_rayshot_results(); - /* Cleanup the overlap and hit lists and free memory */ - cleanup_lists(); + /* Cleanup the overlap and hit lists and free memory */ + cleanup_lists(); - } + } - bu_log("Last y ray fired from z=%f, y=%f , overlap_max[Z]=%f, overlap_max[Y]=%f", - z, y, overlap_max[Z], overlap_max[Y]); - } + bu_log("Last y ray fired from z=%f, y=%f , overlap_max[Z]=%f, overlap_max[Y]=%f", + z, y, overlap_max[Z], overlap_max[Y]); + } /*}*/ @@ -586,7 +586,7 @@ /* int i; */ - /* Prepare the overlap prim name */ + /* Prepare the overlap prim name */ bu_log("create_contact_pairs : between %s & %s", mf->rbA->rb_namep, mf->rbB->rb_namep); @@ -594,26 +594,26 @@ /* Determine if an arb4 needs to be generated using x/y/z diff. */ mf->num_contacts = 4; - /* VMOVE(mf->contacts[0].ptA, rt_result.xr_min_y_in); - VMOVE(mf->contacts[1].ptA, rt_result.xr_min_y_out); + /* VMOVE(mf->contacts[0].ptA, rt_result.xr_min_y_in); + VMOVE(mf->contacts[1].ptA, rt_result.xr_min_y_out); - VMOVE(mf->contacts[1].ptB, rt_result.xr_max_y_in); - VMOVE(mf->contacts[0].ptB, rt_result.xr_max_y_out); + VMOVE(mf->contacts[1].ptB, rt_result.xr_max_y_in); + VMOVE(mf->contacts[0].ptB, rt_result.xr_max_y_out); - for(i=0; i< mf->num_contacts; i++){ - bu_log("create_contact_pairs : %d, %s(%f, %f, %f) -- %s(%f, %f, %f)", - i, mf->rbA->rb_namep, V3ARGS(mf->contacts[i].ptA), - mf->rbB->rb_namep, V3ARGS(mf->contacts[i].ptB)); - } + for(i=0; i< mf->num_contacts; i++){ + bu_log("create_contact_pairs : %d, %s(%f, %f, %f) -- %s(%f, %f, %f)", + i, mf->rbA->rb_namep, V3ARGS(mf->contacts[i].ptA), + mf->rbB->rb_namep, V3ARGS(mf->contacts[i].ptB)); + } - VSUB2(a, mf->contacts[1].ptB, mf->contacts[1].ptA); - VSUB2(b, mf->contacts[0].ptA, mf->contacts[1].ptB);*/ + VSUB2(a, mf->contacts[1].ptB, mf->contacts[1].ptA); + VSUB2(b, mf->contacts[0].ptA, mf->contacts[1].ptB);*/ /* Get the normals */ - /* VCROSS(c, a, b); - VUNITIZE(c); - bu_log("create_contact_pairs : Normal got as %f,%f, %f", - V3ARGS(c));*/ + /* VCROSS(c, a, b); + VUNITIZE(c); + bu_log("create_contact_pairs : Normal got as %f,%f, %f", + V3ARGS(c));*/ VSET(mf->contacts[0].normalWorldOnB, 0, 0, 1.0000); VSET(mf->contacts[1].normalWorldOnB, 0, 0, 1.0000); @@ -629,24 +629,23 @@ mf->contacts[3].depth = c[Z]; bu_log("create_contact_pairs : Penetration depth set to %f", mf->contacts[0].depth ); - VSET(mf->contacts[0].ptB, 1.000000, 1.000000, overlap_min[Z]); - VSET(mf->contacts[1].ptB, 1.000000, 0.000000, overlap_min[Z]); - VSET(mf->contacts[2].ptB, 0.000000, 0.000000, overlap_min[Z]); - VSET(mf->contacts[3].ptB, 0.000000, 1.000000, overlap_min[Z]); + VSET(mf->contacts[0].ptB, 1.000000, 1.000000, overlap_min[Z]); + VSET(mf->contacts[1].ptB, 1.000000, 0.000000, overlap_min[Z]); + VSET(mf->contacts[2].ptB, 0.000000, 0.000000, overlap_min[Z]); + VSET(mf->contacts[3].ptB, 0.000000, 1.000000, overlap_min[Z]); - return GED_OK; } int generate_force(struct simulation_params *sim_params, - struct rigid_body *rbA, - struct rigid_body *rbB) + struct rigid_body *rbA, + struct rigid_body *rbB) { /* The manifold between rbA & rbB will be stored in B */ - struct sim_manifold *rt_mf = &(rbB->rt_manifold); + struct sim_manifold *rt_mf = &(rbB->rt_manifold); vect_t overlap_min, overlap_max; char *prefix_overlap = "overlap_"; @@ -656,42 +655,41 @@ rt_mf->rbA = rbA; rt_mf->rbB = rbB; - /* Get the overlap region */ - get_overlap(rbA, rbB, overlap_min, overlap_max); + /* Get the overlap region */ + get_overlap(rbA, rbB, overlap_min, overlap_max); - /* Prepare the overlap prim name */ - bu_vls_sprintf(&overlap_name, "%s%s_%s", + /* Prepare the overlap prim name */ + bu_vls_sprintf(&overlap_name, "%s%s_%s", prefix_overlap, rbA->rb_namep, rbB->rb_namep); - /* Make the overlap volume RPP */ - make_rpp(sim_params->gedp, overlap_min, overlap_max, bu_vls_addr(&overlap_name)); + /* Make the overlap volume RPP */ + make_rpp(sim_params->gedp, overlap_min, overlap_max, bu_vls_addr(&overlap_name)); - /* Add the region to the result of the sim so it will be drawn too */ - add_to_comb(sim_params->gedp, sim_params->sim_comb_name, bu_vls_addr(&overlap_name)); + /* Add the region to the result of the sim so it will be drawn too */ + add_to_comb(sim_params->gedp, sim_params->sim_comb_name, bu_vls_addr(&overlap_name)); - /* Initialize the rayshot results structure, has to be done for each manifold */ - /*init_rayshot_results();*/ + /* Initialize the rayshot results structure, has to be done for each manifold */ + /*init_rayshot_results();*/ - /* Shoot rays right here as the pair of rigid_body ptrs are known, - * TODO: ignore volumes already shot - */ - /*shoot_x_rays(rt_mf, sim_params, overlap_min, overlap_max);*/ + /* Shoot rays right here as the pair of rigid_body ptrs are known, + * TODO: ignore volumes already shot + */ + /*shoot_x_rays(rt_mf, sim_params, overlap_min, overlap_max);*/ - /* shoot_y_rays(); */ + /* shoot_y_rays(); */ - /* shoot_z_rays(); */ + /* shoot_z_rays(); */ + /* Create the contact pairs and normals */ + create_contact_pairs(rt_mf, overlap_min, overlap_max); - /* Create the contact pairs and normals */ - create_contact_pairs(rt_mf, overlap_min, overlap_max); - return GED_OK; } Modified: brlcad/trunk/src/libged/simulate/simrt.h =================================================================== --- brlcad/trunk/src/libged/simulate/simrt.h 2011-10-21 16:58:44 UTC (rev 47315) +++ brlcad/trunk/src/libged/simulate/simrt.h 2011-10-21 17:11:26 UTC (rev 47316) @@ -29,85 +29,85 @@ #if defined __cplusplus - /* If the functions in this header have C linkage, this - * will specify linkage for all C++ language compilers */ - extern "C" { +/* If the functions in this header have C linkage, this + * will specify linkage for all C++ language compilers */ +extern "C" { #endif -/* System Headers */ + /* System Headers */ #include <stdlib.h> #include <ctype.h> #include <math.h> #include <string.h> -/* Public Headers */ + /* Public Headers */ #include "vmath.h" #include "db.h" #include "bu.h" -/* Private Headers */ + /* Private Headers */ #include "../ged_private.h" #include "simulate.h" #include "simutils.h" -/* Rays will be at least this far apart when shot through the overlap regions - * This is also the contact threshold for Bullet (0.04 cm if units are in meters) - * Overlaps regions smaller than this will have only a single plane of rays slicing the - * region in half, generating manifolds in a plane. - */ + /* Rays will be at least this far apart when shot through the overlap regions + * This is also the contact threshold for Bullet (0.04 cm if units are in meters) + * Overlaps regions smaller than this will have only a single plane of rays slicing the + * region in half, generating manifolds in a plane. + */ #define TOL 0.04 -/* - * This structure is a single node of a circularly linked list - * of overlap regions: similar to the one in nirt/usrfrmt.h - */ -struct overlap { - int index; - struct application *ap; - struct partition *pp; - struct region *reg1; - struct region *reg2; - fastf_t in_dist; - fastf_t out_dist; - point_t in_point; - point_t out_point; - struct overlap *forw; - struct overlap *backw; -}; + /* + * This structure is a single node of a circularly linked list + * of overlap regions: similar to the one in nirt/usrfrmt.h + */ + struct overlap { + int index; + struct application *ap; + struct partition *pp; + struct region *reg1; + struct region *reg2; + fastf_t in_dist; + fastf_t out_dist; + point_t in_point; + point_t out_point; + struct overlap *forw; + struct overlap *backw; + }; -/* - * This structure is a single node of a circularly linked list - * of hit regions, similar to struct hit from raytrace.h - */ -struct hit_reg { - int index; - struct application *ap; - struct partition *pp; - const char *reg_name; - struct soltab *in_stp; - struct soltab *out_stp; - fastf_t in_dist; - fastf_t out_dist; - point_t in_point; - point_t out_point; - vect_t in_normal; - vect_t out_normal; - struct curvature cur; - int hit_surfno; /**< @brief solid-specific surface indicator */ - struct hit_reg *forw; - struct hit_reg *backw; -}; + /* + * This structure is a single node of a circularly linked list + * of hit regions, similar to struct hit from raytrace.h + */ + struct hit_reg { + int index; + struct application *ap; + struct partition *pp; + const char *reg_name; + struct soltab *in_stp; + struct soltab *out_stp; + fastf_t in_dist; + fastf_t out_dist; + point_t in_point; + point_t out_point; + vect_t in_normal; + vect_t out_normal; + struct curvature cur; + int hit_surfno; /**< @brief solid-specific surface indicator */ + struct hit_reg *forw; + struct hit_reg *backw; + }; -/** - * This structure contains the results of analyzing an overlap volume(among 2 - * regions), through shooting rays - */ -struct rayshot_results{ - /* Results of shooting rays towards -ve x-axis : xr means x rays */ + /** + * This structure contains the results of analyzing an overlap volume(among 2 + * regions), through shooting rays + */ + struct rayshot_results{ + /* Results of shooting rays towards -ve x-axis : xr means x rays */ point_t xr_min_x; /* the min X found while shooting x rays & rltd y,z*/ point_t xr_max_x; /* the max X found while shooting x rays & rltd y,z*/ point_t xr_min_y_in, xr_min_y_out; /* the min y where overlap was found & the z co-ord for it*/ @@ -115,127 +115,127 @@ point_t xr_min_z_in; /* the min z where overlap was found & the y co-ord for it*/ point_t xr_max_z_in; /* the max z where overlap was still found */ - /* Results of shooting rays down y axis */ + /* Results of shooting rays down y axis */ - /* Results of shooting rays down z axis */ + /* Results of shooting rays down z axis */ -}; + }; -/** - * Creates the contact pairs from the raytracing results. - * This is the core logic of the simulation and the manifold points - * have to satisfy certain constraints(max area within overlap region etc) - * to have a successful simulation. The normals and penetration depth is also - * generated here for each point in the contact pairs. There can be upto 4 - * contact pairs. - */ -int -create_contact_pairs(struct sim_manifold *mf, vect_t overlap_min, vect_t overlap_max); + /** + * Creates the contact pairs from the raytracing results. + * This is the core logic of the simulation and the manifold points + * have to satisfy certain constraints(max area within overlap region etc) + * to have a successful simulation. The normals and penetration depth is also + * generated here for each point in the contact pairs. There can be upto 4 + * contact pairs. + */ + int + create_contact_pairs(struct sim_manifold *mf, vect_t overlap_min, vect_t overlap_max); -/** - * Shoots rays within the AABB overlap regions only, to allow more rays to be shot - * in a grid of finer granularity and to increase performance. The bodies to be targeted - * are got from the list of manifolds returned by Bullet which carries out AABB - * intersection checks. These manifolds are stored in the corresponding rigid_body - * structures of each body participating in the simulation. The manifolds are then used - * to generate manifolds based on raytracing and stored in a separate list for the body B - * of that particular manifold. The list is freed in the next iteration in this function - * as well, to prevent memory leaks, before a new set manifolds are created. - */ -int -generate_force(struct simulation_params *sim_params, - struct rigid_body *rbA, - struct rigid_body *rbB); + /** + * Shoots rays within the AABB overlap regions only, to allow more rays to be shot + * in a grid of finer granularity and to increase performance. The bodies to be targeted + * are got from the list of manifolds returned by Bullet which carries out AABB + * intersection checks. These manifolds are stored in the corresponding rigid_body + * structures of each body participating in the simulation. The manifolds are then used + * to generate manifolds based on raytracing and stored in a separate list for the body B + * of that particular manifold. The list is freed in the next iteration in this function + * as well, to prevent memory leaks, before a new set manifolds are created. + */ + int + generate_force(struct simulation_params *sim_params, + struct rigid_body *rbA, + struct rigid_body *rbB); -/** - * Cleanup the hit list and overlap list: private to simrt - */ -int -cleanup_lists(void); + /** + * Cleanup the hit list and overlap list: private to simrt + */ + int + cleanup_lists(void); -/** - * Gets the exact overlap volume between 2 AABBs - */ -int -get_overlap(struct rigid_body *rbA, struct rigid_body *rbB, vect_t overlap_min, - vect_t overlap_max); + /** + * Gets the exact overlap volume between 2 AABBs + */ + int + get_overlap(struct rigid_body *rbA, struct rigid_body *rbB, vect_t overlap_min, + vect_t overlap_max); -/** - * Handles hits, records then in a global list - * TODO : Stop the ray after it's left the overlap region which is being currently - * queried. - */ -int -if_hit(struct application *ap, struct partition *part_headp, struct seg *UNUSED(segs)); + /** + * Handles hits, records then in a global list + * TODO : Stop the ray after it's left the overlap region which is being currently + * queried. + */ + int + if_hit(struct application *ap, struct partition *part_headp, struct seg *UNUSED(segs)); -/** - * Handles misses while shooting manifold rays, - * not interested in misses. - */ -int -if_miss(struct application *UNUSED(ap)); + /** + * Handles misses while shooting manifold rays, + * not interested in misses. + */ + int + if_miss(struct application *UNUSED(ap)); -/** - * Handles overlaps while shooting manifold rays, - * records the overlap regions in a global list - * - */ -int -if_overlap(struct application *ap, struct partition *pp, struct region *reg1, - struct region *reg2, struct partition *InputHdp); + /** + * Handles overlaps while shooting manifold rays, + * records the overlap regions in a global list + * + */ + int + if_overlap(struct application *ap, struct partition *pp, struct region *reg1, + struct region *reg2, struct partition *InputHdp); -/** - * Shoots a ray at the simulation geometry and fills up the hit & - * overlap global list - */ -int -shoot_ray(struct rt_i *rtip, point_t pt, point_t dir); + /** + * Shoots a ray at the simulation geometry and fills up the hit & + * overlap global list + */ + int + shoot_ray(struct rt_i *rtip, point_t pt, point_t dir); -/** - * Shoots a grid of rays down x axis - */ -int -shoot_x_rays(struct sim_manifold *current_manifold, - struct simulation_params *sim_params, - vect_t overlap_min, - vect_t overlap_max); + /** + * Shoots a grid of rays down x axis + */ + int + shoot_x_rays(struct sim_manifold *current_manifold, + struct simulation_params *sim_params, + vect_t overlap_min, + vect_t overlap_max); -/** - * Traverse the hit list and overlap list, drawing the ray segments - * for x-rays - */ -int -traverse_xray_lists(struct simulation_params *sim_params, - point_t pt, point_t dir); + /** + * Traverse the hit list and overlap list, drawing the ray segments + * for x-rays + */ + int + traverse_xray_lists(struct simulation_params *sim_params, + point_t pt, point_t dir); -/** - * Initializes the simulation scene for raytracing - */ -int -init_raytrace(struct simulation_params *sim_params); + /** + * Initializes the simulation scene for raytracing + */ + int + init_raytrace(struct simulation_params *sim_params); -/** - * Initializes the rayshot results structure, called before analyzing - * each manifold through rays shot in x, y & z directions - */ -int -init_rayshot_results(void); + /** + * Initializes the rayshot results structure, called before analyzing + * each manifold through rays shot in x, y & z directions + */ + int + init_rayshot_results(void); #if defined __cplusplus - } /* matches the linkage specification at the beginning. */ +} /* matches the linkage specification at the beginning. */ #endif Modified: brlcad/trunk/src/libged/simulate/simulate.c =================================================================== --- brlcad/trunk/src/libged/simulate/simulate.c 2011-10-21 16:58:44 UTC (rev 47315) +++ brlcad/trunk/src/libged/simulate/simulate.c 2011-10-21 17:11:26 UTC (rev 47316) @@ -413,26 +413,24 @@ return GED_ERROR; } - /* Recreate sim.c to clear AABBs and manifold regions from previous iteration */ - recreate_sim_comb(gedp, &sim_params); + /* Recreate sim.c to clear AABBs and manifold regions from previous iteration */ + recreate_sim_comb(gedp, &sim_params); - /* Run the physics simulation */ - rv = run_simulation(&sim_params); - if (rv != GED_OK) { - bu_vls_printf(gedp->ged_result_str, "%s: ERROR while running the simulation\n", argv[0]); - return GED_ERROR; - } + /* Run the physics simulation */ + rv = run_simulation(&sim_params); + if (rv != GED_OK) { + bu_vls_printf(gedp->ged_result_str, "%s: ERROR while running the simulation\n", argv[0]); + return GED_ERROR; + } - /* Apply transforms on the participating objects, also shades objects */ - rv = apply_transforms(gedp, &sim_params); - if (rv != GED_OK) { - bu_vls_printf(gedp->ged_result_str, "%s: ERROR while applying transforms\n", argv[0]); - return GED_ERROR; - } + /* Apply transforms on the participating objects, also shades objects */ + rv = apply_transforms(gedp, &sim_params); + if (rv != GED_OK) { + bu_vls_printf(gedp->ged_result_str, "%s: ERROR while applying transforms\n", argv[0]); + return GED_ERROR; + } - - /* Free memory in rigid_body list */ for (current_node = sim_params.head_node; current_node != NULL;) { next_node = current_node->next; Modified: brlcad/trunk/src/libged/simulate/simulate.h =================================================================== --- brlcad/trunk/src/libged/simulate/simulate.h 2011-10-21 16:58:44 UTC (rev 47315) +++ brlcad/trunk/src/libged/simulate/simulate.h 2011-10-21 17:11:26 UTC (rev 47316) @@ -30,17 +30,17 @@ #if defined __cplusplus - /* If the functions in this header have C linkage, this - * will specify linkage for all C++ language compilers */ - extern "C" { +/* If the functions in this header have C linkage, this + * will specify linkage for all C++ language compilers */ +extern "C" { #endif -/* interface headers */ + /* interface headers */ #include "vmath.h" #include "../ged_private.h" -//Copy of the rigid body state tags from btCollisionObject.h + //Copy of the rigid body state tags from btCollisionObject.h #define ACTIVE_TAG 1 #define ISLAND_SLEEPING 2 #define WANTS_DEACTIVATION 3 @@ -50,85 +50,85 @@ #define MAX_MANIFOLDS 4 #define MAX_CONTACTS_PER_MANIFOLD 4 -struct sim_contact { - vect_t ptA; - vect_t ptB; - vect_t normalWorldOnB; - fastf_t depth; -}; + struct sim_contact { + vect_t ptA; + vect_t ptB; + vect_t normalWorldOnB; + fastf_t depth; + }; -struct sim_manifold { - struct rigid_body *rbA, *rbB; - int num_contacts; - struct sim_contact contacts[MAX_CONTACTS_PER_MANIFOLD]; -}; + struct sim_manifold { + struct rigid_body *rbA, *rbB; + int num_contacts; + struct sim_contact contacts[MAX_CONTACTS_PER_MANIFOLD]; + }; -/* Contains information about a single rigid body constructed from a - * BRL-CAD region. This structure is the node of a linked list - * containing the geometry to be added to the sim. - * - * TODO: Only the bb is currently present, but physical properties - * like elasticity, custom forces will be added later. - */ -struct rigid_body { - int index; - char *rb_namep; /**< @brief pointer to name string */ - point_t bb_min; /**< @brief body min bb bounds, only calculated 1st time */ - point_t bb_max; /**< @brief body max bb bounds, only calculated 1st time */ - point_t bb_center; /**< @brief bb center */ - point_t bb_dims; /**< @brief bb dimensions */ - point_t btbb_min; /**< @brief Bullet body min bb bounds, updated after each iter. */ - point_t btbb_max; /**< @brief Bullet body max bb bounds, updated after each iter. */ - point_t btbb_center; /**< @brief Bullet bb center */ - point_t btbb_dims; /**< @brief Bullet bb dimensions */ - mat_t m; /**< @brief transformation matrix from Bullet */ - mat_t m_prev; /**< @brief previous transformation matrix from Bullet */ - int state; /**< @brief rigid body state from Bullet */ - struct directory *dp; /**< @brief directory pointer to the related region */ - struct rigid_body *next; /**< @brief link to next body */ + /* Contains information about a single rigid body constructed from a + * BRL-CAD region. This structure is the node of a linked list + * containing the geometry to be added to the sim. + * + * TODO: Only the bb is currently present, but physical properties + * like elasticity, custom forces will be added later. + */ + struct rigid_body { + int index; + char *rb_namep; /**< @brief pointer to name string */ + point_t bb_min; /**< @brief body min bb bounds, only calculated 1st time */ + point_t bb_max; /**< @brief body max bb bounds, only calculated 1st time */ + point_t bb_center; /**< @brief bb center */ + point_t bb_dims; /**< @brief bb dimensions */ + point_t btbb_min; /**< @brief Bullet body min bb bounds, updated after each iter. */ + point_t btbb_max; /**< @brief Bullet body max bb bounds, updated after each iter. */ + point_t btbb_center; /**< @brief Bullet bb center */ + point_t btbb_dims; /**< @brief Bullet bb dimensions */ + mat_t m; /**< @brief transformation matrix from Bullet */ + mat_t m_prev; /**< @brief previous transformation matrix from Bullet */ + int state; /**< @brief rigid body state from Bullet */ + struct directory *dp; /**< @brief directory pointer to the related region */ + struct rigid_body *next; /**< @brief link to next body */ - /* Can be set by libged or Bullet(checked and inserted into sim) */ - vect_t linear_velocity; /**< @brief linear velocity components */ - vect_t angular_velocity; /**< @brief angular velocity components */ + /* Can be set by libged or Bullet(checked and inserted into sim) */ + vect_t linear_velocity; /**< @brief linear velocity components */ + vect_t angular_velocity; /**< @brief angular velocity components */ - /* Manifold generated by Bullet, where this body is B, only body B has manifold info */ - int num_bt_manifolds; /**< @brief number of manifolds for this body */ - struct sim_manifold bt_manifold[MAX_MANIFOLDS]; /**< @brief the manifolds for this body */ + /* Manifold generated by Bullet, where this body is B, only body B has manifold info */ + int num_bt_manifolds; /**< @brief number of manifolds for this body */ + struct sim_manifold bt_manifold[MAX_MANIFOLDS]; /**< @brief the manifolds for this body */ - /* Manifold generated by RT, where this body is B, only body B has manifold info */ - int num_rt_manifolds; /**< @brief number of manifolds for this body */ - struct sim_manifold rt_manifold; /**< @brief only 1 manifold struct needed as the manifold is used - immediately after being generated in the nearphase callback*/ + /* Manifold generated by RT, where this body is B, only body B has manifold info */ + int num_rt_manifolds; /**< @brief number of manifolds for this body */ + struct sim_manifold rt_manifold; /**< @brief only 1 manifold struct needed as the manifold is used + immediately after being generated in the nearphase callback*/ - /* Debugging */ - int iter; -}; + /* Debugging */ + int iter; + }; -/* Contains the simulation parameters, such as number of rigid bodies, - * the head node of the linked list containing the bodies and - * time/steps for which the simulation will be run. - */ -struct simulation_params { - int duration; /**< @brief contains either the number of steps or the time */ - int num_bodies; /**< @brief number of rigid bodies participating in the sim */ - struct bu_vls *result_str; /**< @brief handle to the libged object to access geometry info */ - char *sim_comb_name; /**< @brief name of the group which contains all sim regions*/ - char *ground_plane_name; /**< @brief name of the ground plane region */ - struct rigid_body *head_node; /**< @brief link to first rigid body node */ + /* Contains the simulation parameters, such as number of rigid bodies, + * the head node of the linked list containing the bodies and + * time/steps for which the simulation will be run. + */ + struct simulation_params { + int duration; /**< @brief contains either the number of steps or the time */ + int num_bodies; /**< @brief number of rigid bodies participating in the sim */ + struct bu_vls *result_str; /**< @brief handle to the libged object to access geometry info */ + char *sim_comb_name; /**< @brief name of the group which contains all sim regions*/ + char *ground_plane_name; /**< @brief name of the ground plane region */ + struct rigid_body *head_node; /**< @brief link to first rigid body node */ - struct rt_i *rtip; /**< @brief the raytrace instance used by rt to find contact points */ - struct ged *gedp; /**< @brief pass the gfx context to allow lines to be drawn by rt */ + struct rt_i *rtip; /**< @brief the raytrace instance used by rt to find contact points */ + struct ged *gedp; /**< @brief pass the gfx context to allow lines to be drawn by rt */ - /* Debugging */ - int iter; -}; + /* Debugging */ + int iter; + }; #if defined __cplusplus - } /* matches the linkage specification at the beginning. */ +} /* matches the linkage specification at the beginning. */ #endif #endif /* SIMULATE_H_ */ Modified: brlcad/trunk/src/libged/simulate/simutils.c =================================================================== --- brlcad/trunk/src/libged/simulate/simutils.c 2011-10-21 16:58:44 UTC (rev 47315) +++ brlcad/trunk/src/libged/simulate/simutils.c 2011-10-21 17:11:26 UTC (rev 47316) @@ -85,7 +85,7 @@ for (i=0; i<rb->num_bt_manifolds; i++) { bu_log("--Manifold %d between %s & %s has %d contacts--\n", - i+1, + i+1, rb->bt_manifold[i].rbA->rb_namep, rb->bt_manifold[i].rbB->rb_namep, rb->bt_manifold[i].num_contacts); @@ -492,13 +492,13 @@ rv = ged_in(gedp, argc, (const char **)cmd_args); if (rv != GED_OK) { - if (kill(gedp, name) != GED_OK) { - bu_log("line: ERROR Could not delete existing \"%s\"\n", name); - return GED_ERROR; - } - bu_log("make_rpp: WARNING Could not insert RPP %s (%f, %f, %f):(%f, %f, %f)\n", + if (kill(gedp, name) != GED_OK) { + bu_log("line: ERROR Could not delete existing \"%s\"\n", name); + return GED_ERROR; + } + bu_log("make_rpp: WARNING Could not insert RPP %s (%f, %f, %f):(%f, %f, %f)\n", name, V3ARGS(min), V3ARGS(max)); - return GED_ERROR; + return GED_ERROR; } bu_free_array(argc, cmd_args, "make_rpp: free cmd_args"); Modified: brlcad/trunk/src/libged/simulate/simutils.h =================================================================== --- brlcad/trunk/src/libged/simulate/simutils.h 2011-10-21 16:58:44 UTC (rev 47315) +++ brlcad/trunk/src/libged/simulate/simutils.h 2011-10-21 17:11:26 UTC (rev 47316) @@ -28,170 +28,170 @@ #if defined __cplusplus - /* If the functions in this header have C linkage, this - * will specify linkage for all C++ language compilers */ - extern "C" { +/* If the functions in this header have C linkage, this + * will specify linkage for all C++ language compilers */ +extern "C" { #endif -/* System Headers */ + /* System Headers */ #include <stdlib.h> #include <ctype.h> #include <math.h> #include <string.h> -/* Public Headers */ + /* Public Headers */ #include "vmath.h" #include "db.h" #include "bu.h" -/* Private Headers */ + /* Private Headers */ #include "../ged_private.h" #include "simulate.h" -/** - * How to use simulate.Blissfully simple interface, more options will be added soon - */ -void -print_usage(struct bu_vls *str); + /** + * How to use simulate.Blissfully simple interface, more options will be added soon + */ + void + print_usage(struct bu_vls *str); -/** - * Prints a 16 by 16 transform matrix for debugging - * - */ -void -print_matrix(char *rb_namep, mat_t t); + /** + * Prints a 16 by 16 transform matrix for debugging + * + */ + void + print_matrix(char *rb_namep, mat_t t); -/** - * Prints a struct rigid_body for debugging, more members will be printed later - */ -void -print_rigid_body(struct rigid_body *rb); + /** + * Prints a struct rigid_body for debugging, more members will be printed later + */ + void + print_rigid_body(struct rigid_body *rb); -/** - * Prints the list of contacts in each manifold of a rigid body - */ -void -print_manifold_list(struct rigid_body *rb); + /** + * Prints the list of contacts in each manifold of a rigid body + */ + void + print_manifold_list(struct rigid_body *rb); -/** - * Prints the args of a command to be executed using libged - */ -void -print_command(char* cmd_args[], int num_args); + /** + * Prints the args of a command to be executed using libged + */ + void + print_command(char* cmd_args[], int num_args); -/** - * Deletes a prim/comb if it exists. - * - * TODO: lower to librt - */ -int -kill(struct ged *gedp, char *name); + /** + * Deletes a prim/comb if it exists. + * + * TODO: lower to librt + */ + int + kill(struct ged *gedp, char *name); -/** - * Deletes and duplicates the prim/comb passed in dp as new_name. - * - * TODO : lower to librt - */ -int -kill_copy(struct ged *gedp, struct directory *dp, char* new_name); + /** + * Deletes and duplicates the prim/comb passed in dp as new_name. + * + * TODO : lower to librt + */ + int + kill_copy(struct ged *gedp, struct directory *dp, char* new_name); -/** - * Adds a prim/comb to an existing comb or creates it if not existing. - * - * TODO: lower to librt - */ -int -add_to_comb(struct ged *gedp, char *target, char *add); + /** + * Adds a prim/comb to an existing comb or creates it if not existing. + * + * TODO: lower to librt + */ + int + add_to_comb(struct ged *gedp, char *target, char *add); -/** - * Draw a line from,to and color it - */ -int -line(struct ged *gedp, char* name, point_t from, point_t to, - unsigned char r, - unsigned char g, - unsigned char b); + /** + * Draw a line from,to and color it + */ + int + line(struct ged *gedp, char* name, point_t from, point_t to, + unsigned char r, + unsigned char g, + unsigned char b); -/** - * Draws an arrow from, to using the BOT primitive & TRC - * Used to draw manifold normals - * TODO: find a simpler way - */ -int -arrow(struct ged *gedp, char* name, point_t from, point_t to); + /** + * Draws an arrow from, to using the BOT primitive & TRC + * Used to draw manifold normals + * TODO: find a simpler way + */ + int + arrow(struct ged *gedp, char* name, point_t from, point_t to); -/** - * Applies a material to passed comb using libged - * TODO: lower to librt - */ -int -apply_material(struct ged *gedp, - char* comb, - char* material, - unsigned char r, - unsigned char g, - unsigned char b); + /** + * Applies a material to passed comb using libged + * TODO: lower to librt + */ + int + apply_material(struct ged *gedp, + char* comb, + char* material, + unsigned char r, + unsigned char g, + unsigned char b); -/** - * This function colors the passed comb. It's for showing the current - * state of the object inside the physics engine. - * - * TODO : this should be used with a debugging flag - */ -int -apply_color(struct ged *gedp, - char* name, - unsigned char r, - unsigned char g, - unsigned char b); + /** + * This function colors the passed comb. It's for showing the current + * state of the object inside the physics engine. + * + * TODO : this should be used with a debugging flag + */ + int + apply_color(struct ged *gedp, + char* name, + unsigned char r, + unsigned char g, + unsigned char b); -/** - * This function draws the bounding box around a comb as reported by - * Bullet. - * - * TODO: this should be used with a debugging flag - * TODO: this function will soon be lowered to librt - */ -int -insert_AABB(struct ged *gedp, - struct simulation_params *sim_params, - struct rigid_body *current_node); + /** + * This function draws the bounding box around a comb as reported by + * Bullet. + * + * TODO: this should be used with a debugging flag + * TODO: this function will soon be lowered to librt + */ + int + insert_AABB(struct ged *gedp, + struct simulation_params *sim_params, + struct rigid_body *current_node); -/** - * This function inserts a manifold comb as reported by Bullet. - * - * TODO: this should be used with a debugging flag - * TODO: this function should be lowered to librt - */ -int -insert_manifolds(struct ged *gedp, struct simulation_params *sim_params, struct rigid_body *rb); + /** + * This function inserts a manifold comb as reported by Bullet. + * + * TODO: this should be used with a debugging flag + * TODO: this function should be lowered to librt + */ + int + insert_manifolds(struct ged *gedp, struct simulation_params *sim_params, struct rigid_body *rb); -/** - * This function creates and inserts a RPP - * Used to show AABB overlap volume - * - * TODO: this function should be lowered to librt - */ -int -make_rpp(struct ged *gedp, vect_t max, vect_t min, char* name); + /** + * This function creates and inserts a RPP + * Used to show AABB overlap volume + * + * TODO: this function should be lowered to librt + */ + int + make_rpp(struct ged *gedp, vect_t max, vect_t min, char* name); #if defined __cplusplus - } /* matches the linkage specification at the beginning. */ +} /* matches the linkage specification at the beginning. */ #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits