本文整理汇总了C++中TView::RotateView方法的典型用法代码示例。如果您正苦于以下问题:C++ TView::RotateView方法的具体用法?C++ TView::RotateView怎么用?C++ TView::RotateView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TView
的用法示例。
在下文中一共展示了TView::RotateView方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sphere
void sphere()
{
/********************/
/*Mpi initialization*/
/********************/
ROOT::Mpi::TEnvironment env(gApplication->Argc(), gApplication->Argv());
ROOT::Mpi::TIntraCommunicator world;
/*********************************/
/*Error control, need 4 processes*/
/*********************************/
if(world.Size()!=4)
{
std::cout<<"Error: You need run with 4 processes exactly, the sphere was spplitted in four regions. \nExample: mpirun -np 4 root -l sphere.C\n";
std::cout.flush();
world.Abort(ROOT::Mpi::ERR_SIZE);
}
/*********************************************************************/
/*Section to calculate volume with parallel multimensional integrator*/
/*********************************************************************/
//integrator creation root's style
ROOT::Math::Functor1D function(&sphere_function);
ROOT::Math::Integrator integrator;
integrator.SetFunction(function);
//Mpi's integrator wrapper, integrator from ROOT in one dimension
ROOT::Mpi::Math::TIntegratorWrapper MpiIntegrator(&integrator);
//integrate in parallel and send the result to rank zero, intervar [0,radius]
MpiIntegrator.Integrate(0, 0, radius);
/*****************************************************************************************/
/*this is the root process,calculate the surface z=+qsrt(1−(x2+b2)) for x∈[−1,0],y∈[−1,1]*/
/*and recv the other surface regions in TPolyMarker3D object from others ranks */
/*****************************************************************************************/
if (world.Rank() == 0) {
gBenchmark->Start("sphere");
// create and open a canvas
TCanvas *canvas = new TCanvas("sphere", "sphere", 300, 10, 700, 500);
canvas->SetFillColor(14);
// creating view
TView *view = TView::CreateView(1, 0, 0);
view->RotateView(90,-10);
view->SetRange(-radius*2, -radius*2, -2*radius, 2*radius, 2*radius, 2*radius);
// create a PolyMarker3D for region/segment 1 calculate in rank 0(this rank)
TPolyMarker3D *surfaceSeg13d = new TPolyMarker3D();
for (theta = 0; theta <0.5*M_PI ; theta+= delta) {
for (phi = 0; phi <M_PI; phi += delta) {
x=radius*cos(theta)*sin(phi);
y=radius*sin(theta)*sin(phi);
z=radius*cos(phi);
// set points
surfaceSeg13d->SetPoint(point, x, y, z);
point++;
}
}
// set marker size, color & style
surfaceSeg13d->SetMarkerSize(1);
surfaceSeg13d->SetMarkerColor(world.Rank() + world.Size());
surfaceSeg13d->SetMarkerStyle(1);
//drawing region 1
surfaceSeg13d->Draw();
//getting region 2 from rank 1
TPolyMarker3D *surfaceSeg23d = new TPolyMarker3D;
world.RecvObject(1, 1, *surfaceSeg23d);
surfaceSeg23d->Draw();
//getting region 3 from rank 2
TPolyMarker3D *surfaceSeg33d = new TPolyMarker3D;
world.RecvObject(2, 1, *surfaceSeg33d);
surfaceSeg33d->Draw();
//getting region 4 from rank 3
TPolyMarker3D *surfaceSeg43d = new TPolyMarker3D;
world.RecvObject(3, 1, *surfaceSeg43d);
surfaceSeg43d->Draw();
Char_t timeStr[60];
Char_t pointsStr[100];
Char_t radiusStr[100];
Char_t deltaStr[100];
gBenchmark->Show("sphere");
Float_t ct = gBenchmark->GetCpuTime("sphere");
sprintf(timeStr, "Execution time: %g sec.", ct);
sprintf(radiusStr, "Radius : %g", radius);
sprintf(deltaStr, "Delta : %g", delta);
sprintf(pointsStr, "Total surface points : %g", point*4);
TPaveText *text = new TPaveText(0.1, 0.6, 0.9, 0.99);
text->SetFillColor(42);
text->AddText("ROOTMpi example: sphere.C");
text->AddText(timeStr);
text->AddText(radiusStr);
//.........这里部分代码省略.........