openMSX
Typedefs | Functions | Variables
gl_mat.cc File Reference
#include "catch.hpp"
#include "gl_mat.hh"
Include dependency graph for gl_mat.cc:

Go to the source code of this file.

Typedefs

using imat2 = matMxN< 2, 2, int >
 
using imat3 = matMxN< 3, 3, int >
 
using imat4 = matMxN< 4, 4, int >
 
using mat32 = matMxN< 3, 2, float >
 
using mat23 = matMxN< 2, 3, float >
 

Functions

 TEST_CASE ("gl_mat: constructors")
 
 TEST_CASE ("gl_mat: modify columns or elements")
 
 CHECK (m3==m3)
 
 CHECK (m3 !=n3)
 
 CHECK (i3==i3)
 
 CHECK (i3 !=j3)
 
 CHECK (m4==m4)
 
 CHECK (m4 !=n4)
 
 CHECK (i4==i4)
 
 CHECK (i4 !=j4)
 
 CHECK (m32==m32)
 
 CHECK (m32 !=n32)
 
 CHECK (m23==m23)
 
 CHECK (m23 !=n23)
 
 TEST_CASE ("gl_mat: copy constructor, assignment")
 
 TEST_CASE ("gl_mat: construct from larger matrix")
 
 TEST_CASE ("gl_mat: addition, subtraction, negation")
 
 TEST_CASE ("gl_mat: matrix * scalar")
 
 TEST_CASE ("gl_mat: matrix * column-vector")
 
 TEST_CASE ("gl_mat: matrix * matrix")
 
 TEST_CASE ("gl_mat: transpose")
 
 TEST_CASE ("gl_mat: determinant, inverse")
 
 TEST_CASE ("gl_mat: norm-2 squared")
 

Variables

mat3 n3 (vec3(1, 0, 3), vec3(4, 5, 6), vec3(7, 8, 9))
 
mat3 o3 (vec3(1, 2, 3), vec3(4, 5, 0), vec3(7, 8, 9))
 
mat3 p3 (vec3(1, 2, 3), vec3(4, 5, 6), vec3(7, 0, 9))
 
imat3 i3 (ivec3(1, 2, 3), ivec3(4, 5, 6), ivec3(7, 8, 9))
 
imat3 j3 (ivec3(1, 2, 3), ivec3(4, 5, 6), ivec3(7, 0, 9))
 
imat3 k3 (ivec3(1, 2, 3), ivec3(4, 5, 0), ivec3(7, 8, 9))
 
imat3 l3 (ivec3(0, 2, 3), ivec3(4, 5, 6), ivec3(7, 8, 9))
 
mat4 m4 (vec4(1, 2, 3, 4), vec4(3, 4, 5, 6), vec4(5, 6, 7, 8), vec4(7, 8, 9, 0))
 
mat4 n4 (vec4(1, 2, 0, 4), vec4(3, 4, 5, 6), vec4(5, 6, 7, 8), vec4(7, 8, 9, 0))
 
mat4 o4 (vec4(1, 2, 3, 4), vec4(0, 4, 5, 6), vec4(5, 6, 7, 8), vec4(7, 8, 9, 0))
 
mat4 p4 (vec4(1, 2, 3, 4), vec4(3, 4, 5, 6), vec4(5, 0, 7, 8), vec4(7, 8, 9, 0))
 
mat4 q4 (vec4(1, 2, 3, 4), vec4(3, 4, 5, 6), vec4(5, 6, 7, 8), vec4(7, 8, 9, 1))
 
imat4 i4 (ivec4(1, 2, 3, 4), ivec4(3, 4, 5, 6), ivec4(5, 6, 7, 8), ivec4(7, 8, 9, 0))
 
imat4 j4 (ivec4(1, 0, 3, 4), ivec4(3, 4, 5, 6), ivec4(5, 6, 7, 8), ivec4(7, 8, 9, 0))
 
imat4 k4 (ivec4(1, 2, 3, 4), ivec4(3, 4, 0, 6), ivec4(5, 6, 7, 8), ivec4(7, 8, 9, 0))
 
imat4 l4 (ivec4(1, 2, 3, 4), ivec4(3, 4, 5, 6), ivec4(5, 6, 7, 0), ivec4(7, 8, 9, 0))
 
imat4 h4 (ivec4(1, 2, 3, 4), ivec4(3, 4, 5, 6), ivec4(5, 6, 7, 8), ivec4(0, 8, 9, 0))
 
mat32 m32 (vec3(2, 3, 4), vec3(5, 6, 7))
 
mat32 n32 (vec3(2, 3, 0), vec3(5, 6, 7))
 
mat32 o32 (vec3(2, 3, 4), vec3(0, 6, 7))
 
mat23 m23 (vec2(2, 3), vec2(4, 5), vec2(6, 7))
 
mat23 n23 (vec2(0, 3), vec2(4, 5), vec2(6, 7))
 
mat23 o23 (vec2(2, 3), vec2(4, 0), vec2(6, 7))
 
mat23 p23 (vec2(2, 3), vec2(4, 5), vec2(0, 7))
 

Typedef Documentation

◆ imat2

using imat2 = matMxN<2, 2, int>

Definition at line 13 of file gl_mat.cc.

◆ imat3

using imat3 = matMxN<3, 3, int>

Definition at line 14 of file gl_mat.cc.

◆ imat4

using imat4 = matMxN<4, 4, int>

Definition at line 15 of file gl_mat.cc.

◆ mat23

using mat23 = matMxN<2, 3, float>

Definition at line 17 of file gl_mat.cc.

◆ mat32

using mat32 = matMxN<3, 2, float>

Definition at line 16 of file gl_mat.cc.

Function Documentation

◆ CHECK() [1/12]

CHECK ( i3 = j3)

◆ CHECK() [2/12]

CHECK ( i3  = =i3)

◆ CHECK() [3/12]

CHECK ( i4 = j4)

◆ CHECK() [4/12]

CHECK ( i4  = =i4)

◆ CHECK() [5/12]

CHECK ( m23 = n23)

◆ CHECK() [6/12]

CHECK ( m23  = =m23)

◆ CHECK() [7/12]

CHECK ( m3 !  = n3)

◆ CHECK() [8/12]

CHECK ( m32 = n32)

◆ CHECK() [9/12]

CHECK ( m32  = =m32)

◆ CHECK() [10/12]

CHECK ( m3  = =m3)

◆ CHECK() [11/12]

CHECK ( m4 = n4)

◆ CHECK() [12/12]

CHECK ( m4  = =m4)

◆ TEST_CASE() [1/11]

TEST_CASE ( "gl_mat:  addition,
subtraction  ,
negation"   
)

Definition at line 318 of file gl_mat.cc.

References CHECK(), i3, i4, j3, j4, k3, k4, l3, l4, m32, m4, n3, n32, n4, o3, o32, o4, p3, and p4.

◆ TEST_CASE() [2/11]

TEST_CASE ( "gl_mat: construct from larger matrix"  )

Definition at line 296 of file gl_mat.cc.

References CHECK(), i3, i4, and m4.

◆ TEST_CASE() [3/11]

TEST_CASE ( "gl_mat: constructors"  )

Definition at line 23 of file gl_mat.cc.

References CHECK(), i3, i4, m23, m32, and m4.

◆ TEST_CASE() [4/11]

TEST_CASE ( "gl_mat: copy  constructor,
assignment"   
)

Definition at line 256 of file gl_mat.cc.

References CHECK().

◆ TEST_CASE() [5/11]

TEST_CASE ( "gl_mat:  determinant,
inverse"   
)

Definition at line 504 of file gl_mat.cc.

References CHECK(), gl::determinant(), i3, i4, gl::inverse(), and m4.

◆ TEST_CASE() [6/11]

TEST_CASE ( "gl_mat: matrix * column-vector"  )

Definition at line 419 of file gl_mat.cc.

References CHECK(), i3, i4, m23, m32, and m4.

◆ TEST_CASE() [7/11]

TEST_CASE ( "gl_mat: matrix * matrix"  )

Definition at line 454 of file gl_mat.cc.

References CHECK(), i3, i4, j3, j4, m23, m32, m4, n3, n4, and o3.

◆ TEST_CASE() [8/11]

TEST_CASE ( "gl_mat: matrix * scalar"  )

Definition at line 381 of file gl_mat.cc.

References CHECK(), i3, i4, j3, j4, m32, m4, n3, n32, and n4.

◆ TEST_CASE() [9/11]

TEST_CASE ( "gl_mat: modify columns or elements"  )

Definition at line 147 of file gl_mat.cc.

References CHECK(), i3, i4, m23, m32, and m4.

◆ TEST_CASE() [10/11]

TEST_CASE ( "gl_mat: norm-2 squared"  )

Definition at line 530 of file gl_mat.cc.

References CHECK(), i3, i4, m23, m32, m4, and gl::norm2_2().

◆ TEST_CASE() [11/11]

TEST_CASE ( "gl_mat: transpose"  )

Definition at line 484 of file gl_mat.cc.

References CHECK(), i3, i4, m23, m32, m4, and gl::transpose().

Variable Documentation

◆ h4

imat4 h4(ivec4(1, 2, 3, 4), ivec4(3, 4, 5, 6), ivec4(5, 6, 7, 8), ivec4(0, 8, 9, 0)) ( ivec4(1, 2, 3, 4)  ,
ivec4(3, 4, 5, 6)  ,
ivec4(5, 6, 7, 8)  ,
ivec4(0, 8, 9, 0)   
)

◆ i3

imat3 i3(ivec3(1, 2, 3), ivec3(4, 5, 6), ivec3(7, 8, 9)) ( ivec3(1, 2, 3)  ,
ivec3(4, 5, 6)  ,
ivec3(7, 8, 9)   
)

◆ i4

imat4 i4(ivec4(1, 2, 3, 4), ivec4(3, 4, 5, 6), ivec4(5, 6, 7, 8), ivec4(7, 8, 9, 0)) ( ivec4(1, 2, 3, 4)  ,
ivec4(3, 4, 5, 6)  ,
ivec4(5, 6, 7, 8)  ,
ivec4(7, 8, 9, 0)   
)

◆ j3

imat3 j3(ivec3(1, 2, 3), ivec3(4, 5, 6), ivec3(7, 0, 9)) ( ivec3(1, 2, 3)  ,
ivec3(4, 5, 6)  ,
ivec3(7, 0, 9)   
)

◆ j4

imat4 j4(ivec4(1, 0, 3, 4), ivec4(3, 4, 5, 6), ivec4(5, 6, 7, 8), ivec4(7, 8, 9, 0)) ( ivec4(1, 0, 3, 4)  ,
ivec4(3, 4, 5, 6)  ,
ivec4(5, 6, 7, 8)  ,
ivec4(7, 8, 9, 0)   
)

◆ k3

imat3 k3(ivec3(1, 2, 3), ivec3(4, 5, 0), ivec3(7, 8, 9)) ( ivec3(1, 2, 3)  ,
ivec3(4, 5, 0)  ,
ivec3(7, 8, 9)   
)

Referenced by TEST_CASE().

◆ k4

imat4 k4(ivec4(1, 2, 3, 4), ivec4(3, 4, 0, 6), ivec4(5, 6, 7, 8), ivec4(7, 8, 9, 0)) ( ivec4(1, 2, 3, 4)  ,
ivec4(3, 4, 0, 6)  ,
ivec4(5, 6, 7, 8)  ,
ivec4(7, 8, 9, 0)   
)

Referenced by TEST_CASE(), and TEST_CASE().

◆ l3

imat3 l3(ivec3(0, 2, 3), ivec3(4, 5, 6), ivec3(7, 8, 9)) ( ivec3(0, 2, 3)  ,
ivec3(4, 5, 6)  ,
ivec3(7, 8, 9)   
)

Referenced by TEST_CASE(), and TEST_CASE().

◆ l4

imat4 l4(ivec4(1, 2, 3, 4), ivec4(3, 4, 5, 6), ivec4(5, 6, 7, 0), ivec4(7, 8, 9, 0)) ( ivec4(1, 2, 3, 4)  ,
ivec4(3, 4, 5, 6)  ,
ivec4(5, 6, 7, 0)  ,
ivec4(7, 8, 9, 0)   
)

Referenced by TEST_CASE(), TEST_CASE(), and TEST_CASE().

◆ m23

mat23 m23(vec2(2, 3), vec2(4, 5), vec2(6, 7)) ( vec2(2, 3)  ,
vec2(4, 5)  ,
vec2(6, 7)   
)

◆ m32

mat32 m32(vec3(2, 3, 4), vec3(5, 6, 7)) ( vec3(2, 3, 4)  ,
vec3(5, 6, 7)   
)

◆ m4

mat4 m4(vec4(1, 2, 3, 4), vec4(3, 4, 5, 6), vec4(5, 6, 7, 8), vec4(7, 8, 9, 0)) ( vec4(1, 2, 3, 4)  ,
vec4(3, 4, 5, 6)  ,
vec4(5, 6, 7, 8)  ,
vec4(7, 8, 9, 0)   
)

◆ n23

mat23 n23(vec2(0, 3), vec2(4, 5), vec2(6, 7)) ( vec2(0, 3)  ,
vec2(4, 5)  ,
vec2(6, 7)   
)

◆ n3

mat3 n3(vec3(1, 0, 3), vec3(4, 5, 6), vec3(7, 8, 9)) ( vec3(1, 0, 3)  ,
vec3(4, 5, 6)  ,
vec3(7, 8, 9)   
)
Initial value:
{
mat3 m3(vec3(1, 2, 3), vec3(4, 5, 6), vec3(7, 8, 9))
vecN< 3, float > vec3
Definition gl_vec.hh:383

Referenced by TEST_CASE(), TEST_CASE(), and TEST_CASE().

◆ n32

mat32 n32(vec3(2, 3, 0), vec3(5, 6, 7)) ( vec3(2, 3, 0)  ,
vec3(5, 6, 7)   
)

Referenced by TEST_CASE(), and TEST_CASE().

◆ n4

mat4 n4(vec4(1, 2, 0, 4), vec4(3, 4, 5, 6), vec4(5, 6, 7, 8), vec4(7, 8, 9, 0)) ( vec4(1, 2, 0, 4)  ,
vec4(3, 4, 5, 6)  ,
vec4(5, 6, 7, 8)  ,
vec4(7, 8, 9, 0)   
)

Referenced by TEST_CASE(), TEST_CASE(), and TEST_CASE().

◆ o23

mat23 o23(vec2(2, 3), vec2(4, 0), vec2(6, 7)) ( vec2(2, 3)  ,
vec2(4, 0)  ,
vec2(6, 7)   
)

◆ o3

mat3 o3(vec3(1, 2, 3), vec3(4, 5, 0), vec3(7, 8, 9)) ( vec3(1, 2, 3)  ,
vec3(4, 5, 0)  ,
vec3(7, 8, 9)   
)

Referenced by TEST_CASE(), and TEST_CASE().

◆ o32

mat32 o32(vec3(2, 3, 4), vec3(0, 6, 7)) ( vec3(2, 3, 4)  ,
vec3(0, 6, 7)   
)

Referenced by TEST_CASE().

◆ o4

mat4 o4(vec4(1, 2, 3, 4), vec4(0, 4, 5, 6), vec4(5, 6, 7, 8), vec4(7, 8, 9, 0)) ( vec4(1, 2, 3, 4)  ,
vec4(0, 4, 5, 6)  ,
vec4(5, 6, 7, 8)  ,
vec4(7, 8, 9, 0)   
)

Referenced by TEST_CASE().

◆ p23

mat23 p23(vec2(2, 3), vec2(4, 5), vec2(0, 7)) ( vec2(2, 3)  ,
vec2(4, 5)  ,
vec2(0, 7)   
)

◆ p3

mat3 p3(vec3(1, 2, 3), vec3(4, 5, 6), vec3(7, 0, 9)) ( vec3(1, 2, 3)  ,
vec3(4, 5, 6)  ,
vec3(7, 0, 9)   
)

◆ p4

mat4 p4(vec4(1, 2, 3, 4), vec4(3, 4, 5, 6), vec4(5, 0, 7, 8), vec4(7, 8, 9, 0)) ( vec4(1, 2, 3, 4)  ,
vec4(3, 4, 5, 6)  ,
vec4(5, 0, 7, 8)  ,
vec4(7, 8, 9, 0)   
)

◆ q4

mat4 q4(vec4(1, 2, 3, 4), vec4(3, 4, 5, 6), vec4(5, 6, 7, 8), vec4(7, 8, 9, 1)) ( vec4(1, 2, 3, 4)  ,
vec4(3, 4, 5, 6)  ,
vec4(5, 6, 7, 8)  ,
vec4(7, 8, 9, 1)   
)