Public Types | Public Member Functions | Static Public Attributes | List of all members
Vector2D< Cmpt > Class Template Reference

Templated 2D Vector derived from VectorSpace adding construction from 2 components, element access using x() and y() member functions and the inner-product (dot-product). More...

Inheritance diagram for Vector2D< Cmpt >:
Inheritance graph
[legend]
Collaboration diagram for Vector2D< Cmpt >:
Collaboration graph
[legend]

Public Types

enum  components { X, Y }
 
typedef Vector2D< label > labelType
 
- Public Types inherited from VectorSpace< Vector2D< Cmpt >, Cmpt, 2 >
typedef VectorSpace< Form, Cmpt, Ncmpts > vsType
 
typedef Cmpt cmptType
 
typedef Cmpt magType
 
typedef Cmpt * iterator
 

Public Member Functions

 Vector2D ()=default
 
 Vector2D (const Vector2D &)=default
 
Vector2Doperator= (const Vector2D &)=default
 
 Vector2D (const Foam::zero)
 
 Vector2D (const VectorSpace< Vector2D< Cmpt >, Cmpt, 2 > &vs)
 
 Vector2D (const Cmpt &vx, const Cmpt &vy)
 
 Vector2D (Istream &is)
 
const Cmpt & x () const
 
const Cmpt & y () const
 
Cmpt & x ()
 
Cmpt & y ()
 
Vector2D< Cmpt > & normalise ()
 
scalar perp (const Vector2D< Cmpt > &b) const
 
bool isClose (const Vector2D< Cmpt > &b, const scalar tol=1e-10) const
 
- Public Member Functions inherited from VectorSpace< Vector2D< Cmpt >, Cmpt, 2 >
 VectorSpace ()=default
 
 VectorSpace (const Foam::zero)
 
 VectorSpace (const VectorSpace< Form, Cmpt, Ncmpts > &vs)
 
 VectorSpace (const VectorSpace< Form2, Cmpt2, Ncmpts > &)
 
 VectorSpace (Istream &is)
 
const Cmpt & component (const direction) const
 
Cmpt & component (const direction)
 
void component (Cmpt &, const direction) const
 
void replace (const direction, const Cmpt &)
 
const Cmpt * cdata () const noexcept
 
Cmpt * data () noexcept
 
const ConstBlock< SubVector, BStart > block () const
 
const Foam::VectorSpace< Form, Cmpt, Ncmpts >::template ConstBlock< SubVector, BStart > block () const
 
const Cmpt & operator[] (const direction) const
 
Cmpt & operator[] (const direction)
 
void operator= (const VectorSpace< Form, Cmpt, Ncmpts > &)
 
void operator= (const Foam::zero)
 
void operator+= (const VectorSpace< Form, Cmpt, Ncmpts > &)
 
void operator-= (const VectorSpace< Form, Cmpt, Ncmpts > &)
 
void operator*= (const scalar)
 
void operator/= (const scalar)
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 

Static Public Attributes

static constexpr direction rank = 1
 
- Static Public Attributes inherited from VectorSpace< Vector2D< Cmpt >, Cmpt, 2 >
static constexpr direction dim
 
static constexpr direction nComponents
 
static constexpr direction mRows
 
static constexpr direction nCols
 
static const char *const typeName
 
static const char *const componentNames []
 
static const Form zero
 
static const Form one
 
static const Form max
 
static const Form min
 
static const Form rootMax
 
static const Form rootMin
 

Additional Inherited Members

- Static Public Member Functions inherited from VectorSpace< Vector2D< Cmpt >, Cmpt, 2 >
static constexpr direction size () noexcept
 
static Form uniform (const Cmpt &s)
 
- Public Attributes inherited from VectorSpace< Vector2D< Cmpt >, Cmpt, 2 >
const typedef Cmpt * const_iterator
 
Cmpt v_ [Ncmpts]
 

Detailed Description

template<class Cmpt>
class Foam::Vector2D< Cmpt >

Templated 2D Vector derived from VectorSpace adding construction from 2 components, element access using x() and y() member functions and the inner-product (dot-product).

Source files

Definition at line 51 of file Vector2D.H.

Member Typedef Documentation

◆ labelType

typedef Vector2D<label> labelType

Definition at line 60 of file Vector2D.H.

Member Enumeration Documentation

◆ components

enum components
Enumerator

Definition at line 70 of file Vector2D.H.

Constructor & Destructor Documentation

◆ Vector2D() [1/6]

Vector2D ( )
default

◆ Vector2D() [2/6]

Vector2D ( const Vector2D< Cmpt > &  )
default

◆ Vector2D() [3/6]

Vector2D ( const Foam::zero  )
inline

Definition at line 25 of file Vector2DI.H.

◆ Vector2D() [4/6]

Vector2D ( const VectorSpace< Vector2D< Cmpt >, Cmpt, 2 > &  vs)
inline

Definition at line 33 of file Vector2DI.H.

◆ Vector2D() [5/6]

Vector2D ( const Cmpt &  vx,
const Cmpt &  vy 
)
inline

Definition at line 42 of file Vector2DI.H.

◆ Vector2D() [6/6]

Vector2D ( Istream is)
inlineexplicit

Definition at line 50 of file Vector2DI.H.

Member Function Documentation

◆ operator=()

Vector2D& operator= ( const Vector2D< Cmpt > &  )
default

◆ x() [1/2]

Cmpt & x
inline

◆ y() [1/2]

Cmpt & y
inline

◆ x() [2/2]

Cmpt& x ( )
inline

◆ y() [2/2]

Cmpt& y ( )
inline

◆ normalise()

Foam::Vector2D< Cmpt > & normalise
inline

Definition at line 87 of file Vector2DI.H.

◆ perp()

scalar perp ( const Vector2D< Cmpt > &  b) const
inline

Definition at line 120 of file Vector2DI.H.

Referenced by triangle2D::area(), triangle2D::lineSegmentIntersectionPoint(), and line::nearestDist().

Here is the caller graph for this function:

◆ isClose()

bool isClose ( const Vector2D< Cmpt > &  b,
const scalar  tol = 1e-10 
) const
inline

Definition at line 128 of file Vector2DI.H.

Referenced by triangle2D::snapClosePoints().

Here is the caller graph for this function:

Member Data Documentation

◆ rank

constexpr direction rank = 1
staticconstexpr

Definition at line 66 of file Vector2D.H.


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