Commit c1dacace authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[REMOVE] - removed all occurances of the old WMatrix4x4 and the old eigen based 4x4 matrix.

parent a549d0d6
......@@ -44,9 +44,10 @@
#include <boost/lexical_cast.hpp>
#include "math/WPosition.h"
#include "math/WMatrix.h"
#include "math/linearAlgebra/WMatrix.h"
#include "WItemSelector.h"
#include "WColor.h"
#include "WAssert.h"
template < typename T >
class WPropertyVariable;
......@@ -109,7 +110,7 @@ namespace WPVBaseTypes
typedef WItemSelector PV_SELECTION; //!< base type used for every WPVSelection
typedef WPosition PV_POSITION; //!< base type used for every WPVPosition
typedef WColor PV_COLOR; //!< base type used for every WPVColor
typedef WMatrix4x4_2 PV_MATRIX4X4; //!< base type used for every WPVMatrix4X4
typedef WMatrix4d_2 PV_MATRIX4X4; //!< base type used for every WPVMatrix4X4
/**
* Enum denoting the possible trigger states. It is used for trigger properties.
......@@ -552,7 +553,7 @@ namespace PROPERTY_TYPE_HELPER
*/
WPVBaseTypes::PV_MATRIX4X4 create( const WPVBaseTypes::PV_MATRIX4X4& /*old*/, const std::string str )
{
WMatrix4x4_2 c;
WMatrix4d_2 c;
std::vector< std::string > tokens;
tokens = string_utils::tokenize( str, ";" );
WAssert( tokens.size() >= 16, "There weren't 16 values for a 4x4 Matrix" );
......
......@@ -27,6 +27,7 @@
#include "../WExportCommon.h"
#include "WMatrix.h"
#include "linearAlgebra/WMatrix.h"
namespace osg
{
......
......@@ -31,81 +31,10 @@
#include "WValue.h"
#include "WVector3D.h"
#include "linearAlgebra/WMatrix.h"
#include "../WDefines.h"
#define EIGEN_DONT_ALIGN_STATICALLY
#include "../../ext/Eigen/Core"
#include "../../ext/Eigen/LU"
/**
* A double 3 times 3 matrix. Stack-allocated. Column Major!
*
* Column Major indexes:
* [0 3 6
* 1 4 7
* 2 5 8]
* If you want to access coefficients using the operator( size_t, size_t ), the first parameter is still the row index, starting with 0.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef Eigen::Matrix< double, 3, 3 > WMatrix3x3_2;
/**
* A double 4 times 4 matrix. Stack-allocated. Column Major!
*
* Column Major indexes:
* [0 4 8 12
* 1 5 9 13
* 2 6 10 14
* 3 7 11 15]
* If you want to access coefficients using the operator( size_t, size_t ), the first parameter is still the row index, starting with 0.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef Eigen::Matrix< double, 4, 4 > WMatrix4x4_2;
/**
* A double matrix of dynamic size. Heap-allocated. Column Major!
* If you want to access coefficients using the operator( size_t, size_t ), the first parameter is still the row index, starting with 0.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef Eigen::MatrixXd WMatrix_2;
/**
* A complex double matrix of dynamic size. Heap-allocated.
* If you want to access coefficients using the operator( size_t, size_t ), the first parameter is still the row index, starting with 0.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef Eigen::MatrixXcd WMatrixComplex_2;
/**
* Converts a given WMatrix4x4_2 to an osg matrix.
*
* \param m the matrix to convert
*
* \return the converted matrix
*/
inline osg::Matrixd toOsgMatrixd( WMatrix4x4_2 m )
{
osg::Matrixd m2;
for ( size_t row = 0; row < 4; ++row )
{
for ( size_t col = 0; col < 4; ++col )
{
m2( row, col ) = m( row, col );
}
}
return m2;
}
/**
* Matrix template class with variable number of rows and columns.
* The access function are row-major, which means that the rows
......@@ -142,7 +71,7 @@ public:
*
* \param newMatrix the matrix to copy
*/
WMatrix( const WMatrix4x4_2& newMatrix ); // NOLINT
WMatrix( const WMatrix4d_2& newMatrix ); // NOLINT
/**
* Makes the matrix contain the identity matrix, i.e. 1 on the diagonal.
......@@ -180,7 +109,7 @@ public:
*
* \return casted matrix
*/
operator WMatrix4x4_2() const;
operator WMatrix4d_2() const;
/**
* Compares two matrices and returns true if they are equal.
......@@ -250,7 +179,7 @@ template< typename T > WMatrix< T >::WMatrix( const WMatrix& newMatrix )
m_nbCols = newMatrix.m_nbCols;
}
template< typename T > WMatrix< T >::WMatrix( const WMatrix4x4_2& newMatrix )
template< typename T > WMatrix< T >::WMatrix( const WMatrix4d_2& newMatrix )
: WValue< T >( 4 * 4 )
{
m_nbCols = 4;
......@@ -263,11 +192,11 @@ template< typename T > WMatrix< T >::WMatrix( const WMatrix4x4_2& newMatrix )
}
}
template< typename T > WMatrix< T >::operator WMatrix4x4_2() const
template< typename T > WMatrix< T >::operator WMatrix4d_2() const
{
size_t nbRows = this->size() / m_nbCols;
WAssert( m_nbCols == 4 && nbRows == 4, "This is no 4x4 matrix." );
WMatrix4x4_2 m;
WMatrix4d_2 m;
for( size_t i = 0; i < nbRows; ++i )
{
for( size_t j = 0; j < m_nbCols; ++j )
......
......@@ -30,6 +30,7 @@
#include "../WExportCommon.h"
#include "WMath.h"
#include "WMatrix.h"
#include "linearAlgebra/WMatrix.h"
#include "WUnitSphereCoordinates.h"
#include "WVector3D.h"
......
......@@ -5,6 +5,8 @@ IF( OW_COMPILE_TESTS )
CXXTEST_ADD_TESTS_FROM_LIST( "${LINALG_SRC}"
"OWcommon"
"WMatrix" # only header
"WPosition" # is a WMatrixFixed. Gets tested there
"WVector3D" # is a WMatrixFixed. Gets tested there
)
ENDIF( OW_COMPILE_TESTS )
......@@ -22,9 +22,12 @@
//
//---------------------------------------------------------------------------
#ifndef WMATRIX_H
#define WMATRIX_H
#ifndef WMATRIXALL_H
#define WMATRIXALL_H
#include "WMatrixFixed.h"
#include "WMatrixConversions.h"
#endif
#include "WMatrixEigen.h"
#endif // WMATRIXALL_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WMATRIXCONVERSIONS_H
#define WMATRIXCONVERSIONS_H
#include <osg/Matrix>
/**
* Converts a given WMatrix4d_2 to an osg matrix.
*
* \param m the matrix to convert
*
* \return the converted matrix
*/
inline osg::Matrixd toOsgMatrixd( WMatrix4d_2 m )
{
osg::Matrixd m2;
for ( size_t row = 0; row < 4; ++row )
{
for ( size_t col = 0; col < 4; ++col )
{
m2( row, col ) = m( row, col );
}
}
return m2;
}
#endif // WMATRIXCONVERSIONS_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WMATRIXEIGEN_H
#define WMATRIXEIGEN_H
#define EIGEN_DONT_ALIGN_STATICALLY
#include "../../../ext/Eigen/Core"
#include "../../../ext/Eigen/LU"
/**
* A double matrix of dynamic size. Heap-allocated.
* If you want to access coefficients using the operator( size_t, size_t ), the first parameter is still the row index, starting with 0.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef Eigen::MatrixXd WMatrix_2;
/**
* A complex double matrix of dynamic size. Heap-allocated.
* If you want to access coefficients using the operator( size_t, size_t ), the first parameter is still the row index, starting with 0.
*
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html
* \see http://eigen.tuxfamily.org/dox/classEigen_1_1MatrixBase.html
*/
typedef Eigen::MatrixXcd WMatrixComplex_2;
#endif // WMATRIXEIGEN_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WPosition.h"
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WPOSITION_H
#define WPOSITION_H
#include "WVector3D.h"
/**
* \class WPosition
* The file %WPosition.h just includes %WVector3D.h.
* There is "typedef WVector3D WPosition;" in %WVector3D.h.
* WPosition such is just another name for WVector3D to indicate the specific use
* for positions in some places.
*/
#endif // WPOSITION_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WVector3D.h"
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WVECTOR3D_H
#define WVECTOR3D_H
// defined in WMatrixFixed
#include "WMatrixFixed.h"
#endif // WVECTOR3D_H
......@@ -32,6 +32,7 @@
#include "../../WException.h"
#include "../WLinearAlgebraFunctions.h"
#include "../WMatrix.h"
#include "../linearAlgebra/WMatrix.h"
#include "../WVector3D.h"
#include "WVector3DTraits.h"
......
......@@ -39,6 +39,7 @@
#include <cxxtest/TestSuite.h>
#include "../WMatrix.h"
#include "../linearAlgebra/WMatrix.h"
#include "../WValue.h"
#include "../WVector3D.h"
......
......@@ -22,7 +22,7 @@
//
//---------------------------------------------------------------------------
#include "../common/math/WMatrix.h"
#include "../common/math/linearAlgebra/WMatrix.h"
#include "WValueSet.h"
......@@ -49,19 +49,19 @@ WDataTexture3D_2::WDataTexture3D_2( boost::shared_ptr< WValueSetBase > valueSet,
threshold()->set( valueSet->getMinimumValue() );
// Scale according to bbox. This scaling is NOT included in the grid's transform, so we need to add it here
WMatrix4x4_2 scale = WMatrix4x4_2::Zero();
WMatrix4d_2 scale = WMatrix4d_2::zero();
scale( 0, 0 ) = 1.0 / grid->getNbCoordsX();
scale( 1, 1 ) = 1.0 / grid->getNbCoordsY();
scale( 2, 2 ) = 1.0 / grid->getNbCoordsZ();
scale( 3, 3 ) = 1.0;
// Move to voxel center. This scaling is NOT included in the grid's transform, so we need to add it here
WMatrix4x4_2 offset = WMatrix4x4_2::Identity();
WMatrix4d_2 offset = WMatrix4d_2::identity();
offset( 0, 3 ) = 0.5 / grid->getNbCoordsX();
offset( 1, 3 ) = 0.5 / grid->getNbCoordsY();
offset( 2, 3 ) = 0.5 / grid->getNbCoordsZ();
transformation()->set( offset * scale * static_cast< WMatrix4x4_2 >( grid->getTransform() ).inverse() );
transformation()->set( offset * scale * invert( static_cast< WMatrix4d_2 >( grid->getTransform() ) ) );
// set the size
WGETexture3D::initTextureSize( this, grid->getNbCoordsX(), grid->getNbCoordsY(), grid->getNbCoordsZ() );
......
......@@ -31,8 +31,9 @@
#include "../common/math/WLinearAlgebraFunctions.h"
#include "../common/WBoundingBox.h"
#include "../common/WProperties.h"
#include "WGridRegular3D.h"
#include "../common/math/linearAlgebra/WMatrix.h"
#include "WGridRegular3D.h"
WGridRegular3D::WGridRegular3D( unsigned int nbPosX, unsigned int nbPosY, unsigned int nbPosZ,
WGridTransformOrtho const transform )
......@@ -118,7 +119,7 @@ void WGridRegular3D::initInformationProperties()
WPropDouble yOffset = m_infoProperties->addProperty( "Y offset: ", "The distance between samples in y direction", getOffsetY() );
WPropDouble zOffset = m_infoProperties->addProperty( "Z offset: ", "The distance between samples in z direction", getOffsetZ() );
WPropMatrix4X4 transformation = m_infoProperties->addProperty( "Transformation", "The transformation of this grid.",
static_cast< WMatrix4x4_2 >( getTransform() ) );
static_cast< WMatrix4d_2 >( getTransform() ) );
}
int WGridRegular3D::getXVoxelCoord( const WPosition& pos ) const
......
......@@ -34,7 +34,6 @@
#include <osg/Matrix>
#include <osg/Vec3>
#include "../common/math/WMatrix.h"
#include "../common/math/WMatrix.h"
#include "../common/math/WPosition.h"
#include "../common/math/WVector3D.h"
......
......@@ -184,9 +184,9 @@ bool WGridTransformOrtho::isNotRotated() const
&& m_directionZ == WVector3D( 0.0, 0.0, 1.0 );
}
WGridTransformOrtho::operator WMatrix4x4_2() const
WGridTransformOrtho::operator WMatrix4d_2() const
{
WMatrix4x4_2 mat = WMatrix4x4_2::Identity();
WMatrix4d_2 mat = WMatrix4d_2::identity();
mat( 0, 0 ) = m_scaling[ 0 ] * m_directionX[ 0 ];
mat( 0, 1 ) = m_scaling[ 0 ] * m_directionX[ 1 ];
mat( 0, 2 ) = m_scaling[ 0 ] * m_directionX[ 2 ];
......
......@@ -27,7 +27,7 @@
#include "../common/math/WVector3D.h"
#include "../common/math/WMatrix.h"
#include "../common/math/WMatrix.h"
#include "../common/math/linearAlgebra/WMatrix.h"
#include "WExportDataHandler.h"
......@@ -160,7 +160,7 @@ public:
*
* \return the matrix representing the transform
*/
operator WMatrix4x4_2() const;
operator WMatrix4d_2() const;
/**
* Check if this transform does not include a rotation.
......
......@@ -108,10 +108,10 @@ boost::shared_ptr< WGEColormapping > WGEColormapping::instance()
void WGEColormapping::apply( osg::ref_ptr< osg::Node > node, osg::ref_ptr< WGEShader > shader, size_t startTexUnit )
{
instance()->applyInst( node, WMatrix4x4_2( WMatrix4x4_2::Identity() ), shader, startTexUnit );
instance()->applyInst( node, WMatrix4d_2( WMatrix4d_2::identity() ), shader, startTexUnit );
}
void WGEColormapping::apply( osg::ref_ptr< osg::Node > node, WMatrix4x4_2 preTransform, osg::ref_ptr< WGEShader > shader,
void WGEColormapping::apply( osg::ref_ptr< osg::Node > node, WMatrix4d_2 preTransform, osg::ref_ptr< WGEShader > shader,
size_t startTexUnit )
{
instance()->applyInst( node, preTransform, shader, startTexUnit );
......@@ -133,7 +133,7 @@ void WGEColormapping::replaceTexture( osg::ref_ptr< WGETexture3D > old, osg::ref
instance()->replaceTextureInst( old, newTex, name );
}
void WGEColormapping::applyInst( osg::ref_ptr< osg::Node > node, WMatrix4x4_2 preTransform, osg::ref_ptr< WGEShader > shader,
void WGEColormapping::applyInst( osg::ref_ptr< osg::Node > node, WMatrix4d_2 preTransform, osg::ref_ptr< WGEShader > shader,
size_t startTexUnit )
{
// applying to a node simply means adding a callback :-)
......
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