glVertex  5.5.2
Public Member Functions | Public Attributes | List of all members
vec2 Class Reference

2D double vector More...

#include <glslmath.h>

Public Member Functions

 vec2 ()
 default constructor
 
 vec2 (const vec2 &v)
 copy constructor
 
 vec2 (const double vx, const double vy)
 component-wise constructor
 
 vec2 (const double v)
 single-component constructor
 
const double * c_ptr () const
 const pointer to linear array
 
 operator const double * () const
 cast operator to linear array
 
double length () const
 get vector length
 
double norm () const
 get squared vector length
 
vec2 normalize () const
 normalize vector to unit length More...
 
double dot (const vec2 &v) const
 inner product
 
bool approx (const vec2 &v, const double e=1E-10) const
 test for approximate equality
 
vec2operator+= (const vec2 &v)
 inplace addition
 
vec2operator-= (const vec2 &v)
 inplace subtraction
 
vec2operator*= (double v)
 inplace multiplication
 
vec2operator*= (const vec2 &v)
 inplace multiplication
 
vec2 yx () const
 swizzeling operator
 
 operator std::string ()
 string cast operator
 
std::string to_string (std::string delimiter=", ", int space=0)
 conversion to string
 

Public Attributes

union {
}; 
 vector components
 

Detailed Description

2D double vector

Member Function Documentation

◆ normalize()

vec2 vec2::normalize ( ) const
inline

normalize vector to unit length

normalization to unit length


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