Formatting and added Scalar.

This commit is contained in:
jgoppert
2015-11-03 19:38:31 -05:00
parent 76e86cf937
commit a36ff9f1e5
21 changed files with 811 additions and 697 deletions
+26 -26
View File
@@ -16,37 +16,37 @@ template<typename Type, size_t N>
class Vector : public Matrix<Type, N, 1>
{
public:
virtual ~Vector() {};
virtual ~Vector() {};
Vector() : Matrix<Type, N, 1>()
{
}
Vector() : Matrix<Type, N, 1>()
{
}
inline Type operator()(size_t i) const
{
const Matrix<Type, N, 1> &v = *this;
return v(i, 0);
}
inline Type operator()(size_t i) const
{
const Matrix<Type, N, 1> &v = *this;
return v(i, 0);
}
inline Type &operator()(size_t i)
{
Matrix<Type, N, 1> &v = *this;
return v(i, 0);
}
inline Type &operator()(size_t i)
{
Matrix<Type, N, 1> &v = *this;
return v(i, 0);
}
Type dot(const Vector & b) {
Vector &a(*this);
Type r = 0;
for (int i = 0; i<3; i++) {
r += a(i)*b(i);
}
return r;
}
Type dot(const Vector & b) {
Vector &a(*this);
Type r = 0;
for (int i = 0; i<3; i++) {
r += a(i)*b(i);
}
return r;
}
Type norm() {
Vector &a(*this);
return sqrt(a.dot(a));
}
Type norm() {
Vector &a(*this);
return sqrt(a.dot(a));
}
};
}; // namespace matrix