コード例 #1
0
ファイル: Matrix.c プロジェクト: devmario/IbizaEngine
Vector3D Matrix3DGetScale(Matrix3D mat) {
	Vector3D vec;
	vec.x = Vector3DLength(Vector3DInit(mat.m11, mat.m12, mat.m13));
	vec.y = Vector3DLength(Vector3DInit(mat.m21, mat.m22, mat.m23));
	vec.z = Vector3DLength(Vector3DInit(mat.m31, mat.m32, mat.m33));
	return vec;
}
コード例 #2
0
float clsObject::Distance(const VECTOR3D &vDst)
{
	VECTOR3D v = VECTOR3D(
					pos.x - vDst.x,
					pos.y - vDst.y,
					pos.z - vDst.z
				);
	return Vector3DLength(v);
}
コード例 #3
0
void clsObject::LookAt(const VECTOR3D &lookAt, const LPVECTOR3D upOrient)
{
	VECTOR3D lookDir	= lookAt - pos;
	VECTOR3D vUp		= abs(uWd.z) < EPSILON ? uWd : VECTOR3D(0, 0, 1) * uWd.z;

	if ( Vector3DLength(lookDir) > EPSILON )
	{
		if ( 
			upOrient != NULL
			&& Vector3DLength(*upOrient) > EPSILON 
		) Vector3DNormalize(*upOrient, vUp);

		Vector3DNormalize(lookDir, fWd);
		Vector3DMultV(vUp, fWd, rWd);
		Vector3DNormalize(rWd, rWd);
		if ( Vector3DLength(rWd) < EPSILON )
			rWd = VECTOR3D(0, 1, 0) 
				* (FLOAT)((uWd.z >= 0) - (uWd.z < 0));
		Vector3DMultV(fWd, rWd, uWd);
	}
}
コード例 #4
0
ファイル: Model.c プロジェクト: devmario/IbizaEngine
void ModelSetVertex(Model* model, Vector3D* vertex, int vertexLength) {
	model->vertexLength = vertexLength;
	model->vertex = vertex;
	float radius = 0.0f;
	for(int i = 0; i < model->vertexLength; i++) {
		float len = Vector3DLength(model->vertex[i]);
		if(len > radius) {
			model->maxLengthVertex = model->vertex[i];
			radius = len;
		}
	}
}
コード例 #5
0
ファイル: Math3D.cpp プロジェクト: vrishe/3d-editor-08-a
void Vector3DNormalize(const VECTOR3D &src, VECTOR3D &rslt) {
	float vLen = Vector3DLength(src);
	if ( vLen > EPSILON )
		rslt = src / vLen;
}