Lines Matching defs:g2

449 belt (struct GEAR g1, struct GEAR g2)
462 width = min (g1.width, g2.width);
463 D = sqrt (pow (g1.position[0] - g2.position[0], 2) + pow (g1.position[1] - g2.position[1], 2) + pow (g1.position[2] - g2.position[2], 2));
464 alpha = acos ((g2.position[0] - g1.position[0]) / D);
465 phi = acos ((g1.radius - g2.radius) / D);
482 incr = 1.2 * 360.0 / g2.teeth * M_PI / 180.00;
486 glVertex3f (g2.radius * cos (angle) + g2.position[0] - g1.position[0], g2.radius * sin (angle) + g2.position[1] - g1.position[1], width * 0.5);
487 glVertex3f (g2.radius * cos (angle) + g2.position[0] - g1.position[0], g2.radius * sin (angle) + g2.position[1] - g1.position[1], width * -0.5);
488 glVertex3f (g2.radius * cos (angle + incr) + g2.position[0] - g1.position[0], g2.radius * sin (angle + incr) + g2.position[1] - g1.position[1], width * -0.5);
489 glVertex3f (g2.radius * cos (angle + incr) + g2.position[0] - g1.position[0], g2.radius * sin (angle + incr) + g2.position[1] - g1.position[1], width * 0.5);
498 glVertex3f (g2.radius * cos (alpha + phi) + g2.position[0] - g1.position[0], g2.radius * sin (alpha + phi) + g2.position[1] - g1.position[1], width * -0.5);
499 glVertex3f (g2.radius * cos (alpha + phi) + g2.position[0] - g1.position[0], g2.radius * sin (alpha + phi) + g2.position[1] - g1.position[1], width * 0.5);
502 glVertex3f (g2.radius * cos (alpha - phi) + g2.position[0] - g1.position[0], g2.radius * sin (alpha - phi) + g2.position[1] - g1.position[1], width * -0.5);
503 glVertex3f (g2.radius * cos (alpha - phi) + g2.position[0] - g1.position[0], g2.radius * sin (alpha - phi) + g2.position[1] - g1.position[1], width * 0.5);
540 GLint axle_index, i, j, g1, g2, k;
679 g2 = gear_find (b[i].gear2_name);
680 D = sqrt (pow (g[g1].position[0] - g[g2].position[0], 2) + pow (g[g1].position[1] - g[g2].position[1], 2) + pow (g[g1].position[2] - g[g2].position[2], 2));
681 if (!((g[g1].axis == g[g2].axis) && (!strcmp (g[g1].type, g[g2].type)) && (!strcmp (g[g1].type, "NORMAL"))))
687 if ((g[g1].axis == g[g2].axis) && (!strcmp (g[g1].type, g[g2].type)) && (!strcmp (g[g1].type, "NORMAL")))
690 if((g[g1].motored)&&(g[g2].motored))
691 if(g[g2].angular_velocity!=(g[g1].angular_velocity*g[g1].radius/g[g2].radius))
693 printf("Error in belt linkage of gears %s and %s".,g[g1].name,g[g2].name);
699 dist = g[g1].position[0] - g[g2].position[0];
703 dist = g[g1].position[1] - g[g2].position[1];
706 dist = g[g1].position[2] - g[g2].position[2];
710 if (dist > (g[g1].width / 2 + g[g2].width / 2))
716 if (dist < (g[g1].width / 2 + g[g2].width / 2))
718 if (D < g[g1].radius + g[g2].radius)
720 printf ("Gears %s and %s too close to be linked with belts", g[g1].name, g[g2].name);
724 if ((g[g1].motored) && (!(g[g2].motored)))
726 axle_index = axle_find (g[g2].axle_name);
727 g[g2].motored = (a[axle_index].motored = 1);
728 g[g2].direction = (a[axle_index].direction = g[g1].direction);
729 g[g2].angular_velocity = (a[axle_index].angular_velocity = g[g1].angular_velocity * g[g1].radius / g[g2].radius);
732 if ((!(g[g1].motored)) && (g[g2].motored))
736 g[g1].direction = (a[axle_index].direction = g[g2].direction);
737 g[g1].angular_velocity = (a[axle_index].angular_velocity = g[g2].angular_velocity * g[g2].radius / g[g1].radius);