I am working on program which builds molecule from scratch. My intention is to use vtkMolecule
for it. However, while it is easy to add Atom to molecule by AppendAtom
method, there seems to be no function for removal.
Here is my code:
int main(int, char *[]) {
vtkSmartPointer<vtkMolecule> molecule =
vtkSmartPointer<vtkMolecule>::New();
molecule->AppendAtom(12, 0.0, 0.0, 0.0);
molecule->AppendAtom(12, 1.0, 1.0, 1.0);
molecule->AppendAtom(12, 2.0, 2.0, 2.0);
molecule->AppendBond(molecule->GetAtom(0), molecule->GetAtom(1), 1);
molecule->AppendBond(molecule->GetAtom(1), molecule->GetAtom(2), 1);
//hypothetical code, I want something like this - remove atom by id:
molecule->RemoveAtom(2)
vtkSmartPointer<vtkMoleculeMapper> moleculeMapper =
vtkSmartPointer<vtkMoleculeMapper>::New();
moleculeMapper->SetInputData(molecule);
//...rendering etc.
}
I was thinking of some vtkGraph
method like vtkGraph::RemoveVertexInternal
, but it is (probably for some reason) protected and therefore not usable in child of child class.
My question is:
Is there a simple way to delete atom from molecule other than creating child class of vtkMolecule
with specialized method?
Thank you in advance.