Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize > Struct Template Reference

this class implements matrix common member More...

#include <glsl_math.h>

Inheritance diagram for gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >:

Inheritance graph
[legend]
Collaboration diagram for gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef tuple_mixin< SubClass,
RowSize *ColumnSize > 
TupleMixin

Public Member Functions

SubClass & operator *= (value_type v)
SubClass operator * (value_type v) const
SubClass & operator/= (value_type v)
SubClass operator/ (value_type v) const
FriendVector & operator[] (size_type nthColumn)
 get nthColumn column vector's reference

const FriendVector & operator[] (size_type nthColumn) const
 get nthColumn column vector's const reference

SubClass operator * (const SubClass &other) const
SubClass & operator *= (const SubClass &other)
FriendVector operator * (const FriendVector &v)
 multiply with column vector ( Right Hand System, OpenGL )


Static Public Member Functions

size_type columnSize ()
size_type rowSize ()

Friends

FriendVector operator * (const FriendVector &v, const SubClass &other)
 multiply with column vector ( Left Hand Syste, DirectX )


Detailed Description

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
struct gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >

this class implements matrix common member

Definition at line 437 of file glsl_math.h.


Member Typedef Documentation

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
typedef tuple_mixin< SubClass, RowSize * ColumnSize > gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::TupleMixin
 

Definition at line 438 of file glsl_math.h.


Member Function Documentation

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
size_type gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::columnSize  )  [inline, static]
 

Definition at line 501 of file glsl_math.h.

00501                                           {
00502                 return ColumnSize;
00503             }

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
FriendVector gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::operator * const FriendVector &  v  )  [inline]
 

multiply with column vector ( Right Hand System, OpenGL )

Definition at line 483 of file glsl_math.h.

00483                                                               {
00484                 FriendVector result( 0 );
00485                 for ( size_type i = 0; i < FriendVector::size(); ++i ) {
00486                     for ( size_type j = 0; j < FriendVector::size(); ++j ) {
00487                         result[ i ] += v[ j ] * operator [] ( j )[ i ];
00488                     }
00489                 }
00490                 return result;
00491             }

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
SubClass gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::operator * const SubClass &  other  )  const [inline]
 

Definition at line 462 of file glsl_math.h.

00462                                                                 {
00463                 #define AT( i, j )  operator [] ( i )[ j ]
00464                 
00465                 SubClass result( 0 );
00466                 for ( size_type i = 0; i < ColumnSize; ++i ) {
00467                     for ( size_type j = 0; j < RowSize; ++j ) {
00468                         for ( size_type k = 0; k < ColumnSize; ++k ) {
00469                             result[ i ][ j ] += AT( j, k ) * other[ k ][ i ];
00470                         }
00471                     }
00472                 }
00473                 
00474                 #undef AT
00475                 
00476                 return result;
00477             }

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
SubClass gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::operator * value_type  v  )  const [inline]
 

Reimplemented from gslib::glsl_math::tuple_mixin< SubClass, RowSize *ColumnSize >.

Definition at line 442 of file glsl_math.h.

00442                                                        {
00443                 return TupleMixin::operator * ( v );
00444             }

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
SubClass& gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::operator *= const SubClass &  other  )  [inline]
 

Definition at line 478 of file glsl_math.h.

00478                                                             {
00479                 *this = ( *this ) * other;
00480                 return *this;
00481             }

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
SubClass& gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::operator *= value_type  v  )  [inline]
 

Reimplemented from gslib::glsl_math::tuple_mixin< SubClass, RowSize *ColumnSize >.

Definition at line 439 of file glsl_math.h.

00439                                                    {
00440                 return TupleMixin::operator *= ( v );
00441             }

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
SubClass gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::operator/ value_type  v  )  const [inline]
 

Reimplemented from gslib::glsl_math::tuple_mixin< SubClass, RowSize *ColumnSize >.

Definition at line 448 of file glsl_math.h.

00448                                                        {
00449                 return TupleMixin::operator / ( v );
00450             }

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
SubClass& gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::operator/= value_type  v  )  [inline]
 

Reimplemented from gslib::glsl_math::tuple_mixin< SubClass, RowSize *ColumnSize >.

Definition at line 445 of file glsl_math.h.

00445                                                    {
00446                 return TupleMixin::operator /= ( v );
00447             }

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
const FriendVector& gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::operator[] size_type  nthColumn  )  const [inline]
 

get nthColumn column vector's const reference

Reimplemented from gslib::glsl_math::tuple< Size >.

Definition at line 458 of file glsl_math.h.

00458                                                                           {
00459                 BOOST_ASSERT( nthColumn < ColumnSize );
00460                 return *( reinterpret_cast< const FriendVector* >( begin() ) + nthColumn );
00461             }

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
FriendVector& gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::operator[] size_type  nthColumn  )  [inline]
 

get nthColumn column vector's reference

Reimplemented from gslib::glsl_math::tuple< Size >.

Definition at line 453 of file glsl_math.h.

Referenced by gslib::glsl_math::matrix_mixin< mat2, vec2, 2, 2 >::operator *().

00453                                                               {
00454                 BOOST_ASSERT( nthColumn < ColumnSize );
00455                 return *( reinterpret_cast< FriendVector* >( begin() ) + nthColumn );
00456             }

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
size_type gslib::glsl_math::matrix_mixin< SubClass, FriendVector, RowSize, ColumnSize >::rowSize  )  [inline, static]
 

Definition at line 504 of file glsl_math.h.

00504                                        {
00505                 return RowSize;
00506             }


Friends And Related Function Documentation

template<typename SubClass, typename FriendVector, size_t RowSize, size_t ColumnSize>
FriendVector operator * const FriendVector &  v,
const SubClass &  other
[friend]
 

multiply with column vector ( Left Hand Syste, DirectX )

Definition at line 493 of file glsl_math.h.

00493                                                                                             {
00494                 FriendVector result;
00495                 for ( size_type i = 0; i < FriendVector::size(); ++i ) {
00496                     result[ i ] = dot( v, other[ i ] );
00497                 }
00498                 return result;
00499             }


The documentation for this struct was generated from the following file:
Generated on Fri Dec 24 00:52:07 2004 for glsl_math by doxygen 1.3.6