libcamera v0.3.0+65-6ddd79b5
Supporting cameras in Linux since 2019
Public Member Functions | List of all members
libcamera::ipa::Vector< T, Rows > Class Template Reference

Vector class. More...

Public Member Functions

constexpr Vector ()=default
 Construct a zero vector.
 
constexpr Vector (const std::array< T, Rows > &data)
 Construct vector from supplied data. More...
 
int readYaml (const libcamera::YamlObject &yaml)
 Populate the vector with yaml data. More...
 
const T & operator[] (size_t i) const
 Index to an element in the vector. More...
 
T & operator[] (size_t i)
 
constexpr T x () const
 Convenience function to access the first element of the vector. More...
 
constexpr T y () const
 Convenience function to access the second element of the vector. More...
 
constexpr T z () const
 Convenience function to access the third element of the vector. More...
 
constexpr Vector< T, Rows > operator- () const
 Negate a Vector by negating both all of its coordinates. More...
 
constexpr Vector< T, Rows > operator- (const Vector< T, Rows > &other) const
 Subtract one vector from another. More...
 
constexpr Vector< T, Rows > operator+ (const Vector< T, Rows > &other) const
 Add two vectors together. More...
 
constexpr T operator* (const Vector< T, Rows > &other) const
 Compute the dot product. More...
 
constexpr Vector< T, Rows > operator* (T factor) const
 Multiply the vector by a scalar. More...
 
constexpr Vector< T, Rows > operator/ (T factor) const
 Divide the vector by a scalar. More...
 
constexpr double length2 () const
 Get the squared length of the vector. More...
 
constexpr double length () const
 Get the length of the vector. More...
 

Detailed Description

template<typename T, unsigned int Rows>
class libcamera::ipa::Vector< T, Rows >

Vector class.

Template Parameters
TType of numerical values to be stored in the vector
RowsNumber of dimension of the vector (= number of elements)

Constructor & Destructor Documentation

◆ Vector()

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::Vector ( const std::array< T, Rows > &  data)
inlineconstexpr

Construct vector from supplied data.

Parameters
dataData from which to construct a vector

The size of data must be equal to the dimension size Rows of the vector.

Member Function Documentation

◆ length()

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::length ( ) const
inlineconstexpr

Get the length of the vector.

Returns
The length of the vector

◆ length2()

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::length2 ( ) const
inlineconstexpr

Get the squared length of the vector.

Returns
The squared length of the vector

◆ operator*() [1/2]

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator* ( const Vector< T, Rows > &  other) const
inlineconstexpr

Compute the dot product.

Parameters
[in]otherThe other vector
Returns
The dot product of the two vectors

◆ operator*() [2/2]

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator* ( factor) const
inlineconstexpr

Multiply the vector by a scalar.

Parameters
[in]factorThe factor
Returns
The vector multiplied by factor

◆ operator+()

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator+ ( const Vector< T, Rows > &  other) const
inlineconstexpr

Add two vectors together.

Parameters
[in]otherThe other vector
Returns
The sum of the two vectors

◆ operator-() [1/2]

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator- ( ) const
inlineconstexpr

Negate a Vector by negating both all of its coordinates.

Returns
The negated vector

◆ operator-() [2/2]

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator- ( const Vector< T, Rows > &  other) const
inlineconstexpr

Subtract one vector from another.

Parameters
[in]otherThe other vector
Returns
The difference of other from this vector

◆ operator/()

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::operator/ ( factor) const
inlineconstexpr

Divide the vector by a scalar.

Parameters
[in]factorThe factor
Returns
The vector divided by factor

◆ operator[]() [1/2]

template<typename T , unsigned int Rows>
T & libcamera::ipa::Vector< T, Rows >::operator[] ( size_t  i)
inline

Index to an element in the vector.

Parameters
iIndex of element to retrieve
Returns
Element at index i from the vector

◆ operator[]() [2/2]

template<typename T , unsigned int Rows>
T libcamera::ipa::Vector< T, Rows >::operator[] ( size_t  i) const
inline

Index to an element in the vector.

Parameters
iIndex of element to retrieve
Returns
Element at index i from the vector

◆ readYaml()

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::readYaml ( const libcamera::YamlObject yaml)
inline

Populate the vector with yaml data.

Parameters
yamlYaml data to populate the vector with

Any existing data in the vector will be overwritten. The size of the data read from yaml must be equal to the dimension size Rows of the vector.

The yaml data is expected to be a list with elements of type T.

Returns
0 on success, negative error code otherwise

◆ x()

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::x ( ) const
inlineconstexpr

Convenience function to access the first element of the vector.

Returns
The first element of the vector

◆ y()

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::y ( ) const
inlineconstexpr

Convenience function to access the second element of the vector.

Returns
The second element of the vector

◆ z()

template<typename T , unsigned int Rows>
libcamera::ipa::Vector< T, Rows >::z ( ) const
inlineconstexpr

Convenience function to access the third element of the vector.

Returns
The third element of the vector

The documentation for this class was generated from the following files: