Revision d7b28532
utility/vector.h | ||
---|---|---|
78 | 78 |
|
79 | 79 |
uint8_t n() { return N; } |
80 | 80 |
|
81 |
double magnitude() |
|
81 |
double magnitude() const
|
|
82 | 82 |
{ |
83 | 83 |
double res = 0; |
84 | 84 |
int i; |
... | ... | |
103 | 103 |
p_vec[i] = p_vec[i]/mag; |
104 | 104 |
} |
105 | 105 |
|
106 |
double dot(Vector v)
|
|
106 |
double dot(const Vector& v) const
|
|
107 | 107 |
{ |
108 | 108 |
double ret = 0; |
109 | 109 |
int i; |
... | ... | |
136 | 136 |
return ret; |
137 | 137 |
} |
138 | 138 |
|
139 |
Vector operator = (Vector v)
|
|
139 |
Vector& operator=(const Vector& v)
|
|
140 | 140 |
{ |
141 | 141 |
for (int x = 0; x < N; x++ ) |
142 | 142 |
p_vec[x] = v.p_vec[x]; |
... | ... | |
163 | 163 |
return p_vec[n]; |
164 | 164 |
} |
165 | 165 |
|
166 |
Vector operator + (Vector v) const
|
|
166 |
Vector operator+(const Vector& v) const
|
|
167 | 167 |
{ |
168 | 168 |
Vector ret; |
169 | 169 |
for(int i = 0; i < N; i++) |
... | ... | |
171 | 171 |
return ret; |
172 | 172 |
} |
173 | 173 |
|
174 |
Vector operator - (Vector v) const
|
|
174 |
Vector operator-(const Vector& v) const
|
|
175 | 175 |
{ |
176 | 176 |
Vector ret; |
177 | 177 |
for(int i = 0; i < N; i++) |
Also available in: Unified diff