LINUX.ORG.RU

История изменений

Исправление Forum0888, (текущая версия) :

«Покопаю» это API.
Если понравится, переведу API на C++.

https://cglm.readthedocs.io/en/latest/getting_started.html#array-vs-struct

Array vs Struct:

cglm uses arrays for vector and matrix types. So you can’t access 
individual elements like vec.x, vec.y, vec.z… You must use 
subscript to access vector elements e.g. vec[0], vec[1], vec[2].

Also I think it is more meaningful to access matrix elements with 
subscript e.g matrix[2][3] instead of matrix._23. Since matrix is 
array of vectors, vectors are also defined as array. This makes 
types homogeneous.

Return arrays?

Since C doesn’t support return arrays, cglm also doesn’t support 
this feature.

Function design:
cglm provides a few way to call a function to do same operation.

Исходная версия Forum0888, :

«Покопаю» это API.
Если понравится, переведу API на C++.

https://cglm.readthedocs.io/en/latest/getting_started.html#array-vs-struct

Array vs Struct:
cglm uses arrays for vector and matrix types. So you can’t access individual elements like vec.x, vec.y, vec.z… You must use subscript to access vector elements e.g. vec[0], vec[1], vec[2].

Also I think it is more meaningful to access matrix elements with subscript e.g matrix[2][3] instead of matrix._23. Since matrix is array of vectors, vectors are also defined as array. This makes types homogeneous.

Return arrays?

Since C doesn’t support return arrays, cglm also doesn’t support this feature.

Function design:
_images/cglm-intro.png
cglm provides a few way to call a function to do same operation.