first commit
This commit is contained in:
30
CS4451/proj5/utils.h
Normal file
30
CS4451/proj5/utils.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user