#include <View.H> // openGL display defined here. #include <TensorBlossom.H> // Bsplines defined here. using namespace xchen; void volume_torus(View* v) { typedef TensorBlossom<1,2> CrvBspType; // A dimension 1 manifold in E2: plannar Bspline Curve type. typedef TensorBlossom<2,4> SrfBspType; // A dimension 2 manifold in E4, or P3 if rational tag is set. typedef TensorBlossom<3,4> VolBspType; // A dimension 3 manifold in E4, or P3 if rational tag is set. CrvBspType *radius = new CrvBspType(1,2); // A planar curve of degree 1, control point size 2. radius->ControlMesh() = E2(0.0), E2(1.); SrfBspType *dis = new SrfBspType(revolution, radius); // Revolution of the radius around y-axis: a disk in xz plane. *dis = tX(1.5) * ( rX(-90) * (*dis)); // Rotate disk to xy plane, and move disk center to (1.5, 0, 0). VolBspType *vtorus = new VolBspType(revolution, dis); // Revolution around y-axis again: the volume torus we want. cout << "Volumen Torus is\n" << *vtorus << endl; // Print the volume bspline we have made. new glModel(v, vtorus); // New an openGL model from the torus in order to display and interact with it. } void new_glModel(View* v) // Override this routine in the dynamic library to put the model in the view. { volume_torus(v); }
1.2.18