本文整理汇总了C++中Traits::construct_triangle_3_to_triangle_2_projection_object方法的典型用法代码示例。如果您正苦于以下问题:C++ Traits::construct_triangle_3_to_triangle_2_projection_object方法的具体用法?C++ Traits::construct_triangle_3_to_triangle_2_projection_object怎么用?C++ Traits::construct_triangle_3_to_triangle_2_projection_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Traits
的用法示例。
在下文中一共展示了Traits::construct_triangle_3_to_triangle_2_projection_object方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_boundary_mesh
void test_boundary_mesh()
{
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel, CGAL::Polyhedron_items_with_id_3> Polyhedron_3;
typedef CGAL::Surface_mesh_shortest_path_traits<Kernel, Polyhedron_3> Traits;
typedef Traits::Barycentric_coordinate Barycentric_coordinate;
typedef Traits::FT FT;
typedef Traits::Point_3 Point_3;
typedef Traits::Triangle_3 Triangle_3;
typedef boost::graph_traits<Polyhedron_3> Graph_traits;
typedef Graph_traits::vertex_descriptor vertex_descriptor;
typedef Graph_traits::vertex_iterator vertex_iterator;
typedef Graph_traits::face_descriptor face_descriptor;
typedef Graph_traits::face_iterator face_iterator;
typedef CGAL::Surface_mesh_shortest_path<Traits> Surface_mesh_shortest_path;
typedef boost::property_map<Polyhedron_3, CGAL::vertex_point_t>::type VPM;
Traits traits;
Traits::Construct_triangle_3_to_triangle_2_projection project_triangle_3_to_triangle_2(traits.construct_triangle_3_to_triangle_2_projection_object());
CGAL_USE(project_triangle_3_to_triangle_2);
Traits::Compute_squared_distance_3 compute_squared_distance_3(traits.compute_squared_distance_3_object());
Traits::Construct_barycenter_3 construct_barycenter_3(traits.construct_barycenter_3_object());
Traits::Construct_triangle_3_along_segment_2_flattening flatten_triangle_3_along_segment_2(traits.construct_triangle_3_along_segment_2_flattening_object());
CGAL_USE(flatten_triangle_3_along_segment_2);
Traits::Construct_barycentric_coordinate construct_barycentric_coordinate(traits.construct_barycentric_coordinate_object());
struct Construct_barycenter_in_triangle_3
{
Traits::Construct_barycenter_3 m_cb3;
Construct_barycenter_in_triangle_3(Traits::Construct_barycenter_3 cb3)
: m_cb3(cb3)
{
}
Point_3 operator() (const Triangle_3& t, const Barycentric_coordinate& b)
{
return m_cb3(t[0], b[0], t[1], b[1], t[2], b[2]);
}
} construct_barycenter_in_triangle_3(construct_barycenter_3);
std::ifstream inFile("data/boundary_mesh.off");
Polyhedron_3 P;
inFile >> P;
inFile.close();
CGAL::set_halfedgeds_items_id(P);
face_iterator startFace;
face_iterator endFace;
boost::tie(startFace, endFace) = CGAL::faces(P);
vertex_iterator currentVertex;
vertex_iterator endVertex;
VPM vpm = CGAL::get(CGAL::vertex_point, P);
vertex_descriptor vertexHandles[10];
face_descriptor faceHandles[8];
Point_3 vertexLocations[10];
size_t currentVertexIndex = 0;
for (boost::tie(currentVertex, endVertex) = CGAL::vertices(P); currentVertex != endVertex; ++currentVertex)
{
vertexHandles[currentVertexIndex] = *currentVertex;
vertexLocations[currentVertexIndex] = vpm[*currentVertex];
++currentVertexIndex;
}
size_t currentFaceIndex = 0;
for (face_iterator currentFace = startFace; currentFace != endFace; ++currentFace)
{
faceHandles[currentFaceIndex] = *currentFace;
++currentFaceIndex;
}
Barycentric_coordinate startLocation = construct_barycentric_coordinate(FT(0.1), FT(0.8), FT(0.1));
typedef boost::property_map<Polyhedron_3, CGAL::face_external_index_t>::type FaceIndexMap;
FaceIndexMap faceIndexMap(CGAL::get(CGAL::face_external_index, P));
Surface_mesh_shortest_path shortestPaths(P, traits);
//shortestPaths.m_debugOutput = true;
shortestPaths.add_source_point(*startFace, startLocation);
shortestPaths.build_sequence_tree();
Triangle_3 firstTriangle(vertexLocations[1], vertexLocations[0], vertexLocations[2]);
Point_3 locationInTriangle(construct_barycenter_in_triangle_3(firstTriangle, startLocation));
FT dist0 = shortestPaths.shortest_distance_to_source_points(vertexHandles[0]).first;
CHECK_CLOSE(dist0, CGAL::sqrt(compute_squared_distance_3(locationInTriangle, vertexLocations[0])), FT(0.000001));
//.........这里部分代码省略.........