The name of the initial branch for new projects is now "main" instead of "master". Existing projects remain unchanged. More information: https://doku.lrz.de/display/PUBLIC/GitLab

Commit 54a9b8de authored by schultezub's avatar schultezub
Browse files

completed X-to-Y matrices in ImageMappingInformation

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@299 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 4ac72d51
......@@ -28,6 +28,8 @@
#include "imagemappinginformation.h"
#include "tgt/assert.h"
namespace TUMVis {
ImageMappingInformation::ImageMappingInformation(const tgt::vec3& size, const tgt::vec3& offset, const tgt::vec3& voxelSize, const LinearMapping<float>& realWorldValueMapping /*= LinearMapping<float>::identity*/)
......@@ -57,10 +59,28 @@ namespace TUMVis {
void ImageMappingInformation::updateMatrixes() {
_textureToWolrdTransformation = tgt::mat4::createTranslation(_offset) * tgt::mat4::createScale(_voxelSize * _size);
if (! _textureToWolrdTransformation.invert(_worldToTextureTransformation))
tgtAssert(false, "Could not invert texture-to-world matrix. That should not happen!");
_voxelToWorldTransformation = tgt::mat4::createTranslation(_offset) * tgt::mat4::createScale(_voxelSize);
if (! _voxelToWorldTransformation.invert(_worldToVoxelTransformation))
tgtAssert(false, "Could not invert voxel-to-world matrix. That should not happen!");
}
const tgt::mat4& ImageMappingInformation::getTextureToWorldMatrix() const {
return _textureToWolrdTransformation;
}
const tgt::mat4& ImageMappingInformation::getWorldToTextureMatrix() const {
return _worldToTextureTransformation;
}
const tgt::mat4& ImageMappingInformation::getVoxelToWorldMatrix() const {
return _voxelToWorldTransformation;
}
const tgt::mat4& ImageMappingInformation::getWorldToVoxelMatrix() const {
return _worldToVoxelTransformation;
}
}
......@@ -74,6 +74,24 @@ namespace TUMVis {
*/
const tgt::mat4& getTextureToWorldMatrix() const;
/**
* Gets the transformation matrix from world to texture coordinates.
* \return _worldToTextureTransformation
*/
const tgt::mat4& getWorldToTextureMatrix() const;
/**
* Gets the transformation matrix from voxel to world coordinates.
* \return _voxelToWorldTransformation
*/
const tgt::mat4& getVoxelToWorldMatrix() const;
/**
* Gets the transformation matrix from world to voxel coordinates.
* \return _worldToVoxelTransformation
*/
const tgt::mat4& getWorldToVoxelMatrix() const;
/**
* Get the real world value mapping.
* \return Linear mapping for mapping element values to real world values.
......@@ -97,9 +115,12 @@ namespace TUMVis {
tgt::vec3 _voxelSize; ///< Voxel size in (mm)
LinearMapping<float> _realWorldValueMapping; ///< Linear mapping for mapping element values to real world values
tgt::mat4 _textureToWolrdTransformation; ///< Transformation matrix from texture to world coordinates
tgt::mat4 _worldToTextureTransformation; ///< Transformation matrix from world to texture coordinates
static const std::string loggerCat_;
tgt::mat4 _voxelToWorldTransformation; ///< Transformation matrix from voxel to world coordinates
tgt::mat4 _worldToVoxelTransformation; ///< Transformation matrix from world to voxel coordinates
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment