wfmath 1.0.3
A math library for the Worldforge system.
oldmatrix.cpp
1// -*-C++-*-
2// matrix.cpp (Matrix<> implementation)
3//
4// The WorldForge Project
5// Copyright (C) 2001 The WorldForge Project
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20//
21// For information about WorldForge and its authors, please contact
22// the Worldforge Web Site at http://www.worldforge.org.
23
24// Author: Ron Steinke
25// Created: 2001-12-7
26
27#include "matrix_funcs.h"
28#include "const.h"
29#include <float.h>
30
31namespace WF { namespace Math {
32
33Matrix<3> SkewSymmetric(const Vector<3>& v)
34{
35 Matrix<3> out;
36
37 out.elem(0, 0) = out.elem(1, 1) = out.elem(2, 2) = 0;
38
39 out.elem(0, 1) = v[2];
40 out.elem(1, 0) = -v[2];
41 out.elem(1, 2) = v[0];
42 out.elem(2, 1) = -v[0];
43 out.elem(2, 0) = v[1];
44 out.elem(0, 2) = -v[1];
45
46 return out;
47}
48
49
50}} // namespace WF::Math