本文整理汇总了C++中Tr::locate方法的典型用法代码示例。如果您正苦于以下问题:C++ Tr::locate方法的具体用法?C++ Tr::locate怎么用?C++ Tr::locate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tr
的用法示例。
在下文中一共展示了Tr::locate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_pair
std::pair< OutputIterator, typename Tr::Geom_traits::FT>
test_coords(const Tr& T,
const typename Tr::Geom_traits::Point_3& p,
const typename Tr::Geom_traits::Vector_3& n,
const int& version, OutputIterator out)
{
typedef CGAL::Voronoi_intersection_2_traits_3<typename Tr::Geom_traits> I_traits;
//coordinate computation result types
typedef CGAL::Triple< OutputIterator, typename Tr::Geom_traits::FT, bool > Result_triple;
//the result type of the certified version:
typedef CGAL::Quadruple< OutputIterator, typename Tr::Geom_traits::FT, bool, bool > Result_quadruple;
typename Tr::Cell_handle start;
typename Tr::Geom_traits::FT norm = 1; // 1 for that default doesn't trigger an assert
//test different function calls
switch(version){
case 0:{
Result_triple result
= CGAL::surface_neighbor_coordinates_3(T, p,n,out);
assert(result.third);
norm = result.second;
break;}
case 1: {
Result_triple result =
CGAL::surface_neighbor_coordinates_3(T, p,out,I_traits(p,n));
assert(result.third);
norm = result.second; break;}
//both versions with locate:
case 2:{
start = T.locate(p);
Result_triple result = CGAL::surface_neighbor_coordinates_3(T, p, n, out, start);
assert(result.third);
norm = result.second; break;}
case 3: {
start = T.locate(p);
Result_triple result =
CGAL::surface_neighbor_coordinates_3(T, p, out, I_traits(p,n), start);
assert(result.third);
norm = result.second; break;}
//taking all points:
case 4: {
Result_triple result
= CGAL::surface_neighbor_coordinates_3(T.points_begin(),
T.points_end(), p, n,
out,
T.geom_traits());
assert(result.third);
norm = result.second; break;}
case 5: {
Result_triple result
= CGAL::surface_neighbor_coordinates_3(T.points_begin(),
T.points_end(), p,
out ,I_traits(p,n));
assert(result.third);
norm = result.second; break;}
//the last two with certification:
case 6: {
Result_quadruple
result = CGAL::surface_neighbor_coordinates_certified_3
(T.points_begin(), T.points_end(),p,n,
out, T.geom_traits());
assert(result.third && result.fourth);
norm = result.second; break;
}
case 7: {
Result_quadruple
result = CGAL::surface_neighbor_coordinates_certified_3
(T.points_begin(), T.points_end(),p, out ,I_traits(p,n));
assert(result.third && result.fourth);
norm = result.second;
break;
}
default:
std::cout << "Switch function calls: Nothing is tested. " <<
std::endl;
}
assert(norm > 0);
return std::make_pair(out, norm);
}
示例2: switch
OutputIterator
test_neighbors(const Tr& T, const typename Tr::Geom_traits::Point_3& p,
const typename Tr::Geom_traits::Vector_3& n,
const int& version,
OutputIterator out)
{
typedef CGAL::Voronoi_intersection_2_traits_3<typename Tr::Geom_traits> I_traits;
//the result type of the certified version:
typedef std::pair< OutputIterator, bool > NeighborIt_bool_pair;
typename Tr::Cell_handle start;
//test different function calls
switch(version)
{
case 0:{
//certified call with Kernel:
NeighborIt_bool_pair
result_pair = CGAL::surface_neighbors_certified_3(T.points_begin(),
T.points_end(), p, n,
out,
T.geom_traits());
assert(result_pair.second);
out = result_pair.first; break;}
case 1: {
//certified call with instantiated traits::
NeighborIt_bool_pair
result_pair = CGAL::surface_neighbors_certified_3(T.points_begin(),
T.points_end(), p,
out, I_traits(p,n));
assert(result_pair.second);
out =result_pair.first; break;}
//both versions with locate:
case 2:{
start = T.locate(p);
//certified call with Kernel and locate:
out =CGAL::surface_neighbors_3(T, p,n,out, start);
break;}
case 3: {
start = T.locate(p);
//with instantiated traits and locate:
out =CGAL::surface_neighbors_3(T,p,out, I_traits(p,n),start);
break;}
//taking all points:
case 4: {
//with instantiated traits and locate:
out =
CGAL::surface_neighbors_3(T,p,out,I_traits(p,n));
break;}
case 5: {
//certified call with Kernel and locate:
out =
CGAL::surface_neighbors_3(T, p,n,out);
break;}
//the last two with certification:
case 6: {
out =
CGAL::surface_neighbors_3(T.points_begin(),
T.points_end(),
p, out,I_traits(p,n));
break;
}
case 7: {
out =
CGAL::surface_neighbors_3(T.points_begin(),
T.points_end(),
p,n,out,T.geom_traits());
break;
}
default:
std::cout << "Switch function calls: Nothing is tested. " <<
std::endl;
}
return out;
}