Open passionate-code opened 1 year ago
The atom coordinates in the Structure
(component.structure
) aren't changed - the component matrix is applied later in the pipeline.
The Structure
class does have an updatePosition
method, so you could apply your transform (you have to calculate the new coordinates yourself) and then save.
Not tested:
/* Transform by 1.0 each in x, y, and z */
const dx = 1.0
const dy = 1.0
const dz = 1.0
const atomCount = component.structure.atomCount
const newCoords = new Float32Array(atomCount * 3)
component.structure.eachAtom(ap => {
newCoords[i ++] = ap.x + dx
newCoords[i ++] = ap.y + dy
newCoords[i ++] = ap.z + dz
})
component.structure.updatePosition(newCoords)
const data = new NGL.PDbWriter(component.structure).getString()
Is there a method to apply the transformation matrix on the individual coordinates? I believe setTransform() can only be applied on component?
I believe there is a similar issue (#794) like mine but in my case the coordinates transformed through .setTransform() method is not parsed by the .PdbWriter().
Here is my sample code:
However the coordinates that I have retrieved are untransformed coordinated as it is similar like coordinates in the loaded file. Any pointer would be appreciated. Thank you.