本文整理汇总了C++中DVector::Dot方法的典型用法代码示例。如果您正苦于以下问题:C++ DVector::Dot方法的具体用法?C++ DVector::Dot怎么用?C++ DVector::Dot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DVector
的用法示例。
在下文中一共展示了DVector::Dot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupTestPoints
void LCPPolyDist<Dimension,FVector,DVector>::VerifyWithTestPoints (
const DVector* closest, int& statusCode)
{
DVector* testPoints1 = new1<DVector>(13);
DVector* testPoints2 = new1<DVector>(13);
SetupTestPoints(1, mNumFaces1, mNumPoints1, closest[0], mA1, mB1,
mPoints1, testPoints1);
SetupTestPoints(2, mNumFaces2, mNumPoints2, closest[1], mA2, mB2,
mPoints2, testPoints2);
double diffSq = 0.0;
double minValue = 0.0;
DVector diff;
int iLine = 0;
int jLine = 0;
// The min distance between generated points. Note that one of these
// points is the "solution".
int i;
for (i = 0; i < 13; ++i)
{
for (int j = 0; j < 13; ++j)
{
diff = testPoints1[i] - testPoints2[j];
diffSq = diff.Dot(diff);
if (i == 0 && j == 0)
{
minValue = diffSq;
}
else
{
if (diffSq < minValue)
{
minValue = diffSq;
iLine = i;
jLine = j;
}
}
}
}
diff = closest[0] - closest[1];
float distance = (float)diff.Dot(diff);
statusCode = SC_FOUND_SOLUTION;
if (distance > diffSq)
{
mLog << "Test points closer than solution points by ";
mLog << distance - diffSq << " squared units.\n";
if ((distance - diffSq > mVerifyMinDifference)
&& (iLine != 12 || jLine != 12))
{
statusCode = SC_TEST_POINTS_TEST_FAILED;
}
}
mLog << std::endl << " Solution points are separated by "
<< Mathf::Sqrt(distance);
mLog << " units." << std::endl;
mLog << "The smallest distance between test points is "
<< Mathf::Sqrt((float)minValue);
mLog << std::endl << "and occurs for (" << testPoints1[iLine][0];
for (i = 1; i < mDimension; ++i)
{
mLog << ", " << testPoints1[iLine][i];
}
mLog << ") and (" << testPoints2[jLine][0];
for (i = 1; i < mDimension; ++i)
{
mLog << ", " << testPoints2[jLine][i];
}
mLog << ")" << std::endl;
delete1(testPoints1);
delete1(testPoints2);
}