Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bad97183153701b09df5fae1052b1c30 > files > 1999

crystalspace-doc-1.2.1-5mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Crystal Space 1.2.1: csgeom/matrix2.h Source File (Crystal Space 1.2.1 Public API Reference)</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="head">
 <tr height="59">
  <td class="head" width="202" valign="bottom" style="padding-left:0;"><a href="http://www.crystalspace3d.org/"><img src="csblur.png" width="236" height="59" alt="CrystalSpace" border="0"></a></td>
  <td class="head"><h2>Public API Reference</h2></td>
 </tr>
 <tr height="11">
  <td colspan="2" class="headshadow" valign="top" style="padding-left:0;"><img src="csblurb.png" width="236" height="11" alt="" border="0"></td>
 </tr>
</table>
<div class="content">
<!-- Generated by Doxygen 1.5.3 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
    <li><a href="classes.html"><span>Classes</span></a></li>
    <li class="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>csgeom/matrix2.h</h1><a href="matrix2_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">    Copyright (C) 2000 by Jorrit Tyberghein</span>
<a name="l00003"></a>00003 <span class="comment">    Largely rewritten by Ivan Avramovic &lt;ivan@avramovic.com&gt;</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment">    This library is free software; you can redistribute it and/or</span>
<a name="l00006"></a>00006 <span class="comment">    modify it under the terms of the GNU Library General Public</span>
<a name="l00007"></a>00007 <span class="comment">    License as published by the Free Software Foundation; either</span>
<a name="l00008"></a>00008 <span class="comment">    version 2 of the License, or (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment"></span>
<a name="l00010"></a>00010 <span class="comment">    This library is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00013"></a>00013 <span class="comment">    Library General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"></span>
<a name="l00015"></a>00015 <span class="comment">    You should have received a copy of the GNU Library General Public</span>
<a name="l00016"></a>00016 <span class="comment">    License along with this library; if not, write to the Free</span>
<a name="l00017"></a>00017 <span class="comment">    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span>
<a name="l00018"></a>00018 <span class="comment">*/</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#ifndef __CS_MATRIX2_H__</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define __CS_MATRIX2_H__</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span>
<a name="l00023"></a>00023 <span class="preprocessor">#include "csextern.h"</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="vector2_8h.html" title="2D vector.">csgeom/vector2.h</a>"</span>
<a name="l00026"></a>00026 
<a name="l00037"></a><a class="code" href="classcsMatrix2.html">00037</a> <span class="keyword">class </span>CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039 <span class="keyword">public</span>:
<a name="l00040"></a><a class="code" href="classcsMatrix2.html#04510180f5050b2ae7d5e4f5ba8cfcae">00040</a>   <span class="keywordtype">float</span> m11, m12;
<a name="l00041"></a><a class="code" href="classcsMatrix2.html#5164d3382c143082bfb2bc8c22ec69ee">00041</a>   <span class="keywordtype">float</span> m21, m22;
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="keyword">public</span>:
<a name="l00045"></a>00045   <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> ();
<a name="l00046"></a>00046 
<a name="l00048"></a>00048   <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> (<span class="keywordtype">float</span> m11, <span class="keywordtype">float</span> m12,
<a name="l00049"></a>00049              <span class="keywordtype">float</span> m21, <span class="keywordtype">float</span> m22);
<a name="l00050"></a>00050 
<a name="l00052"></a><a class="code" href="classcsMatrix2.html#a2283a512a137bc814b40447f9b0d464">00052</a>   <span class="keyword">inline</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a> Row1()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a> (m11,m12); }
<a name="l00053"></a>00053 
<a name="l00055"></a><a class="code" href="classcsMatrix2.html#8ffed2d9047b26f7119413484a33ecc7">00055</a>   <span class="keyword">inline</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a> Row2()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a> (m21,m22); }
<a name="l00056"></a>00056 
<a name="l00058"></a><a class="code" href="classcsMatrix2.html#981025e528de1b4793e7147ddefa7a5a">00058</a>   <span class="keyword">inline</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a> Col1()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a> (m11,m21); }
<a name="l00059"></a>00059 
<a name="l00061"></a><a class="code" href="classcsMatrix2.html#e5aa074ea9dc5c688774db8d5bcaab54">00061</a>   <span class="keyword">inline</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a> Col2()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a> (m12,m22); }
<a name="l00062"></a>00062 
<a name="l00064"></a><a class="code" href="classcsMatrix2.html#259af777b294c50d4f8a4a50a9e6bf28">00064</a>   <span class="keyword">inline</span> <span class="keywordtype">void</span> Set (<span class="keywordtype">float</span> m11, <span class="keywordtype">float</span> m12,
<a name="l00065"></a>00065                    <span class="keywordtype">float</span> m21, <span class="keywordtype">float</span> m22)
<a name="l00066"></a>00066   {
<a name="l00067"></a>00067     <a class="code" href="classcsMatrix2.html#919f87431a628919787780c5266c9c5b">csMatrix2::m11</a> = m11; <a class="code" href="classcsMatrix2.html#04510180f5050b2ae7d5e4f5ba8cfcae">csMatrix2::m12</a> = m12;
<a name="l00068"></a>00068     <a class="code" href="classcsMatrix2.html#3a67e49e38c9950a8a993b8ec2ff7af9">csMatrix2::m21</a> = m21; <a class="code" href="classcsMatrix2.html#5164d3382c143082bfb2bc8c22ec69ee">csMatrix2::m22</a> = m22;
<a name="l00069"></a>00069   }
<a name="l00070"></a>00070 
<a name="l00072"></a>00072   <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; operator+= (<span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m);
<a name="l00073"></a>00073 
<a name="l00075"></a>00075   <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; operator-= (<span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m);
<a name="l00076"></a>00076 
<a name="l00078"></a>00078   <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; operator*= (<span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m);
<a name="l00079"></a>00079 
<a name="l00081"></a>00081   <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; operator*= (<span class="keywordtype">float</span> s);
<a name="l00082"></a>00082 
<a name="l00084"></a>00084   <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; operator/= (<span class="keywordtype">float</span> s);
<a name="l00085"></a>00085 
<a name="l00087"></a><a class="code" href="classcsMatrix2.html#f6e5453f66f504c6a5d627acb5e4a5a4">00087</a>   <span class="keyword">inline</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> <a class="code" href="cscolor_8h.html#4152cd06665dffa1b7bded50af1bbe34" title="Add two colors.">operator+ </a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> *<span class="keyword">this</span>; }
<a name="l00089"></a><a class="code" href="classcsMatrix2.html#c395159a67b9e9f79d7cd36a2096e9f4">00089</a>   <span class="keyword">inline</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> <a class="code" href="cscolor_8h.html#55e738db674cbea902cb06597df8dacf" title="Subtract two colors.">operator- </a>()<span class="keyword"> const</span>
<a name="l00090"></a>00090 <span class="keyword">  </span>{
<a name="l00091"></a>00091     <span class="keywordflow">return</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>(-m11,-m12, -m21,-m22);
<a name="l00092"></a>00092   }
<a name="l00093"></a>00093 
<a name="l00095"></a>00095   <span class="keywordtype">void</span> Transpose ();
<a name="l00096"></a>00096 
<a name="l00098"></a>00098   <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> GetTranspose () <span class="keyword">const</span>;
<a name="l00099"></a>00099 
<a name="l00101"></a><a class="code" href="classcsMatrix2.html#de833b5d08b2a3673fbe0818d4685880">00101</a>   <span class="keyword">inline</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> GetInverse ()<span class="keyword"> const</span>
<a name="l00102"></a>00102 <span class="keyword">  </span>{
<a name="l00103"></a>00103     <span class="keywordtype">float</span> inv_det = 1 / (m11 * m22 - m12 * m21);
<a name="l00104"></a>00104     <span class="keywordflow">return</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> (m22 * inv_det, -m12 * inv_det,
<a name="l00105"></a>00105                       -m21 * inv_det, m11 * inv_det);
<a name="l00106"></a>00106   }
<a name="l00107"></a>00107 
<a name="l00109"></a><a class="code" href="classcsMatrix2.html#53beca9fc7f3a3e64a324103a1292acc">00109</a>   <span class="keywordtype">void</span> Invert () { *<span class="keyword">this</span> = GetInverse (); }
<a name="l00110"></a>00110 
<a name="l00112"></a>00112   <span class="keywordtype">float</span> Determinant () <span class="keyword">const</span>;
<a name="l00113"></a>00113 
<a name="l00115"></a>00115   <span class="keywordtype">void</span> Identity ();
<a name="l00116"></a>00116 
<a name="l00118"></a>00118   <span class="keyword">friend</span> CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> <a class="code" href="cscolor_8h.html#4152cd06665dffa1b7bded50af1bbe34" title="Add two colors.">operator+ </a>(<span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m1,
<a name="l00119"></a>00119     <span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m2);
<a name="l00121"></a>00121   <span class="keyword">friend</span> CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> <a class="code" href="cscolor_8h.html#55e738db674cbea902cb06597df8dacf" title="Subtract two colors.">operator- </a>(<span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m1,
<a name="l00122"></a>00122     <span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m2);
<a name="l00124"></a>00124   <span class="keyword">friend</span> CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> <a class="code" href="cscolor_8h.html#c99c344a2408f1e1928b247db5d64365" title="Multiply two colors.">operator* </a>(<span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m1,
<a name="l00125"></a>00125     <span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m2);
<a name="l00126"></a>00126 
<a name="l00128"></a><a class="code" href="classcsMatrix2.html#eff079a7bb536262ce00798bf6f4d336">00128</a>   <span class="keyword">inline</span> <span class="keyword">friend</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a> <a class="code" href="cscolor_8h.html#c99c344a2408f1e1928b247db5d64365" title="Multiply two colors.">operator* </a>(<span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m, <span class="keyword">const</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a>&amp; v)
<a name="l00129"></a>00129   {
<a name="l00130"></a>00130     <span class="keywordflow">return</span> <a class="code" href="classcsVector2.html" title="A 2D vector.">csVector2</a> (m.<a class="code" href="classcsMatrix2.html#919f87431a628919787780c5266c9c5b">m11</a>*v.<a class="code" href="classcsVector2.html#cf4ee25489c98e6b7b7a460c4edd4ac6" title="X component of vector.">x</a> + m.<a class="code" href="classcsMatrix2.html#04510180f5050b2ae7d5e4f5ba8cfcae">m12</a>*v.<a class="code" href="classcsVector2.html#f736730a67b9ee807f1455da3d2be188" title="Y component of vector.">y</a>, m.<a class="code" href="classcsMatrix2.html#3a67e49e38c9950a8a993b8ec2ff7af9">m21</a>*v.<a class="code" href="classcsVector2.html#cf4ee25489c98e6b7b7a460c4edd4ac6" title="X component of vector.">x</a> + m.<a class="code" href="classcsMatrix2.html#5164d3382c143082bfb2bc8c22ec69ee">m22</a>*v.<a class="code" href="classcsVector2.html#f736730a67b9ee807f1455da3d2be188" title="Y component of vector.">y</a>);
<a name="l00131"></a>00131   }
<a name="l00132"></a>00132 
<a name="l00134"></a>00134   <span class="keyword">friend</span> CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> <a class="code" href="cscolor_8h.html#c99c344a2408f1e1928b247db5d64365" title="Multiply two colors.">operator* </a>(<span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m, 
<a name="l00135"></a>00135     <span class="keywordtype">float</span> f);
<a name="l00137"></a>00137   <span class="keyword">friend</span> CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> <a class="code" href="cscolor_8h.html#c99c344a2408f1e1928b247db5d64365" title="Multiply two colors.">operator* </a>(<span class="keywordtype">float</span> f,
<a name="l00138"></a>00138     <span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m);
<a name="l00140"></a>00140   <span class="keyword">friend</span> CS_CRYSTALSPACE_EXPORT <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a> <a class="code" href="cscolor_8h.html#a9b4d9b2f7603a763b65c580bf00eaad" title="Divide a color by a scalar.">operator/ </a>(<span class="keyword">const</span> <a class="code" href="classcsMatrix2.html" title="A 2x2 matrix.">csMatrix2</a>&amp; m,
<a name="l00141"></a>00141     <span class="keywordtype">float</span> f);
<a name="l00142"></a>00142 };
<a name="l00143"></a>00143 
<a name="l00146"></a>00146 <span class="preprocessor">#endif // __CS_MATRIX2_H__</span>
<a name="l00147"></a>00147 <span class="preprocessor"></span>
</pre></div><hr size="1"><address><small>Generated for Crystal Space 1.2.1 by 
<a href="http://www.doxygen.org/index.html">doxygen</a> 1.5.3 
</small></address> </div></body> </html>