Get rid of some pointless copying.

This commit is contained in:
Par Winzell 2017-10-31 20:18:14 -07:00
parent 21138b6eff
commit 0fcd00cb5b
1 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@ struct Bounds
initialized = false;
}
void AddPoint(mathfu::Vector<T, d> p) {
void AddPoint(const mathfu::Vector<T, d> &p) {
if (initialized) {
for (int ii = 0; ii < d; ii ++) {
min(ii) = std::min(min(ii), p(ii));
@ -58,7 +58,7 @@ typedef mathfu::Matrix<float, 4> Mat4f;
typedef mathfu::Quaternion<float> Quatf;
typedef Bounds<float, 3> Boundsf;
template<class T, int d> static inline std::vector<T> toStdVec(mathfu::Vector <T, d> vec)
template<class T, int d> static inline std::vector<T> toStdVec(const mathfu::Vector <T, d> &vec)
{
std::vector<T> result(d);
for (int ii = 0; ii < d; ii ++) {
@ -67,7 +67,7 @@ template<class T, int d> static inline std::vector<T> toStdVec(mathfu::Vector <T
return result;
}
template<class T> std::vector<T> toStdVec(mathfu::Quaternion<T> quat) {
template<class T> std::vector<T> toStdVec(const mathfu::Quaternion<T> &quat) {
return std::vector<T> { quat.vector()[0], quat.vector()[1], quat.vector()[2], quat.scalar() };
}