本文整理汇总了C++中MultiVector::at方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiVector::at方法的具体用法?C++ MultiVector::at怎么用?C++ MultiVector::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiVector
的用法示例。
在下文中一共展示了MultiVector::at方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_rotate
void test_rotate()
{
QVector<Vector> axis(MultiVector::count()), vec(MultiVector::count());
QVector<double> angle(MultiVector::count());
QVector<Vector> result(MultiVector::count());
for (int i=0; i<MultiVector::count(); ++i)
{
axis[i] = rangen.vectorOnSphere(1);
vec[i] = rangen.vectorOnSphere(5);
angle[i] = rangen.rand(-2.0*SireMaths::pi, 2.0*SireMaths::pi);
result[i] = Quaternion(Angle(angle[i]),axis[i]).rotate(vec[i]);
}
MultiVector maxis(axis);
MultiVector mvec(vec);
MultiDouble mangle(angle);
MultiVector mresult = MultiQuaternion(mangle, maxis).rotate(mvec);
for (int i=0; i<MultiVector::count(); ++i)
{
for (int j=0; j<3; ++j)
{
assert_nearly_equal( mresult.at(i)[j], result[i][j], 1e-5 );
}
}
}
示例2: test_cross
void test_cross()
{
QVector<Vector> v0(MultiVector::count()), v1(MultiVector::count());
QVector<Vector> cross(MultiVector::count());
for (int i=0; i<MultiVector::count(); ++i)
{
v0[i] = rangen.vectorOnSphere(5);
v1[i] = rangen.vectorOnSphere(5);
cross[i] = Vector::cross(v0[i], v1[i]);
}
MultiVector mv0(v0);
MultiVector mv1(v1);
MultiVector mcross = MultiVector::cross(mv0, mv1);
for (int i=0; i<MultiVector::count(); ++i)
{
assert_equal( mcross.at(i), cross.at(i) );
}
}