criptic v1
Cosmic Ray Interstellar Propagation Tool using Itô Calculus
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Functions | Variables
Vec3.H File Reference

Class that represents a mathematical vector in 3-space. More...

#include <cassert>
#include <cmath>
#include <istream>
#include <ostream>
#include <type_traits>
#include <vector>
#include "Types.H"

Go to the source code of this file.

Classes

class  criptic::Vec3< T >
 Class that represents a mathematical vector. More...
 

Namespaces

namespace  criptic
 The primary namespace for criptic objects.
 

Typedefs

typedef Vec3< Realcriptic::RealVec
 
typedef Vec3< IdxTypecriptic::IdxVec
 
typedef Vec3< SignedIdxTypecriptic::SIdxVec
 
typedef Vec3< bool > criptic::BoolVec
 

Functions

template<class T , class U , std::enable_if_t< std::is_arithmetic< T >::value, bool > = true>
auto criptic::operator+ (const T &a, const Vec3< U > &v) -> Vec3< decltype(a+v[0])>
 Add a scalar and a Vec3 elementwise.
 
template<class T , class U , std::enable_if_t< std::is_arithmetic< T >::value, bool > = true>
auto criptic::operator- (const T &a, const Vec3< U > &v) -> Vec3< decltype(a-v[0])>
 Subtract a scalar from a Vec3 elementwise.
 
template<class T , class U , std::enable_if_t< std::is_arithmetic< T >::value, bool > = true>
auto criptic::operator* (const T &a, const Vec3< U > &v) -> Vec3< decltype(a *v[0])>
 Multiply a scalar by a Vec3 elementwise.
 
template<class T , class U , std::enable_if_t< std::is_arithmetic< T >::value, bool > = true>
auto criptic::operator/ (const T &a, const Vec3< U > &v) -> Vec3< decltype(a/v[0])>
 Divide a Vec3 by a scalar elementwise.
 
template<class T , class U , std::enable_if_t< std::is_arithmetic< T >::value||std::is_enum< T >::value, bool > = true>
Vec3< bool > criptic::operator== (const T &a, const Vec3< U > &v)
 Evaluate equality of a Vec3 with a scalar elementwise.
 
template<class T , class U , std::enable_if_t< std::is_arithmetic< T >::value||std::is_enum< T >::value, bool > = true>
Vec3< bool > criptic::operator!= (const T &a, const Vec3< U > &v)
 Evaluate inequality of a Vec3 with a scalar elementwise.
 
template<class T , class U >
auto criptic::min (const criptic::Vec3< T > &v1, const criptic::Vec3< U > &v2) -> Vec3< decltype(v1[0]+v2[0])>
 Return the elementwise minimum of two Vec3's.
 
template<class T , class U >
auto criptic::max (const criptic::Vec3< T > &v1, const criptic::Vec3< U > &v2) -> Vec3< decltype(v1[0]+v2[0])>
 Return the elementwise maximum of two Vec3's.
 
template<class T >
Vec3< T > criptic::floor (const criptic::Vec3< T > &v)
 Return the elementwise floor of a Vec3.
 
template<class T >
std::istream & operator>> (std::istream &is, criptic::Vec3< T > &v)
 ASCII-formatted read of Vec3 from stream.
 
template<class T >
std::ostream & operator<< (std::ostream &os, const criptic::Vec3< T > &v)
 ASCII-formatted output of Vec3 to stream.
 

Variables

static const RealVec criptic::zeroVec (0, 0, 0)
 
static const RealVec criptic::identityVec (1, 1, 1)
 
static const RealVec criptic::xHat (1, 0, 0)
 
static const RealVec criptic::yHat (0, 1, 0)
 
static const RealVec criptic::zHat (0, 0, 1)
 
static const IdxVec criptic::zeroIdxVec (0, 0, 0)
 
static const SIdxVec criptic::zeroSIdxVec (0, 0, 0)
 
static const BoolVec criptic::trueVec (1, 1, 1)
 
static const BoolVec criptic::falseVec (1, 1, 1)
 

Detailed Description

Class that represents a mathematical vector in 3-space.

This class represents a mathematical vector in 3-space, and provides basic vector algebra operations.

Function Documentation

◆ operator<<()

template<class T >
std::ostream & operator<< ( ostream &  os,
const Vec3< T > &  v 
)

ASCII-formatted output of Vec3 to stream.

Parameters
osThe stream to which to write
vThe Vec3 to write
Returns
The processed output stream

◆ operator>>()

template<class T >
std::istream & operator>> ( istream &  is,
Vec3< T > &  v 
)

ASCII-formatted read of Vec3 from stream.

Parameters
isThe stream to read from
vThe Vec3 in which to store the result
Returns
The processed input stream