Simulant  21.06-50
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
smlt::Vec3 Struct Reference

Public Member Functions

 Vec3 (float xyz)
 
 Vec3 (float x, float y)
 
 Vec3 (float x, float y, float z)
 
 Vec3 (const Vec2 &v2, float z)
 
 Vec3 (const Vec3 &v)=default
 
Vec3 operator+ (const Vec3 &rhs) const
 
Vec3operator+= (const Vec3 &rhs)
 
Vec3 operator- (const Vec3 &rhs) const
 
Vec3operator-= (const Vec3 &rhs)
 
Vec3 operator* (const Vec3 &rhs) const
 
Vec3 operator* (float rhs) const
 
Vec3 operator* (const Quaternion &rhs) const
 
Vec3operator*= (const Quaternion &rhs)
 
Vec3operator*= (float rhs)
 
Vec3operator/= (float rhs)
 
Vec3 operator/ (float rhs) const
 
bool equals (const Vec3 &rhs) const
 
bool operator== (const Vec3 &rhs) const
 
bool operator!= (const Vec3 &rhs) const
 
void set (float x, float y, float z)
 
float length () const
 
float length_squared () const
 
const Vec3 normalized () const
 
void normalize ()
 
Vec3 lerp (const Vec3 &end, float t) const
 
Vec3 rotated_by (const Quaternion &q) const
 
Vec3 rotated_by (const Mat3 &rot) const
 
Vec3 rotated_by (const Mat4 &rot) const
 
Vec3 transformed_by (const Mat4 &trans) const
 
Vec3 project_onto_vec3 (const Vec3 &projection_target) const
 
float dot (const Vec3 &rhs) const
 
Vec3 cross (const Vec3 &rhs) const
 
Vec3 limit (float l)
 
float distance_to (const AABB &aabb) const
 
Vec3 parallel_component (const Vec3 &unit_basis) const
 
Vec3 perpendicular_component (const Vec3 &unit_basis) const
 
Vec3 perpendicular () const
 
Vec3 random_deviant (const Degrees &angle, const Vec3 up=Vec3()) const
 
Vec2 xy () const
 
Vec4 xyzw (float w=1.0f) const
 
Quaternion rotation_to (const Vec3 &dir) const
 

Static Public Member Functions

template<typename Container >
static Vec3 find_average (const Container &vectors)
 
static float distance (const smlt::Vec3 &lhs, const smlt::Vec3 &rhs)
 
static float sqr_distance (const smlt::Vec3 &lhs, const smlt::Vec3 &rhs)
 

Public Attributes

float x
 
float y
 
float z
 

Static Public Attributes

static const Vec3 NEGATIVE_X = Vec3(-1, 0, 0)
 
static const Vec3 POSITIVE_X = Vec3(1, 0, 0)
 
static const Vec3 NEGATIVE_Y = Vec3(0, -1, 0)
 
static const Vec3 POSITIVE_Y = Vec3(0, 1, 0)
 
static const Vec3 POSITIVE_Z = Vec3(0, 0, 1)
 
static const Vec3 NEGATIVE_Z = Vec3(0, 0, -1)
 
static const Vec3 BACK = Vec3::POSITIVE_Z
 
static const Vec3 DOWN = Vec3::NEGATIVE_Y
 
static const Vec3 FORWARD = Vec3::NEGATIVE_Z
 
static const Vec3 LEFT = Vec3::NEGATIVE_X
 
static const Vec3 ONE = Vec3(1, 1, 1)
 
static const Vec3 RIGHT = Vec3::POSITIVE_X
 
static const Vec3 UP = Vec3::POSITIVE_Y
 
static const Vec3 ZERO = Vec3()
 

Friends

struct Quaternion
 
struct Mat4
 
struct Mat3
 
struct Vec2
 
struct Ray
 
std::ostream & operator<< (std::ostream &stream, const Vec3 &vec)
 

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