Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

250
Visualizações
How to rotate an object in VTK.js

I am trying to create a slider that rotates a 3D Volumes using the vtk.js api

I have already implemented sliders to move the object along the x,y,z axes, which looks like this:

  changePosition({ activeLayer, value, coord }) {
        const currentPosition = api.volumes[activeLayer].getPosition()

        switch (coord) {
          case coord = 'X':
            api.volumes[layer].setPosition(
              value,
              currentPosition[1],
              currentPosition[2])
            break;
          case coord = 'Y':
            api.volumes[layer].setPosition(
              currentPosition[0],
              value,
              currentPosition[2])
            break;
          case coord = 'Z':
            api.volumes[layer].setPosition(
              currentPosition[0],
              currentPosition[1],
              value)
            break;
          default:
            break;
        }
        
        const renderWindow = api.genericRenderWindow.getRenderWindow();
        renderWindow.render()
    },

VTK.js also offers another 2 methods similar to getPosition and setPosition called getOrientation and setOrientation

So one would assume this would work:

    changeOrientation({ activeLayer, value, coord }) {
        const currentOrientation = api.volumes[activeLayer].getOrientation()

        switch (coord) {
          case coord = 'X':
            api.volumes[layer].setOrientation(
              value,
              currentOrientation[1],
              currentOrientation[2])
            break;
          case coord = 'Y':
            api.volumes[layer].setOrientation(
              currentOrientation[0],
              value,
              currentOrientation[2])
            break;
          case coord = 'Z':
            api.volumes[layer].setOrientation(
              currentOrientation[0],
              currentOrientation[1],
              value)
            break;
          default:
            break;
        }

        const renderWindow = api.genericRenderWindow.getRenderWindow();
        renderWindow.render()
      })
    },

Yet getOrientation returns [undefined] (note the brackets), and setOrientation returns: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'forEach')

I've been stuck on this for a few days now, thanks for any help it is much appreciated

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda