MCPcopy Create free account
hub / github.com/FastLED/FastLED / vec2

Class vec2

src/fl/math/geometry.h:187–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185using vec3f = vec3<float>; // Full precision but slow.
186
187template <typename T> struct vec2 {
188 // value_type
189 using value_type = T;
190 value_type x = 0;
191 value_type y = 0;
192 constexpr vec2() FL_NOEXCEPT = default;
193 constexpr vec2(T x, T y) FL_NOEXCEPT : x(x), y(y) {}
194
195 template <typename U> explicit constexpr vec2(U xy) FL_NOEXCEPT : x(xy), y(xy) {}
196
197 constexpr vec2(const vec2 &p) = default;
198 constexpr vec2(vec2 &&p) FL_NOEXCEPT = default;
199 vec2 &operator=(vec2 &&p) FL_NOEXCEPT = default;
200
201 vec2 &operator*=(const float &f) FL_NOEXCEPT {
202 x *= f;
203 y *= f;
204 return *this;
205 }
206 vec2 &operator/=(const float &f) FL_NOEXCEPT {
207 // *this = point_xy_math::div(*this, f);
208 x /= f;
209 y /= f;
210 return *this;
211 }
212 vec2 &operator*=(const double &f) FL_NOEXCEPT {
213 // *this = point_xy_math::mul(*this, f);
214 x *= f;
215 y *= f;
216 return *this;
217 }
218 vec2 &operator/=(const double &f) FL_NOEXCEPT {
219 // *this = point_xy_math::div(*this, f);
220 x /= f;
221 y /= f;
222 return *this;
223 }
224
225 vec2 &operator/=(const u16 &d) FL_NOEXCEPT {
226 // *this = point_xy_math::div(*this, d);
227 x /= d;
228 y /= d;
229 return *this;
230 }
231
232 vec2 &operator/=(const int &d) FL_NOEXCEPT {
233 // *this = point_xy_math::div(*this, d);
234 x /= d;
235 y /= d;
236 return *this;
237 }
238
239 vec2 &operator/=(const vec2 &p) FL_NOEXCEPT {
240 // *this = point_xy_math::div(*this, p);
241 x /= p.x;
242 y /= p.y;
243 return *this;
244 }

Callers 6

operator-Method · 0.70
operator+Method · 0.70
operator*Method · 0.70
operator/Method · 0.70
getMaxMethod · 0.70
getMinMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected