Javi-r
(Javi R)
1
I want to move, rotate and scale a stl using vtk.js
I only want to view it, not apply the transformation to the stl.
How can I do this?
const reader = vtkSTLReader.newInstance();
reader.setUrl("file.stl", { binary: true }).then(()=>{
const polydata = reader.getOutputData();
//escale, rotate, move polydata
});
finetjul
(Julien Finet)
2
You can set a userMatrix
onto the actor.
To build such matrix, you can use the vtkMatrixBuilder convenient class.
Javi-r
(Javi R)
3
how can I align the stl with a vector as if it were a cylinder ?
const cylinder = vtkCylinderSource.newInstance();
cylinder.setDirectionFrom(vector);
finetjul
(Julien Finet)
4
actor.setUserMatrix(
vtkMatrixBuilder.buildFromDegree().rotateFromDirections([0, 0, 1], vector).getMatrix());
or something like that