static void volume_test() { // test cases for cuboid variant check_within_d( volume(make_cuboid(0.0, 0.0, 0.0)), 0.0, EPSILON); check_within_d( volume(make_cuboid(1.0, 1.0, 1.0)), 1.0, EPSILON); check_within_d( volume(make_cuboid(1.4, 2.5, 3.6)), 12.6, EPSILON); // test cases for cylinder check_within_d( volume(make_cylinder(0.0, 2.0)), 0.0, EPSILON); check_within_d( volume(make_cylinder(1.0, 1.0 / PI)), 1.0, EPSILON); check_within_d( volume(make_cylinder(1.9, 1.2)), PI * 1.9 * 1.9 * 1.2, EPSILON); // test cases for ball check_within_d( volume(make_ball(0.0)), 0.0, EPSILON); check_within_d( volume(make_ball(1.0)), 4.0 / 3.0 * PI, EPSILON); check_within_d( volume(make_ball(2.4)), 4.0 / 3.0 * PI * 2.4 * 2.4 * 2.4, EPSILON); }
void make_shape(Shape *vert) { double ray = 1; // radius int height = 1; // height double torus_radius = 1.2; // radius from origin to center of tube double tube_radius = 0.2; // tube radius GLfloat p0[3] = {0,0,0}; GLfloat p1[3] = {0,1,0}; theLine.type = LINE; float l1 = 1.0; float l2 = 0.75; float l3 = 0.50; switch(vert->type) { case HOUSE: make_house(vert);break; case SPHERE: make_sphere(vert, ray); break; case CYLINDER: make_cylinder(vert, ray, height); break; case CONE: make_cone(vert, height, ray); break; case TORUS: make_torus(vert,torus_radius, tube_radius); break; case CUBE: make_cube_smart(vert, 2); break; case LINE: make_line(vert, p0, p1); case SUPER: make_quadric(vert, l1, l2, l3); } }
void make_nozzle(NOZZLE* noz, double ray, double height){ SHAPE cyl; noz->Shape = cyl; make_cylinder(&(noz->Shape),ray,height); }
void make_nozzle(NOZZLE* noz, double ray, double height, int id){ SHAPE cyl; make_cylinder(&cyl, ray, height); noz->shape = cyl; noz->cur_firework = 0; // at position 0 in the fireworks array noz->nozzle_id = id; // set the nozzle id // TODO -- set the array of fireworks that are in the nozzle }
/*TODO add make_cone, make_torus, make_your_shape etc. */ void my_setup(){ crt_render_mode = GL_POLYGON;//GL_LINE_LOOP; crt_shape = HOUSE; crt_transform = NONE_MODE; crt_rs = 20; crt_vs = 10; make_cube_smart(1); make_cylinder(cyl_height,cyl_ray,crt_rs,crt_vs); make_sphere(sph_ray,crt_rs,crt_vs); return; }
/*TODO EC: add make_torus etc. */ void my_setup(void) { theta_x = 0; theta_y = 0; crt_render_mode = GL_LINE_LOOP; crt_shape = HOUSE; crt_rs = 20; crt_vs = 10; make_cylinder(cyl_height,cyl_ray,crt_rs,crt_vs); make_sphere(sph_ray,crt_rs,crt_vs); //add make_torus etc... return; }
/* virtual */ void cylinder::do_changed(field::base& f) { TRACE("scene::primitive::cylinder::do_changed"); if (&f == &sides) { make_cylinder(*sides, attribute_list_, index_list_); compute_bounds(); compute_tangents(); } else { node::geometry::do_changed(f); } }