PLaSK library

Loading...
Searching...
No Matches
Related Symbols | List of all members
plask::Vec< dim, T > Struct Template Reference

Generic template for 2D and 3D vectors. More...

`#include <plask/vector/common.hpp>`

## Related Symbols
(Note that these are not member symbols.)
template<int dim, typename T >
double | abs2 (const Vec< dim, T > &v)
| Calculate square of vector magnitude.
template<int dim, typename T , typename OtherT >
constexpr auto | operator* (const OtherT &scale, const Vec< dim, T > &v) -> decltype(v *scale)
| Multiply vector `v` by scalar `scale`.
template<int dim, typename T >
#define | abs(x) ((x) >= 0 ? (x) : -(x))
| Calculate vector magnitude.
template<int dim, typename T >
bool | isnan (const Vec< dim, T > &v)
| Check if any vector componen is not-a-number.
template<int dst_dim, typename T , int src_dim>
Vec< dst_dim, T > | vec (const Vec< src_dim, T > &src)
| Convert vector between space.
template<typename T >
Vec< 3, T > | vec (const Vec< 2, T > &src, T lon)
| Convert vector 2D to 3D space.
Vec< 2, double > | rotateToLonTranAbs (const Vec< 3, double > &v)
| Rotate `v` over up axis to lie on tran-vert plane.
Vec< 2, double > | rotateToLonTranSgn (const Vec< 3, double > &v)
| Rotate `v` over up axis to lie on tran-vert plane.
template<typename T >
Vec< 3, T > | vec3Dplus2D (const Vec< 3, T > &v3, const Vec< 2, T > &v2, T lon)
| Calculate `v3` + `v2` with given `lon` coordinate.
template<typename T >
Vec< 3, T > | vec3Dplus2D (const Vec< 3, T > &v3, const Vec< 2, T > &v2)
| Calculate `v3` + `v2`, same as vec3Dplus2D(v3, v2, 0.0).
template<typename T , typename OtherT >
constexpr auto | operator* (const OtherT &scale, const LateralVec< T > &v) -> decltype(v *scale)
| Multiply vector `v` by scalar `scale`.

## Detailed Description

template<int dim, typename T = double>
struct plask::Vec< dim, T >

Generic template for 2D and 3D vectors.

Definition at line 26 of file common.hpp.

## Friends And Related Symbol Documentation

## ◆ abs

template<int dim, typename T >

#define abs | ( |  | const Vec< dim, T > &v | ) | ((x) >= 0 ? (x) : -(x))
| related

Calculate vector magnitude.

Parameters

  v | a vector

Returns
  vector magnitude

Definition at line 58 of file vec.hpp.

## ◆ abs2()

template<int dim, typename T >

double abs2 | ( | const Vec< dim, T > & | v | ) |
| related

Calculate square of vector magnitude.

Parameters

  v | a vector

Returns
  square of vector magnitude

Definition at line 28 of file vec.hpp.

## ◆ isnan()

template<int dim, typename T >

bool isnan | ( | const Vec< dim, T > & | v | ) |
| related

Check if any vector componen is not-a-number.

Parameters

  v | a vector

Returns
  `true` if any vector magnitude is Nan

Definition at line 69 of file vec.hpp.

## ◆ operator*() [1/2]

template<typename T , typename OtherT >

constexpr auto operator* | ( | const OtherT & | scale,
|  | const LateralVec< T > & | v
| ) |  | -> decltype(v*scale)
| related

Multiply vector `v` by scalar `scale`.

Parameters

  scale | scalar
  v | vector

Returns
  vector `v` multiplied by `scalar`

Definition at line 363 of file lateral.hpp.

## ◆ operator*() [2/2]

template<int dim, typename T , typename OtherT >

constexpr auto operator* | ( | const OtherT & | scale,
|  | const Vec< dim, T > & | v
| ) |  | -> decltype(v*scale)
| related

Multiply vector `v` by scalar `scale`.

Parameters

  scale | scalar
  v | vector

Returns
  vector `v` multiplied by `scalar`

Definition at line 47 of file vec.hpp.

## ◆ rotateToLonTranAbs()

template<int dim, typename T = double>

Vec< 2, double > rotateToLonTranAbs | ( | const Vec< 3, double > & | v | ) |
| related

Rotate `v` over up axis to lie on tran-vert plane.

Parameters

  v | vector in 3D space

Returns
  vector in 2D space, after rotation, with tran()>=0 and vert()==v.vert()

Definition at line 120 of file vec.hpp.

## ◆ rotateToLonTranSgn()

template<int dim, typename T = double>

Vec< 2, double > rotateToLonTranSgn | ( | const Vec< 3, double > & | v | ) |
| related

Rotate `v` over up axis to lie on tran-vert plane.

Parameters

  v | vector in 3D space

Returns
  vector in 2D space, after rotation, with sign of tran() same as v.tran() and vert()==v.vert()

Definition at line 129 of file vec.hpp.

## ◆ vec() [1/2]

template<typename T >

Vec< 3, T > vec | ( | const Vec< 2, T > & | src,
|  | T | lon
| ) |  |
| related

Convert vector 2D to 3D space.

Parameters

  src | source vector
  lon | longitude coordinate

Returns
  `src` vector in destination space and given `lon` coordinate

Definition at line 111 of file vec.hpp.

## ◆ vec() [2/2]

template<int dst_dim, typename T , int src_dim>

Vec< dst_dim, T > vec | ( | const Vec< src_dim, T > & | src | ) |
| related

Convert vector between space.

Parameters

  src | source vector

Returns
  `src` vector in destination space

Definition at line 100 of file vec.hpp.

## ◆ vec3Dplus2D() [1/2]

template<typename T >

Vec< 3, T > vec3Dplus2D | ( | const Vec< 3, T > & | v3,
|  | const Vec< 2, T > & | v2
| ) |  |
| related

Calculate `v3` + `v2`, same as vec3Dplus2D(v3, v2, 0.0).

Parameters

  v3 | vector in 3D space
  v2 | vector in 2D space

Returns
  `v3` + `v2`

Definition at line 154 of file vec.hpp.

## ◆ vec3Dplus2D() [2/2]

template<typename T >

Vec< 3, T > vec3Dplus2D | ( | const Vec< 3, T > & | v3,
|  | const Vec< 2, T > & | v2,
|  | T | lon
| ) |  |
| related

Calculate `v3` + `v2` with given `lon` coordinate.

Parameters

  v3 | vector in 3D space
  v2 | vector in 2D space
  lon | last coordinate of v2

Returns
  `v3` + `v2` with given `lon` coordinate

Definition at line 142 of file vec.hpp.

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

- plask/vector/common.hpp
- plask/vec.hpp
- plask/vector/lateral.hpp