3

C ++でVTKを使用し、分子を3Dでプロットしたいと思います。原子の位置を表すベクトルと、各原子のサイズを表す別のベクトルがあります。どうすればこれを行うことができますか?アトムごとに新しいsphere_sourceを作成する必要がありますか?

vector< vector <double> > Positions;
vector< double > Sizes;
4

2 に答える 2

5

vtkGlyph3Dとこの例を見てください: http ://www.vtk.org/Wiki/VTK/Examples/Cxx/Filtering/Glyph3D ただし、原子のサイズごとに個別の球体ソースが必要になります。同じサイズのすべての原子は次のことができます。同じ球体ソースを使用してください...

于 2013-01-07T18:39:46.127 に答える
1
void VTK_Plotter::Add_Point(vector<double> Position, double Size)
{

    Size = floor((log10(Size) + 0.2) * 100.0) / 100.0;

    vtkSmartPointer<vtkSphereSource> Current_Sphere_Source;
    // Different atomi number have different set of points
    vtkSmartPointer<vtkPoints> Current_Point_Group;
    // If the point has a size not in the list create a new sphere source with different size
    if (Table_Size_Source.find(Size) == Table_Size_Source.end()) {
        // Create new source
        Current_Sphere_Source = vtkSmartPointer<vtkSphereSource>::New();
        Current_Sphere_Source->SetRadius(Size);
        Table_Size_Source[Size] = Current_Sphere_Source;
        // Create new points
        Current_Point_Group = vtkSmartPointer<vtkPoints>::New();
        Table_Points_VTK[Size] = Current_Point_Group;
    }
    else
    {
        Current_Sphere_Source = Table_Size_Source[Size];
        Current_Point_Group = Table_Points_VTK[Size];
    }
}
于 2013-01-07T22:56:08.707 に答える