Skip to content

Commit 5258d09

Browse files
committed
MathVector defaulting to 0
1 parent 34e6373 commit 5258d09

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

ugbase/common/math/math_vector_matrix/math_vector.h

+6-9
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class MathVector
101101
static const std::size_t Size = N;
102102

103103
public:
104-
MathVector() {}
104+
MathVector() {for(std::size_t i = 0; i < N; ++i) m_data[i] = 0.0;}
105105
MathVector(const value_type& val) {for(std::size_t i = 0; i < N; ++i) m_data[i] = val;}
106106
MathVector(const MathVector& v) {assign(v);}
107107

@@ -234,11 +234,8 @@ class MathVector<1, T>
234234
static const std::size_t Size = 1;
235235

236236
public:
237-
MathVector() {}
238-
MathVector(value_type x)
239-
{
240-
m_data[0] = x;
241-
}
237+
MathVector() {m_data[0] = 0.0; }
238+
MathVector(value_type x) { m_data[0] = x; }
242239
MathVector(const MathVector<1, T>& v) {assign(v);}
243240

244241
static inline MathVector from(const MathVector<0, T>& v) {return MathVector(0);}
@@ -301,7 +298,7 @@ class MathVector<2, T>
301298
static const std::size_t Size = 2;
302299

303300
public:
304-
MathVector() {}
301+
MathVector() { m_data[0] = m_data[1] = 0.0; }
305302
MathVector(const value_type& val) {m_data[0] = m_data[1] = val;}
306303
MathVector(value_type x, value_type y)
307304
{
@@ -373,7 +370,7 @@ class MathVector<3, T>
373370
static const std::size_t Size = 3;
374371

375372
public:
376-
MathVector() {}
373+
MathVector() { m_data[0] = m_data[1] = m_data[2] = 0.0; }
377374
MathVector(const value_type& val) {m_data[0] = m_data[1] = m_data[2] = val;}
378375
MathVector(value_type x, value_type y, value_type z)
379376
{
@@ -451,7 +448,7 @@ class MathVector<4, T>
451448
static const std::size_t Size = 4;
452449

453450
public:
454-
MathVector() {}
451+
MathVector() {m_data[0] = m_data[1] = m_data[2] = m_data[3] =0.0;}
455452
MathVector(const value_type& val) {m_data[0] = m_data[1] = m_data[2] = m_data[3] =val;}
456453
MathVector(value_type x, value_type y, value_type z, value_type w)
457454
{

0 commit comments

Comments
 (0)