diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index 930508014..8210035d8 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -95,7 +95,7 @@ template class Matrix { /** @brief %Matrix column */ inline constexpr Vector at(size_t col) const { - return *reinterpret_cast*>(_data+col*size); + return Vector::from(_data+col*size); } /** @brief Set value at given position */ @@ -105,7 +105,7 @@ template class Matrix { /** @brief Set matrix column */ inline void set(size_t col, const Vector& value) { - memcpy(_data+col*size, value.data(), size*sizeof(T)); + Vector::from(_data+col*size) = value; } /** @brief Add value to given position */ diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 1a700a6d6..3e781883b 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -50,7 +50,7 @@ template class Vector { /** @copydoc from(T*) */ inline constexpr static const Vector& from(const T* data) { - return *reinterpret_cast*>(data); + return *reinterpret_cast*>(data); } /** @brief Angle between vectors */