31#include <initializer_list>
59 constexpr Vec2() =
default;
180 return Vec2(0., -1.);
191 return Vec2(-1., 0.);
204 t = std::max(std::min(
t, 1.), 0.);
222 return std::hypot(
x,
y);
269 stream <<
"Vec2[" <<
x <<
", " <<
y <<
"]";
317 return !(*
this ==
rhs);
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
self_type transpose() const
Definition NdArrayCore.hpp:4958
Holds a 2D vector.
Definition Vec2.hpp:49
double dot(const Vec2 &otherVec) const noexcept
Definition Vec2.hpp:167
static constexpr Vec2 down() noexcept
Definition Vec2.hpp:178
double angle(const Vec2 &otherVec) const noexcept
Definition Vec2.hpp:115
double x
Definition Vec2.hpp:52
Vec2 & operator*=(double scalar) noexcept
Definition Vec2.hpp:383
Vec2 & operator/=(double scalar) noexcept
Definition Vec2.hpp:397
double distance(const Vec2 &otherVec) const noexcept
Definition Vec2.hpp:155
Vec2 & operator-=(const Vec2 &rhs) noexcept
Definition Vec2.hpp:369
static constexpr Vec2 up() noexcept
Definition Vec2.hpp:291
Vec2 normalize() const noexcept
Definition Vec2.hpp:231
Vec2 lerp(const Vec2 &otherVec, double t) const noexcept
Definition Vec2.hpp:202
Vec2(const NdArray< double > &ndArray)
Definition Vec2.hpp:97
Vec2 & operator-=(double scalar) noexcept
Definition Vec2.hpp:355
Vec2 project(const Vec2 &otherVec) const noexcept
Definition Vec2.hpp:243
double norm() const noexcept
Definition Vec2.hpp:220
static constexpr Vec2 right() noexcept
Definition Vec2.hpp:255
Vec2 clampMagnitude(double maxLength) const noexcept
Definition Vec2.hpp:135
Vec2(const std::initializer_list< double > &inList)
Definition Vec2.hpp:80
bool operator!=(const Vec2 &rhs) const noexcept
Definition Vec2.hpp:315
Vec2 & operator+=(const Vec2 &rhs) noexcept
Definition Vec2.hpp:341
std::string toString() const
Definition Vec2.hpp:266
double y
Definition Vec2.hpp:53
static constexpr Vec2 left() noexcept
Definition Vec2.hpp:189
Vec2 & operator+=(double scalar) noexcept
Definition Vec2.hpp:327
constexpr Vec2(double inX, double inY) noexcept
Definition Vec2.hpp:68
bool operator==(const Vec2 &rhs) const noexcept
Definition Vec2.hpp:303
NdArray< double > toNdArray() const
Definition Vec2.hpp:279
constexpr double interp(double inValue1, double inValue2, double inPercent) noexcept
Definition Utils/interp.hpp:41
bool essentiallyEqual(dtype inValue1, dtype inValue2) noexcept
Definition essentiallyEqual.hpp:49
Definition Cartesian.hpp:40
Duration operator-(const DateTime &lhs, const DateTime &rhs) noexcept
Subtraction operator.
Definition DateTime/DateTime.hpp:551
NdArray< dtype > operator/(const NdArray< dtype > &lhs, const NdArray< dtype > &rhs)
Definition NdArrayOperators.hpp:819
std::ostream & operator<<(std::ostream &os, Duration duration)
Output stream operator for the Duration type.
Definition Clock.hpp:30
NdArrayConstIterator< dtype, PointerType, DifferenceType > operator+(typename NdArrayConstIterator< dtype, PointerType, DifferenceType >::difference_type offset, NdArrayConstIterator< dtype, PointerType, DifferenceType > next) noexcept
Definition NdArrayIterators.hpp:302
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
NdArray< dtype > operator*(const NdArray< dtype > &lhs, const NdArray< dtype > &rhs)
Definition NdArrayOperators.hpp:604