#include <View.H>
#include <TensorBlossom.H>
using namespace xchen;
void bsp_torus(View* v)
{
TensorBlossom<1,4> *circle = new TensorBlossom<1,4>(2,8);
double w = sqrt(2.0) / 2;
E4 p(1, 0, 0, 1);
circle->ControlMesh() =
tX(2.0)*p,
(tX(2.0*w)*(rZ(45)*p)).Szw(w),
tX(2.0)*(rZ(90)*p),
(tX(2.0*w)*(rZ(135)*p)).Szw(w),
tX(2.0)*(rZ(180)*p),
(tX(2.0*w)*(rZ(225)*p)).Szw(w),
tX(2.0)*(rZ(270)*p),
(tX(2.0*w)*(rZ(315)*p)).Szw(w);
circle->IsRational() = true;
circle->SetPeriodicEnd();
circle->KnotVector() = 0.,0, 1, 1, 2, 2, 3, 3, 4;
cout << "\n________________________________________________________________________________________________________________________";
cout << "\nCircle is \n" << *circle << endl;
new glModel(v, circle);
}
void new_glModel(View* v)
{
bsp_torus(v);
}