0

We have a 3D image composed of a nii volume and several obj meshes. We want to clip it to expose partial image. The viewpoint option at http://www.usc.edu/programs/face/3Dmodel/C57BL6-E185.html is the target. Is it possible to do in XTK?

mei
  • 67
  • 9
  • If I switch XTK to use orthographic projection, the zoom in/out events clip the image as required. But switching to orthographic projection as suggested in http://stackoverflow.com/questions/24495161/othographic-projection-in-xtk flatten the cube in http://lessons.goxtk.com/00/ – mei Aug 09 '15 at 15:57

1 Answers1

0

I have figured out how to do this. In camera3D.js, on the call to create _perspective matrix,

X.matrix.makePerspective(X.matrix.identity(), this._fieldOfView, (width/height), 1, 10000);

adjust the 4th parameter (near) to introduce a clip view plane.

If want to use Orthographic projection, in order to unflatten the cube in example 00, (4th parameter is also the 'near' parameter)

X.matrix.makeOrtho(X.matrix.identity(), -(width/2), (width/2), -(height/2), (height/2), 1, 10000);

(there is also a _perspective creation call in renderer.js)

It would be great if there is a way in XTK to have an easy access to adjust that parameter on the fly but for now I will embed a handle to it.

mei
  • 67
  • 9