0

Is there a way I could translate a volume in the scene? I tried to apply matrix translation to each slice with X.matrix.translation but it didn't work.

JPOV
  • 23
  • 3

1 Answers1

0

In general, you shouldn't move the volume.

You could:

1- Move the camera:

renderer.camera.position = [-400, 0, 0];
renderer.camera.up = [0, 0, 1];

http://jsfiddle.net/gh/get/toolkit/edge/xtk/lessons/tree/master/17/#run

2- Move the other objects in the scene

  object.transform.translateX(-30);

http://jsfiddle.net/gh/get/toolkit/edge/xtk/lessons/tree/master/02/#run

What are you trying to achieve?

Nicolas
  • 2,191
  • 3
  • 29
  • 49
  • Hi Nicolas. I've tried both options, in fact, translating the objects is what I'm applying. I using Xtk to load some DICOM files and make a widget to measure distances in the slices of the volume; A couple of spheres are moved along the surface of the planes. Some volumes are centered in the coordinate system: others are not. If I use `resetBoundingBox` in the case the volume is not centered, it will be displayed translated from the origin. The issue is that translating the other objects are making difficult to calculate the motion of the spheres in the plane. – JPOV Sep 24 '13 at 00:40
  • Try creating the sphere at the right location rather than translating it: (even though it should work :/) Once the volume is loaded, if the position of the spheres are relative to (0, 0, 0) (= centered volume), you could directly create the sphere at the right location, using the volume center as offset: [see here](http://stackoverflow.com/questions/18576524/wrong-volume-bounding-box/18596198#18596198) Hope this helps – Nicolas Oct 17 '13 at 12:39
  • That's what I did: using the volume center offset as reference to locate objects in the scene. For the calculations, I just subtracted the offset and later I added it to the object coordinates so It can be located in the right position. – JPOV Oct 17 '13 at 20:59