本文整理汇总了C++中TreeType::MinimumBoundDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeType::MinimumBoundDistance方法的具体用法?C++ TreeType::MinimumBoundDistance怎么用?C++ TreeType::MinimumBoundDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeType
的用法示例。
在下文中一共展示了TreeType::MinimumBoundDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckTrees
void CheckTrees(TreeType& tree,
TreeType& xmlTree,
TreeType& textTree,
TreeType& binaryTree)
{
const typename TreeType::Mat* dataset = &tree.Dataset();
// Make sure that the data matrices are the same.
if (tree.Parent() == NULL)
{
CheckMatrices(*dataset,
xmlTree.Dataset(),
textTree.Dataset(),
binaryTree.Dataset());
// Also ensure that the other parents are null too.
BOOST_REQUIRE_EQUAL(xmlTree.Parent(), (TreeType*) NULL);
BOOST_REQUIRE_EQUAL(textTree.Parent(), (TreeType*) NULL);
BOOST_REQUIRE_EQUAL(binaryTree.Parent(), (TreeType*) NULL);
}
// Make sure the number of children is the same.
BOOST_REQUIRE_EQUAL(tree.NumChildren(), xmlTree.NumChildren());
BOOST_REQUIRE_EQUAL(tree.NumChildren(), textTree.NumChildren());
BOOST_REQUIRE_EQUAL(tree.NumChildren(), binaryTree.NumChildren());
// Make sure the number of descendants is the same.
BOOST_REQUIRE_EQUAL(tree.NumDescendants(), xmlTree.NumDescendants());
BOOST_REQUIRE_EQUAL(tree.NumDescendants(), textTree.NumDescendants());
BOOST_REQUIRE_EQUAL(tree.NumDescendants(), binaryTree.NumDescendants());
// Make sure the number of points is the same.
BOOST_REQUIRE_EQUAL(tree.NumPoints(), xmlTree.NumPoints());
BOOST_REQUIRE_EQUAL(tree.NumPoints(), textTree.NumPoints());
BOOST_REQUIRE_EQUAL(tree.NumPoints(), binaryTree.NumPoints());
// Check that each point is the same.
for (size_t i = 0; i < tree.NumPoints(); ++i)
{
BOOST_REQUIRE_EQUAL(tree.Point(i), xmlTree.Point(i));
BOOST_REQUIRE_EQUAL(tree.Point(i), textTree.Point(i));
BOOST_REQUIRE_EQUAL(tree.Point(i), binaryTree.Point(i));
}
// Check that the parent distance is the same.
BOOST_REQUIRE_CLOSE(tree.ParentDistance(), xmlTree.ParentDistance(), 1e-8);
BOOST_REQUIRE_CLOSE(tree.ParentDistance(), textTree.ParentDistance(), 1e-8);
BOOST_REQUIRE_CLOSE(tree.ParentDistance(), binaryTree.ParentDistance(), 1e-8);
// Check that the furthest descendant distance is the same.
BOOST_REQUIRE_CLOSE(tree.FurthestDescendantDistance(),
xmlTree.FurthestDescendantDistance(), 1e-8);
BOOST_REQUIRE_CLOSE(tree.FurthestDescendantDistance(),
textTree.FurthestDescendantDistance(), 1e-8);
BOOST_REQUIRE_CLOSE(tree.FurthestDescendantDistance(),
binaryTree.FurthestDescendantDistance(), 1e-8);
// Check that the minimum bound distance is the same.
BOOST_REQUIRE_CLOSE(tree.MinimumBoundDistance(),
xmlTree.MinimumBoundDistance(), 1e-8);
BOOST_REQUIRE_CLOSE(tree.MinimumBoundDistance(),
textTree.MinimumBoundDistance(), 1e-8);
BOOST_REQUIRE_CLOSE(tree.MinimumBoundDistance(),
binaryTree.MinimumBoundDistance(), 1e-8);
// Recurse into the children.
for (size_t i = 0; i < tree.NumChildren(); ++i)
{
// Check that the child dataset is the same.
BOOST_REQUIRE_EQUAL(&xmlTree.Dataset(), &xmlTree.Child(i).Dataset());
BOOST_REQUIRE_EQUAL(&textTree.Dataset(), &textTree.Child(i).Dataset());
BOOST_REQUIRE_EQUAL(&binaryTree.Dataset(), &binaryTree.Child(i).Dataset());
// Make sure the parent link is right.
BOOST_REQUIRE_EQUAL(xmlTree.Child(i).Parent(), &xmlTree);
BOOST_REQUIRE_EQUAL(textTree.Child(i).Parent(), &textTree);
BOOST_REQUIRE_EQUAL(binaryTree.Child(i).Parent(), &binaryTree);
CheckTrees(tree.Child(i), xmlTree.Child(i), textTree.Child(i),
binaryTree.Child(i));
}
}