next up previous contents index
Next: Keyfile Parameters Up: Advanced Primitives Previous: Extrusion

Revolution

   
object new_revolution(int x_res, int y_res, int z_res,
		      double t_min, double t_max,
		      double (*func)(double tval), int stop_at_first);

The surface is constructed in the region defined by X, Y and Z from 0 to 1. x_res, y_res and z_res define the resolution in the three dimensions. A new_revolution primitive requires a function specified by the user in the form double my_func(double tval). The value of the function returns the diameter of the surface of revolution and should range from 0 to 1. The axis of rotation is parallel to the Z axis at X= 1/2, Y= 1/2. The function is sampled from t_min at Z= 0 to t_max at Z=1. The stop_at_first parameter defines whether or not to stop at the first intersection with the object. If this is TRUE then the object will ray trace faster but it must be set to FALSE if parts of the volume are to be subtracted as the object will otherwise not ray trace correctly.

 figure637
Figure 31: The Revolution Primitive

  // Add a new_revolution.
  the_object = new_revolution(150, 150, 150, -PI/2.0, PI/2.0, 
                              cos, TRUE);
  the_object->material = white;
  LINK(the_scene, PLUS, bind(the_object));
 



Sophie Day
Fri Feb 20 15:47:19 NZDT 1998