Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Friends | List of all members
vec2 Struct Reference

2-dimensional float vectors More...

#include <geom.hpp>

Public Member Functions

 vec2 ()
 
 vec2 (float x, float y)
 
 vec2 (const vec &v)
 
 vec2 (const vec4 &v)
 
float & operator[] (int i)
 
float operator[] (int i) const
 
bool operator== (const vec2 &o) const
 
bool operator!= (const vec2 &o) const
 
bool iszero () const
 
float dot (const vec2 &o) const
 
float squaredlen () const
 
float magnitude () const
 
vec2normalize ()
 
float cross (const vec2 &o) const
 
vec2mul (float f)
 
vec2mul (const vec2 &o)
 
vec2div (float f)
 
vec2div (const vec2 &o)
 
vec2add (float f)
 
vec2add (const vec2 &o)
 
vec2sub (float f)
 
vec2sub (const vec2 &o)
 
vec2neg ()
 
vec2min (const vec2 &o)
 
vec2max (const vec2 &o)
 
vec2min (float f)
 
vec2max (float f)
 
vec2abs ()
 
vec2clamp (float l, float h)
 
vec2reflect (const vec2 &n)
 
vec2lerp (const vec2 &b, float t)
 
vec2lerp (const vec2 &a, const vec2 &b, float t)
 
template<class B >
vec2madd (const vec2 &a, const B &b)
 
template<class B >
vec2msub (const vec2 &a, const B &b)
 

Public Attributes

union {
   struct {
float x
 
float y
 
   } 
 
float v [2]
 
}; 
 

Friends

std::ostream & operator<< (std::ostream &os, const vec2 &v)
 Output operator, used for simple << vec2 << functionality: "(x, y)" You may want to set the precision beforehand with std::setprecision() More...
 

Detailed Description

2-dimensional float vectors

Constructor & Destructor Documentation

vec2::vec2 ( )
inline

Referenced by madd(), and msub().

vec2::vec2 ( float  x,
float  y 
)
inline
vec2::vec2 ( const vec v)
inlineexplicit
vec2::vec2 ( const vec4 v)
explicit

Member Function Documentation

vec2& vec2::abs ( )
inline
vec2& vec2::add ( float  f)
inline

References f().

Referenced by madd(), mergevslot(), setupsurface(), and BIH::triintersect().

vec2& vec2::add ( const vec2 o)
inline
vec2& vec2::clamp ( float  l,
float  h 
)
inline
float vec2::cross ( const vec2 o) const
inline
vec2& vec2::div ( float  f)
inline
vec2& vec2::div ( const vec2 o)
inline
float vec2::dot ( const vec2 o) const
inline

Referenced by reflect(), setupsurface(), and squaredlen().

bool vec2::iszero ( ) const
inline

Referenced by addcubeverts().

vec2& vec2::lerp ( const vec2 b,
float  t 
)
inline

Referenced by addtris().

vec2& vec2::lerp ( const vec2 a,
const vec2 b,
float  t 
)
inline
template<class B >
vec2& vec2::madd ( const vec2 a,
const B &  b 
)
inline

References add(), mul(), and vec2().

float vec2::magnitude ( ) const
inline

References squaredlen().

Referenced by normalize().

vec2& vec2::max ( const vec2 o)
inline

References inexor::rpc::max().

Referenced by game::renderplayerpreview().

vec2& vec2::max ( float  f)
inline

References inexor::rpc::max().

vec2& vec2::min ( const vec2 o)
inline

References inexor::rpc::min().

vec2& vec2::min ( float  f)
inline

References inexor::rpc::min().

template<class B >
vec2& vec2::msub ( const vec2 a,
const B &  b 
)
inline

References mul(), sub(), and vec2().

vec2& vec2::mul ( float  f)
inline

References f().

Referenced by madd(), msub(), normalize(), setupsurface(), and BIH::triintersect().

vec2& vec2::mul ( const vec2 o)
inline
vec2& vec2::neg ( )
inline

Referenced by setupsurface().

vec2& vec2::normalize ( )
inline

References magnitude(), and mul().

bool vec2::operator!= ( const vec2 o) const
inline
bool vec2::operator== ( const vec2 o) const
inline
float& vec2::operator[] ( int  i)
inline
float vec2::operator[] ( int  i) const
inline
vec2& vec2::reflect ( const vec2 n)
inline

References dot().

float vec2::squaredlen ( ) const
inline

References dot().

Referenced by magnitude(), and setupsurface().

vec2& vec2::sub ( float  f)
inline

References f().

Referenced by msub(), setupsurface(), and BIH::triintersect().

vec2& vec2::sub ( const vec2 o)
inline

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const vec2 v 
)
friend

Output operator, used for simple << vec2 << functionality: "(x, y)" You may want to set the precision beforehand with std::setprecision()

Member Data Documentation

union { ... }

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