Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

249
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda