ArduinoProjects / Libraries / Math / MathTypes.h

//Author: Jody McAdams
//Website: http://www.jodymcadams.com
//Company Website: http://www.gamejellyonline.com

#ifndef __MATH_TYPES
#define __MATH_TYPES

#define PI 3.141592653589f
#define PI_2 (2.0f*PI)

#define PI_DIV_2 (PI*0.5f)
#define PI_DIV_4 (PI*0.25f)

typedef float f32;
typedef double f64;
typedef signed int	s32;
typedef signed long int sl32;
typedef unsigned int u32;
typedef unsigned long ul32;
typedef char s8;
typedef unsigned char u8;
typedef unsigned short u16;
typedef signed short s16;
typedef float mat4f[16];
typedef float mat3f[9];

#if DEBUG
	#define tconst 
#else
	#define tconst const
#endif

typedef struct
{
	f32 x;
	f32 y;
}  vec2;

typedef struct
{
	s32 x;
	s32 y;
}  intVec2;

typedef struct
{
	f32 x;
	f32 y;
	f32 z;
}  vec3;

typedef struct
{
	f32 x;
	f32 y;
	f32 z;
	f32 w;
}  vec4;

vec4 MakeVec4(float singleValue);

struct PlaneVec2 {
	vec2 point;
	vec2 normal;
};

struct PlaneVec3 {
	vec3 point;
	vec3 normal;
};

struct DistanceTableEntry
{
	f32 t;
	f32 distance;
};

extern const vec3 vec3_up;
extern const vec3 vec3_down;
extern const vec3 vec3_at;
extern const vec3 vec3_away;
extern const vec3 vec3_left;
extern const vec3 vec3_right;
extern const vec3 vec3_zero;
extern const vec2 vec2_zero;
extern const vec2 vec2_up;
extern const vec2 vec2_left;
extern const vec2 vec2_right;
extern const vec4 vec4_one;

#endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.