⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svector.cpp

📁 实现烟雾模拟(smoke)的源代码
💻 CPP
字号:
//-------------------------------------------------------------------
// SVector.cpp - A vector math library.
// By: Aaron Hilton (c) 1/21/98
//-------------------------------------------------------------------
#include "stdafx.h"
#include "SVector.h"

//-------------------------------------------
// General utility functions.

//-------------------------------------------
// Prints the vector's coordinates to the "stderr" stream.
void SVector3D::Print(char *s )
{
	// If we have an informative string, then print it.
	if(s)
		fprintf(stderr, "%s\n", s);

	// Print the vector info.
	fprintf(stderr,">%12g\t%12g\t%12g\t%12g\n", (double)x, (double)y, (double)z, (double)w );
}

// Randomly generates a new vector.
void SVector3D::Rand()
{
	x = 1.f - 2.f * rnd();
	y = 1.f - 2.f * rnd();
	z = 1.f - 2.f * rnd();
}

//-------------------------------------------
// Calculates the equation of "b" to the power of "e".
Int	IPower( Int b, Int e )
{
	Int result = 1 ;

	// Loop the multiplication process for each exponent.
	while( e-- )
		result *= b ;

	return result;
}

⌨️ 快捷键说明

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