void test_physics(){ printf("testing physics\n"); world_handle hello_world = new_world(); //tests movement, set/get velocity, set/get location(position) po_vector center; center.x = 1.0; center.y = 1.0; po_circle circle2 = create_circ(center, 1.0); po_geometry geo_circle2 = create_geom_circ(circle2, 1.0); po_handle circle02 = add_object (hello_world, &geo_circle2, 20.0, 1.0, 0.0); po_vector location = get_position(circle02); center.x = 0.0; center.y = 0.0; po_circle circle1 = create_circ(center, 5.0); po_geometry geo_circle1 = create_geom_circ(circle1, 1.0); po_handle circle01 = add_object (hello_world, &geo_circle1, 50.0, 0.0, 0.0); set_velocity(circle02,-1.0,0.0); po_vector velocity = get_velocity(circle02); update(hello_world,3); po_vector pos02 = get_position(circle02); po_vector pos01 = get_position(circle01); assert(pos02.x == 17.0); assert(pos02.y == 1.0); assert(pos01.x == 50.0); assert(pos01.y == 0.0); set_location(circle01, 0.0, 0.0); set_velocity(circle01, -7.76,1.7); set_location(circle02, 20.0, 0.0); set_velocity(circle02, -9.0,2.0); update(hello_world,1); po_vector pos002 = get_position(circle02); po_vector pos001 = get_position(circle01); assert( pos002.x == 11.0); assert( pos002.y == 2.0); assert(fabs(pos001.x - -7.76) <= EPSILON); assert(fabs(pos001.y - 1.7)<= EPSILON); }
t_circ *my_fulfill_list(char **av) { int i; t_circ *root; i = 1; root = create_circ(); while (av[i]) add_elem_end(root, av[i++]); add_elem_end(root, NULL); // si a l'envers, add_elem_beg a la place de end. return (root); }