zeus/include/zeus/CUnitVector.hpp

21 lines
517 B
C++
Raw Permalink Normal View History

2018-10-06 20:39:40 -07:00
#pragma once
2015-08-31 14:27:09 -07:00
2016-03-04 15:03:26 -08:00
#include "zeus/CVector3f.hpp"
2015-08-31 14:27:09 -07:00
2018-12-07 17:16:50 -08:00
namespace zeus {
class CUnitVector3f : public CVector3f {
2015-08-31 14:27:09 -07:00
public:
2019-02-23 23:15:32 -08:00
constexpr CUnitVector3f() : CVector3f(0.f, 1.f, 0.f) {}
2015-08-31 14:27:09 -07:00
2019-02-23 23:15:32 -08:00
constexpr CUnitVector3f(float x, float y, float z, bool doNormalize = true) : CVector3f(x, y, z) {
2018-12-07 17:16:50 -08:00
if (doNormalize && canBeNormalized())
normalize();
}
2019-02-23 23:15:32 -08:00
constexpr CUnitVector3f(const CVector3f& vec, bool doNormalize = true) : CVector3f(vec) {
2018-12-07 17:16:50 -08:00
if (doNormalize && canBeNormalized())
normalize();
}
2015-08-31 14:27:09 -07:00
};
2018-12-07 21:23:50 -08:00
} // namespace zeus