Yaw, Pitch and Roll with D 2.0
bearophile
bearophileHUGS at lycos.com
Fri Aug 31 17:47:18 PDT 2012
Danny Arends:
> Another post: http://www.dannyarends.nl/?viewDetailed=00030
pure mat!(T)[3][] gen_rotationmatrices(T = float)(){
I suggest to write something like this (note the casing and other
details):
Mat!T[3][] genRotationMatrices(T = float)() pure {
tmp += mixin('A[i][k] '~op~' B[k][j]');
This seems OK, but it looks a bit convoluted. Maybe something
like this works (untested):
tmp += A[i][k].opBinary!op(B[k][j]);
pure auto yaw(int deg){
deg = degreeloop(deg);
return cast(matrix)rmatrix[deg][YAW];
}
I suggest generally to try to avoid casts, where possible.
Bye,
bearophile
More information about the Digitalmars-d-announce
mailing list