File: Matrix22.cpp

package info (click to toggle)
imath 3.1.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,468 kB
  • sloc: cpp: 44,687; ansic: 171; sh: 153; python: 60; makefile: 32
file content (27 lines) | stat: -rw-r--r-- 535 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <Imath/ImathMatrix.h>
#include <Imath/ImathMatrixAlgo.h>
#include <cassert>

void
matrix22_example()
{
    Imath::M22f M (Imath::UNINITIALIZED); // uninitialized

    M.makeIdentity();
    assert (M[0][0] == 1.0f);
    assert (M[0][1] == 0.0f);

    Imath::M22f Minv = M.inverse();

    Imath::M22f R;
    assert (R == Imath::identity22f);

    R.rotate (M_PI/4);
    
    M = R * M;

    Imath::V2f v2 (1.0f, 0.0f);
    Imath::V2f r2 = v2 * M;

    assert (r2.equalWithAbsError (Imath::V2f (0.707107f, 0.707107f), 1e-6f));
}