31 lines
688 B
C
31 lines
688 B
C
#ifndef _UTILS_H_
|
|
#define _UTILS_H_
|
|
|
|
#include <GL/glut.h>
|
|
#include <math.h>
|
|
|
|
#include "structs.h"
|
|
|
|
inline void cross(Vector& dest, Point& a, Point& b) {
|
|
dest.i = ( (a.y*b.z) - (a.z*b.y) ); //i
|
|
dest.j = ( (a.z*b.x) - (a.x*b.z) ); //j
|
|
dest.k = ( (a.x*b.y) - (a.y*b.x) ); //k
|
|
}
|
|
|
|
inline void cross(Point& dest, Point& a, Point& b) {
|
|
dest.x = ( (a.y*b.z) - (a.z*b.y) ); //i
|
|
dest.y = ( (a.z*b.x) - (a.x*b.z) ); //j
|
|
dest.z = ( (a.x*b.y) - (a.y*b.x) ); //k
|
|
}
|
|
|
|
|
|
inline GLfloat dot(Vector &a, Vector &b) {
|
|
return (a.i*b.i)+(a.j*b.j)+(a.k*b.k);
|
|
}
|
|
|
|
inline GLfloat dot(Point &a, Point &b) {
|
|
return (a.x*b.x)+(a.y*b.y)+(a.z*b.z);
|
|
}
|
|
|
|
#endif
|