3dmath.h

来自「计算机图形学代码」· C头文件 代码 · 共 37 行

H
37
字号
#ifndef _3DMATH_H
#define _3DMATH_H

#include "main.h"


#define PI 3.1415926535897932

#define BEHIND		0	
#define INTERSECTS	1	
#define FRONT		2	


// This returns the absolute value of num - a simple if/else check
float absolute(float num);

//	This returns a perpendicular vector from 2 given vectors by taking the cross product.
tVector3 Cross(tVector3 vVector1, tVector3 vVector2);

// This returns the dot product between 2 vectors
float Dot(tVector3 vVector1, tVector3 vVector2);

//	This returns a normalize vector (A vector exactly of length 1)
tVector3 Normalize(tVector3 vNormal);

//	This returns the normal of a polygon (The direction the polygon is facing)
tVector3 Normal(tVector3 vTriangle[]);

//	This returns the magnitude of a normal (or any other vector)
float Magnitude(tVector3 vNormal);




#endif

//Ronny Andr

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?