class Rivet::Vector2
Rivet::Vector2
Two-dimensional specialisation of Vector.
#include <Vector2.hh>
Inherits from Rivet::Vector< 2 >
Public Types
Name | |
---|---|
using Eigen::Matrix< double, N, 1 > | EVector Vector. |
Public Functions
Name | |
---|---|
Vector2() | |
template <typename V2TYPE > | Vector2(const V2TYPE & other) |
Vector2(const Vector< 2 > & other) | |
Vector2(double x, double y) | |
~Vector2() | |
double | x() const |
double | y() const |
Vector2 & | setX(double x) |
Vector2 & | setY(double y) |
double | dot(const Vector2 & v) const Dot-product with another vector. |
double | angle(const Vector2 & v) const Angle in radians to another vector. |
Vector2 | unitVec() const Unit-normalized version of this vector. |
Vector2 | unit() const Synonym for unitVec. |
Vector2 & | operator*=(const double a) |
Vector2 & | operator/=(const double a) |
Vector2 & | operator+=(const Vector2 & v) |
Vector2 & | operator-=(const Vector2 & v) |
Vector2 | operator-() const |
const double & | get(const size_t index) const |
double & | get(const size_t index) |
const double & | operator[](const size_t index) const Direct access to vector elements by index. |
double & | operator[](const size_t index) Direct access to vector elements by index. |
Vector< N > & | set(const size_t index, const double value) Set indexed value. |
constexpr size_t | size() const Vector dimensionality. |
bool | isZero(double tolerance =1E-5) const Check for nullness, allowing for numerical precision. |
double | mod2() const Calculate the modulus-squared of a vector. ( \sum_{i=1}^N x_i^2 ). |
double | mod() const Calculate the modulus of a vector. ( \sqrt{\sum_{i=1}^N x_i^2} ). |
bool | operator==(const Vector< N > & a) const |
bool | operator!=(const Vector< N > & a) const |
Vector2 | mkX() |
Vector2 | mkY() |
Friends
Name | |
---|---|
Vector2 | multiply(const double a, const Vector2 & v) |
Vector2 | multiply(const Vector2 & v, const double a) |
Vector2 | add(const Vector2 & a, const Vector2 & b) |
Vector2 | subtract(const Vector2 & a, const Vector2 & b) |
Additional inherited members
Public Functions inherited from Rivet::Vector< 2 >
Name | |
---|---|
Vector() | |
Vector(const Vector< N > & other) |
Public Types Documentation
using EVector
using Rivet::Vector< N >::EVector = Eigen::Matrix<double,N,1>;
Vector.
Public Functions Documentation
function Vector2
inline Vector2()
function Vector2
template <typename V2TYPE >
inline Vector2(
const V2TYPE & other
)
function Vector2
inline Vector2(
const Vector< 2 > & other
)
function Vector2
inline Vector2(
double x,
double y
)
function ~Vector2
inline ~Vector2()
function x
inline double x() const
function y
inline double y() const
function setX
inline Vector2 & setX(
double x
)
function setY
inline Vector2 & setY(
double y
)
function dot
inline double dot(
const Vector2 & v
) const
Dot-product with another vector.
function angle
inline double angle(
const Vector2 & v
) const
Angle in radians to another vector.
function unitVec
inline Vector2 unitVec() const
Unit-normalized version of this vector.
function unit
inline Vector2 unit() const
Synonym for unitVec.
function operator*=
inline Vector2 & operator*=(
const double a
)
function operator/=
inline Vector2 & operator/=(
const double a
)
function operator+=
inline Vector2 & operator+=(
const Vector2 & v
)
function operator-=
inline Vector2 & operator-=(
const Vector2 & v
)
function operator-
inline Vector2 operator-() const
function get
inline const double & get(
const size_t index
) const
function get
inline double & get(
const size_t index
)
function operator[]
inline const double & operator[](
const size_t index
) const
Direct access to vector elements by index.
function operator[]
inline double & operator[](
const size_t index
)
Direct access to vector elements by index.
function set
inline Vector< N > & set(
const size_t index,
const double value
)
Set indexed value.
function size
inline constexpr size_t size() const
Vector dimensionality.
function isZero
inline bool isZero(
double tolerance =1E-5
) const
Check for nullness, allowing for numerical precision.
function mod2
inline double mod2() const
Calculate the modulus-squared of a vector. ( \sum_{i=1}^N x_i^2 ).
function mod
inline double mod() const
Calculate the modulus of a vector. ( \sqrt{\sum_{i=1}^N x_i^2} ).
function operator==
inline bool operator==(
const Vector< N > & a
) const
function operator!=
inline bool operator!=(
const Vector< N > & a
) const
function mkX
static inline Vector2 mkX()
function mkY
static inline Vector2 mkY()
Friends
friend multiply
friend Vector2 multiply(
const double a,
const Vector2 & v
);
friend multiply
friend Vector2 multiply(
const Vector2 & v,
const double a
);
friend add
friend Vector2 add(
const Vector2 & a,
const Vector2 & b
);
friend subtract
friend Vector2 subtract(
const Vector2 & a,
const Vector2 & b
);
Updated on 2022-08-07 at 20:17:17 +0100