Clean project structure.

This commit is contained in:
jmsgrogan 2023-01-17 10:13:25 +00:00
parent 78a4fa99ff
commit 947bf937fd
496 changed files with 206 additions and 137 deletions

View file

@ -0,0 +1,61 @@
#include "Vector.h"
Vector::Vector(double x, double y, double z)
: mX(x),
mY(y),
mZ(z)
{
updateLength();
}
Vector::~Vector()
{
};
double Vector::getX() const
{
return mX;
}
double Vector::getY() const
{
return mY;
}
double Vector::getZ() const
{
return mZ;
}
double Vector::getLength() const
{
return mLength;
}
double Vector::dotProduct(const Vector& v) const
{
return mX * v.mX + mY * v.mY + mZ * v.mZ;
}
Vector Vector::crossProduct(const Vector& v) const
{
return Vector(v.mY * mZ - v.mZ * mY, v.mZ * mX - v.mX * mZ, v.mX * mY - v.mY * mX);
}
Vector Vector::getNormalized() const
{
return Vector(mX / mLength, mY / mLength, mZ / mLength);
}
void Vector::scale(double x, double y, double z)
{
mX = x * mX;
mY = y * mY;
mZ = z * mZ;
updateLength();
}
void Vector::updateLength()
{
mLength = std::sqrt(mX * mX + mY * mY + mZ * mZ);
}