operator<< for pretty-printing an entire Matrix4
This commit is contained in:
parent
09c5e29f63
commit
10195c607c
2 changed files with 32 additions and 1 deletions
|
@ -346,6 +346,35 @@ Inverse(Matrix4 m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* charles::basics::operator<< --
|
||||||
|
*/
|
||||||
|
std::ostream&
|
||||||
|
operator<<(std::ostream &ost,
|
||||||
|
const Matrix4 &m)
|
||||||
|
{
|
||||||
|
ost << "[";
|
||||||
|
for (UInt i = 0; i < 4; i++) {
|
||||||
|
if (i != 0) {
|
||||||
|
ost << " ";
|
||||||
|
}
|
||||||
|
ost << "[";
|
||||||
|
for (UInt j = 0; j < 4; j++) {
|
||||||
|
ost << m(i,j);
|
||||||
|
if (j < 3) {
|
||||||
|
ost << " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ost << "]";
|
||||||
|
if (i < 3) {
|
||||||
|
ost << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ost << "]";
|
||||||
|
return ost;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} /* namespace mespace */
|
} /* namespace mespace */
|
||||||
} /* namespace charles */
|
} /* namespace charles */
|
||||||
|
|
||||||
|
|
|
@ -93,13 +93,15 @@ protected:
|
||||||
/** Scalar multiplication, scalar factor on the left. */
|
/** Scalar multiplication, scalar factor on the left. */
|
||||||
Matrix4 operator*(Double lhs, const Matrix4 &rhs);
|
Matrix4 operator*(Double lhs, const Matrix4 &rhs);
|
||||||
|
|
||||||
|
|
||||||
/** Transpose the given matrix. */
|
/** Transpose the given matrix. */
|
||||||
Matrix4 Transpose(Matrix4 m);
|
Matrix4 Transpose(Matrix4 m);
|
||||||
|
|
||||||
/** Invert the given matrix. */
|
/** Invert the given matrix. */
|
||||||
Matrix4 Inverse(Matrix4 m);
|
Matrix4 Inverse(Matrix4 m);
|
||||||
|
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream &ost, const Matrix4 &m);
|
||||||
|
|
||||||
} /* namespace basics */
|
} /* namespace basics */
|
||||||
} /* namespace charles */
|
} /* namespace charles */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue