Fix Vector4 constructors and clean up compiler errors
This commit is contained in:
parent
3bf72bd78d
commit
2cadffd7d4
4 changed files with 25 additions and 8 deletions
|
@ -11,12 +11,14 @@
|
|||
|
||||
#include "basics/matrix.hh"
|
||||
#include "basics/types.hh"
|
||||
#include "basics/vector.hh"
|
||||
|
||||
|
||||
namespace charles {
|
||||
namespace basics {
|
||||
|
||||
typedef Matrix<4,4> Matrix4;
|
||||
/** A 4-square matrix */
|
||||
typedef Matrix<4> Matrix4;
|
||||
|
||||
} /* namespace basics */
|
||||
} /* namespace charles */
|
||||
|
|
|
@ -216,9 +216,9 @@ Matrix<N,M>::operator*(Matrix<M,P> rhs)
|
|||
for (int j = 0; j < P; j++) {
|
||||
/* Each cell is Sigma(k=0, M)(lhs[ik] * rhs[kj]) */
|
||||
const int ij = i*N + j;
|
||||
mCells[ij] = 0.0;
|
||||
mData[ij] = 0.0;
|
||||
for (int k = 0; k < M; k++) {
|
||||
result.mCells[ij] += mCells[i*N + k] * rhs.mCells[k*P + j];
|
||||
result.mData[ij] += mData[i*N + k] * rhs.mData[k*P + j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,25 @@
|
|||
namespace charles {
|
||||
namespace basics {
|
||||
|
||||
/*
|
||||
* charles::basics::Vector4::Vector4 --
|
||||
*/
|
||||
Vector4::Vector4()
|
||||
: mCells({0.0, 0.0, 0.0, 1.0})
|
||||
{
|
||||
: Vector4(0, 0, 0)
|
||||
{ }
|
||||
|
||||
|
||||
/*
|
||||
* charles::basics::Vector4::Vector4 --
|
||||
*/
|
||||
Vector4::Vector4(const Double& x,
|
||||
const Double& y,
|
||||
const Double& z)
|
||||
{
|
||||
mData[0] = x;
|
||||
mData[1] = y;
|
||||
mData[2] = z;
|
||||
mData[3] = 1.0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace charles {
|
||||
namespace basics {
|
||||
|
||||
template<uint N>
|
||||
template<UInt N>
|
||||
struct Vector
|
||||
: public Matrix<N,1>
|
||||
{ };
|
||||
|
@ -23,7 +23,7 @@ struct Vector4
|
|||
: public Vector<4>
|
||||
{
|
||||
Vector4();
|
||||
Vector4(Double x, Double y, Double z);
|
||||
Vector4(const Double& x, const Double& y, const Double& z);
|
||||
|
||||
Double& X();
|
||||
Double& Y();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue