Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions | Variables
geom.hpp File Reference

mathmatics for vectors, matrices, quaterions and more More...

#include <boost/algorithm/clamp.hpp>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include "inexor/shared/cube_loops.hpp"
#include "inexor/shared/cube_types.hpp"

Go to the source code of this file.

Classes

struct  vec2
 2-dimensional float vectors More...
 
struct  vec
 vector with 3 floats and some useful methods. More...
 
struct  vec4
 4-dimensional float vector all methods stay basicly the same but with an extra dimension More...
 
struct  quat
 quaternions are number systems that extend complex numbers complex numbers extend the number system of real numbers in a way so x=-1 can be solved in this example x = i (imaginary). More...
 
struct  dualquat
 
struct  matrix3
 
struct  matrix4x3
 
struct  plane
 
struct  triangle
 triangle interface does not inherit from vec because 3 members (the 3 vertices) are required to describe a triangle More...
 
struct  ivec
 3-dimensional INTEGER vectors More...
 
struct  ivec2
 2 dimensional integer vector. More...
 
struct  ivec4
 4 dimensional integer vector. More...
 
struct  bvec
 3-dimensional UNSIGNED CHAR vector. More...
 
struct  bvec4
 
struct  usvec
 3 dimensional vector containing unsigned shorts. More...
 
struct  svec
 3 dimensional vector containing shorts. More...
 
struct  svec2
 2 dimensional vector containing shorts. More...
 
struct  dvec4
 
struct  matrix4
 
struct  matrix2
 
struct  squat
 
union  vec2.__unnamed__
 
struct  vec2.__unnamed__.__unnamed__
 
union  vec.__unnamed__
 memory union which contains position, color or 3 float values please note that only one of these members can be accessed! More...
 
struct  vec.__unnamed__.__unnamed__
 
struct  vec.__unnamed__.__unnamed__
 
union  vec4.__unnamed__
 
struct  vec4.__unnamed__.__unnamed__
 
struct  vec4.__unnamed__.__unnamed__
 
union  ivec.__unnamed__
 
struct  ivec.__unnamed__.__unnamed__
 
struct  ivec.__unnamed__.__unnamed__
 
union  ivec2.__unnamed__
 
struct  ivec2.__unnamed__.__unnamed__
 
union  ivec4.__unnamed__
 
struct  ivec4.__unnamed__.__unnamed__
 
struct  ivec4.__unnamed__.__unnamed__
 
union  bvec.__unnamed__
 
struct  bvec.__unnamed__.__unnamed__
 
struct  bvec.__unnamed__.__unnamed__
 
union  bvec4.__unnamed__
 
struct  bvec4.__unnamed__.__unnamed__
 
struct  bvec4.__unnamed__.__unnamed__
 
union  usvec.__unnamed__
 
struct  usvec.__unnamed__.__unnamed__
 
union  svec.__unnamed__
 
struct  svec.__unnamed__.__unnamed__
 
union  svec2.__unnamed__
 
struct  svec2.__unnamed__.__unnamed__
 

Functions

static bool htcmp (const vec2 &x, const vec2 &y)
 hashtable comparison function More...
 
static uint hthash (const vec2 &k)
 hashtable hashing function to create unique key More...
 
static bool htcmp (const vec &x, const vec &y)
 hashtable comparism function More...
 
static uint hthash (const vec &k)
 hashtable hashing function to create unique key More...
 
static bool htcmp (const ivec &x, const ivec &y)
 
static uint hthash (const ivec &k)
 
static bool htcmp (const ivec2 &x, const ivec2 &y)
 
static uint hthash (const ivec2 &k)
 
static bool htcmp (const ivec4 &x, const ivec4 &y)
 
static uint hthash (const ivec4 &k)
 
bool raysphereintersect (const vec &center, float radius, const vec &o, const vec &ray, float &dist)
 physics engine: collision (intersection) check functions More...
 
bool rayboxintersect (const vec &b, const vec &s, const vec &o, const vec &ray, float &dist, int &orient)
 
bool linecylinderintersect (const vec &from, const vec &to, const vec &start, const vec &end, float radius, float &dist)
 
static int mod360 (int angle)
 
static const vec2sincosmod360 (int angle)
 
static float cos360 (int angle)
 
static float sin360 (int angle)
 
static float tan360 (int angle)
 
static float cotan360 (int angle)
 

Variables

const int R [3] = {1, 2, 0}
 
const int C [3] = {2, 0, 1}
 
const int D [3] = {0, 1, 2}
 
const vec2 sincos360 []
 sine and cosine values are stored in approximated valuey because calculating them in realtime would be too slow More...
 

Detailed Description

mathmatics for vectors, matrices, quaterions and more


Class Documentation

union vec2.__unnamed__
Class Members
__unnamed__ __unnamed__
float v[2]
struct vec2.__unnamed__.__unnamed__
Class Members
float x
float y
union vec.__unnamed__

memory union which contains position, color or 3 float values please note that only one of these members can be accessed!

Class Members
__unnamed__ __unnamed__
__unnamed__ __unnamed__
float v[3]
struct vec.__unnamed__.__unnamed__
Class Members
float x
float y
float z
struct vec.__unnamed__.__unnamed__
Class Members
float b
float g
float r
union vec4.__unnamed__
Class Members
__unnamed__ __unnamed__
__unnamed__ __unnamed__
float v[4]
struct vec4.__unnamed__.__unnamed__
Class Members
float w
float x
float y
float z
struct vec4.__unnamed__.__unnamed__
Class Members
float a
float b
float g
float r
union ivec.__unnamed__
Class Members
__unnamed__ __unnamed__
__unnamed__ __unnamed__
int v[3]
struct ivec.__unnamed__.__unnamed__
Class Members
int x
int y
int z
struct ivec.__unnamed__.__unnamed__
Class Members
int b
int g
int r
union ivec2.__unnamed__
Class Members
__unnamed__ __unnamed__
int v[2]
struct ivec2.__unnamed__.__unnamed__
Class Members
int x
int y
union ivec4.__unnamed__
Class Members
__unnamed__ __unnamed__
__unnamed__ __unnamed__
int v[4]
struct ivec4.__unnamed__.__unnamed__
Class Members
int w
int x
int y
int z
struct ivec4.__unnamed__.__unnamed__
Class Members
int a
int b
int g
int r
union bvec.__unnamed__
Class Members
__unnamed__ __unnamed__
__unnamed__ __unnamed__
uchar v[3]
struct bvec.__unnamed__.__unnamed__
Class Members
uchar x
uchar y
uchar z
struct bvec.__unnamed__.__unnamed__
Class Members
uchar b
uchar g
uchar r
union bvec4.__unnamed__
Class Members
__unnamed__ __unnamed__
__unnamed__ __unnamed__
uint mask
uchar v[4]
struct bvec4.__unnamed__.__unnamed__
Class Members
uchar w
uchar x
uchar y
uchar z
struct bvec4.__unnamed__.__unnamed__
Class Members
uchar a
uchar b
uchar g
uchar r
union usvec.__unnamed__
Class Members
__unnamed__ __unnamed__
ushort v[3]
struct usvec.__unnamed__.__unnamed__
Class Members
ushort x
ushort y
ushort z
union svec.__unnamed__
Class Members
__unnamed__ __unnamed__
short v[3]
struct svec.__unnamed__.__unnamed__
Class Members
short x
short y
short z
union svec2.__unnamed__
Class Members
__unnamed__ __unnamed__
short v[2]
struct svec2.__unnamed__.__unnamed__
Class Members
short x
short y

Function Documentation

static float cos360 ( int  angle)
inlinestatic
static float cotan360 ( int  angle)
inlinestatic
static bool htcmp ( const vec2 x,
const vec2 y 
)
inlinestatic

hashtable comparison function

static bool htcmp ( const vec x,
const vec y 
)
inlinestatic

hashtable comparism function

static bool htcmp ( const ivec x,
const ivec y 
)
inlinestatic
static bool htcmp ( const ivec2 x,
const ivec2 y 
)
inlinestatic
static bool htcmp ( const ivec4 x,
const ivec4 y 
)
inlinestatic
static uint hthash ( const vec2 k)
inlinestatic

hashtable hashing function to create unique key

References f().

static uint hthash ( const vec k)
inlinestatic

hashtable hashing function to create unique key

References f().

static uint hthash ( const ivec k)
inlinestatic
static uint hthash ( const ivec2 k)
inlinestatic
static uint hthash ( const ivec4 k)
inlinestatic
bool linecylinderintersect ( const vec from,
const vec to,
const vec start,
const vec end,
float  radius,
float &  dist 
)
static int mod360 ( int  angle)
inlinestatic

Referenced by sincosmod360().

bool rayboxintersect ( const vec b,
const vec s,
const vec o,
const vec ray,
float &  dist,
int &  orient 
)
bool raysphereintersect ( const vec center,
float  radius,
const vec o,
const vec ray,
float &  dist 
)

physics engine: collision (intersection) check functions

References hmap::d, vec::dot(), vec::squaredlen(), and vec::sub().

static float sin360 ( int  angle)
inlinestatic
static const vec2& sincosmod360 ( int  angle)
inlinestatic

References mod360().

Referenced by mmintersect().

static float tan360 ( int  angle)
inlinestatic

Variable Documentation

const int C[3] = {2, 0, 1}
const int D[3] = {0, 1, 2}
const int R[3] = {1, 2, 0}
const vec2 sincos360[]

sine and cosine values are stored in approximated valuey because calculating them in realtime would be too slow