当前位置: 首页>>代码示例>>C++>>正文


C++ MathVector::size方法代码示例

本文整理汇总了C++中MathVector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ MathVector::size方法的具体用法?C++ MathVector::size怎么用?C++ MathVector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MathVector的用法示例。


在下文中一共展示了MathVector::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: temp

// overloaded multiplication of matrix by a vector 
MathVector MathMatrix::operator*(const MathVector& v) const
{
	if (n != v.size()) { throw "Matrix and Vector do not"; }
	//Create matrix object of the correct size to hold the resulting matrix from multiplication
	MathVector temp(v.size());
	//Go across the rows of the matrix the method was called on
	for (int i=0; i<nrows; i++)
	{
		//Declare empty variable to hold the multiplication result
		double sum = 0;
		//Go across the columns on the matrix that was passed as a parameter
		for (int j=0; j<ncols; j++)
		{
			sum+=(*this)(i, j) * v[0];
		}
		//Set element in temp at the corresponding loop iteration index to the result
		temp[i] = sum;
	}
	return temp;
}
开发者ID:SaqibHussain,项目名称:C--_Code_Examples,代码行数:21,代码来源:MathMatrix.cpp

示例2: normal

MathVector Math::normal(MathVector a, MathVector b, MathVector c)
{
MathVector r1;
MathVector r2;
MathVector output;
	r2=c-b;
	r1=b-a;
	output = r1.cross(r2);
	output=(1.0f/output.size())*output;
	return output;
}
开发者ID:jshmrsn,项目名称:Chalkboard-for-Mac,代码行数:11,代码来源:Math.cpp

示例3: MathVector

Quat Math::rot2Quat( MathVector in)
{
	MathVector inv = in;
	Quat nq;
	double invs;
	double phi;
	MathVector unitV;
	invs = inv.size();
		if(invs != 0)
		{
			unitV = 1/invs * inv ;
		}
		else
		{
			unitV = MathVector(1,0,0);
		}
	phi = invs * 3.14159265/180;
	nq.v = sin(phi/2) * unitV;
	nq.scale = cos(phi/2);
	return nq;
}
开发者ID:jshmrsn,项目名称:Chalkboard-for-Mac,代码行数:21,代码来源:Math.cpp

示例4: distance

double Math::distance(MathVector a, MathVector b)
{
	MathVector delta = a - b;
	return delta.size();
}
开发者ID:jshmrsn,项目名称:Chalkboard-for-Mac,代码行数:5,代码来源:Math.cpp

示例5: size

double Math::size(MathVector in)
{
	return in.size();
}
开发者ID:jshmrsn,项目名称:Chalkboard-for-Mac,代码行数:4,代码来源:Math.cpp


注:本文中的MathVector::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。