Code Search for Developers
 
 
  

symmat3.cxx from Boson at Krugle


Show symmat3.cxx syntax highlighted

#include <gfx/gfx.h>
#include <gfx/symmat3.h>

using namespace std;

SymMat3 SymMat3::I()
{
    SymMat3 A;
    A(0,0) = A(1,1) = A(2,2) = 1;
    return A;
}

Mat3 SymMat3::fullmatrix() const
{
    Mat3 A;

    for(int i=0; i<A.dim(); i++)
	for(int j=0; j<A.dim(); j++)
	    A(i, j) = (*this)(i,j);

    return A;
}

SymMat3 operator*(const SymMat3& n, const SymMat3& m)
{
    SymMat3 A;
    for(int i=0; i<3; i++)  for(int j=i; j<3; j++)
	    A(i,j) = n.row(i)*m.col(j);
    return A;
}

ostream &operator<<(std::ostream &out, const SymMat3& M)
{
    for(int i=0; i<M.dim(); i++)
    {
	for(int j=0; j<M.dim(); j++)
	    out << M(i, j) << " ";
	out << endl;
    }

    return out;
}

SymMat3 SymMat3::outer_product(const Vec3& v)
{
    SymMat3 A;

    for(int i=0; i<A.dim(); i++)
	for(int j=i; j<A.dim(); j++)
	    A(i, j) = v[i]*v[j];

    return A;
}

double invert(Mat3& m_inv, const SymMat3& m)
{
    return invert(m_inv, m.fullmatrix());
}




See more files for this project here

Boson

Boson is an OpenGL real-time strategy game. It is designed to run on Unix (Linux) computers, and is built on top of the KDE, Qt and kdegames libraries.

Project homepage: http://sourceforge.net/projects/boson
Programming language(s): C,C++
License: other

  gfx/
    arcball.h
    array.h
    baseball.h
    geom3d.h
    geom4d.h
    gfx.h
    gl.h
    glext.h
    gltools.h
    gui.h
    intvec.h
    mat2.h
    mat3.h
    mat4.h
    mfc.h
    quat.h
    raster.h
    script.h
    symmat3.h
    symmat4.h
    trackball.h
    vec2.h
    vec3.h
    vec4.h
    wintools.h
  CMakeLists.txt
  arcball.cxx
  baseball.cxx
  config-libgfx.h.cmake
  geom3d.cxx
  geom4d.cxx
  gltools.cxx
  gui.cxx
  mat2.cxx
  mat3.cxx
  mat4.cxx
  quat.cxx
  raster-jpeg.cxx
  raster-png.cxx
  raster-pnm.cxx
  raster-tiff.cxx
  raster.cxx
  script.cxx
  symmat3.cxx
  symmat4.cxx
  time.cxx
  trackball.cxx
  wintools.cxx