vector.h
#ifndef VN_VECTOR_H_INCLUDED
#define VN_VECTOR_H_INCLUDED
#include "vn/util/compiler.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef union
{
float c[3];
/* Check if the compiler supports anonymous unions. */
#if defined(__STDC_VERSION___) && (__STDC_VERSION__ >= 201112L) && defined(__GNUC__)
struct
{
float x;
float y;
float z;
};
struct
{
float c0;
float c1;
float c2;
};
#endif
} vec3f;
typedef union
{
double c[3];
/* Check if the compiler supports anonymous unions. */
#if defined(__STDC_VERSION___) && (__STDC_VERSION__ >= 201112L) && defined(__GNUC__)
struct
{
double x;
double y;
double z;
};
struct
{
double c0;
double c1;
double c2;
};
#endif
} vec3d;
typedef union
{
float c[4];
/* Check if the compiler supports anonymous unions. */
#if (defined(__STDC_VERSION___) && (__STDC_VERSION__ >= 201112L)) && defined(__GNUC__)
struct
{
float x;
float y;
float z;
float w;
};
struct
{
float c0;
float c1;
float c2;
float c3;
};
#endif
} vec4f;
void vn_v3_init_fa(vec3f* v, const float* fa);
vec3d create_v3d(double x, double y, double z);
vec3f add_v3f_v3f(vec3f lhs, vec3f rhs);
vec3d add_v3d_v3d(vec3d lhs, vec3d rhs);
vec4f add_v4f_v4f(vec4f lhs, vec4f rhs);
vec3f sub_v3f_v3f(vec3f lhs, vec3f rhs);
vec3d sub_v3d_v3d(vec3d lhs, vec3d rhs);
vec4f sub_v4f_v4f(vec4f lhs, vec4f rhs);
void str_vec3f(char* out, vec3f v);
void str_vec3d(char* out, vec3d v);
void str_vec4f(char* out, vec4f v);
#ifdef __cplusplus
}
#endif
#endif
vec4f
Represents a 4 component vector with an underlying data type of float.
Definition: vector.h:68
vec3d
Represents a 3 component vector with an underlying data type of double.
Definition: vector.h:41
vec3f
Various vector types and operations.
Definition: vector.h:14