Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Computational geometry 平面网格与多边形网格的相交——CGAL中的共面三角形处理_Computational Geometry_Cgal - Fatal编程技术网

Computational geometry 平面网格与多边形网格的相交——CGAL中的共面三角形处理

Computational geometry 平面网格与多边形网格的相交——CGAL中的共面三角形处理,computational-geometry,cgal,Computational Geometry,Cgal,我想在渲染3D多边形网格的2D切片时使用CGAL替换vtkCutter。为了获得高性能,我使用AABB_树,实际上,生成交叉点的速度要快得多。但是,当三角形(或其边)与查询平面共面时,结果是相当任意的-可能是由于数值舍入问题。因为我需要高性能,所以我使用Simple\u笛卡尔内核 有没有办法控制CGAL中的这种行为?例如,我是否可以指定某种公差,以便如果三角形的两点与平面之间的公差在该公差范围内,则认为边位于该平面内 干杯, 罗斯蒂斯拉夫 守则: #include <iostream>

我想在渲染3D多边形网格的2D切片时使用CGAL替换vtkCutter。为了获得高性能,我使用AABB_树,实际上,生成交叉点的速度要快得多。但是,当三角形(或其边)与查询平面共面时,结果是相当任意的-可能是由于数值舍入问题。因为我需要高性能,所以我使用
Simple\u笛卡尔
内核

有没有办法控制CGAL中的这种行为?例如,我是否可以指定某种公差,以便如果三角形的两点与平面之间的公差在该公差范围内,则认为边位于该平面内

干杯, 罗斯蒂斯拉夫

守则:

#include <iostream>
#include <list>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_face_graph_triangle_primitive.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>

typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Point_3 Point;
typedef K::Vector_3 Vector;
typedef K::Plane_3 Plane;
typedef K::Segment_3 Segment;
typedef K::Triangle_3 Triangle;
typedef CGAL::Polyhedron_3<K> Polyhedron;
typedef std::list<Segment>::iterator Iterator;
typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron, CGAL::Default, CGAL::Tag_false> Primitive; 
typedef CGAL::AABB_traits<K, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;

int main()
{
    Polyhedron polyhedron;
    std::ifstream inFile("mesh.off");
    inFile >> polyhedron;

    std::ifstream planeIn("plane.txt");

    double a[9];
    for (int i = 0; i < 9; ++i) {
        planeIn >> a[i];
    }


    Tree tree(polyhedron.facets_begin(), polyhedron.facets_end(), polyhedron);
    tree.accelerate_distance_queries();

    Point points[] = { { a[0], a[1], a[2] }, { a[3], a[4], a[5] }, { a[6], a[7], a[8] } };
    Plane plane_query(points[0], points[1], points[2]);

    std::vector<Tree::Intersection_and_primitive_id<Plane>::Type> segments;

    tree.all_intersections(plane_query, std::back_inserter(segments));

    return EXIT_SUCCESS;
}
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
typedef CGAL::简单笛卡尔K;
类型定义K::英尺;
类型定义K::点_3点;
typedef K::Vector_3 Vector;
类型定义K::平面_3平面;
类型定义K::段_3段;
typedef K::Triangle_3 Triangle;
typedef CGAL::多面体_3多面体;
typedef std::list::迭代器迭代器;
typedef CGAL::AABB_face_graph_triangle_primitive;
类型定义CGAL::AABB_性状;
typedef CGAL::AABB_树;
int main()
{
多面体多面体;
标准::ifstream infle(“网格关闭”);
填充>>多面体;
std::ifstream planeIn(“plane.txt”);
双a[9];
对于(int i=0;i<9;++i){
planeIn>>a[i];
}
树形树(多面体.facets_begin(),多面体.facets_end(),多面体);
树。加速距离查询();
点[]={{a[0],a[1],a[2]},{a[3],a[4],a[5]},{a[6],a[7],a[8]};
平面查询(点[0],点[1],点[2]);
std::向量段;
树。所有交叉点(平面查询、标准::背面插入器(段));
返回退出成功;
}

您使用的是AABB树中的哪些函数?@slorio我使用的是“所有交点”函数。@slorio我添加了代码,以便清楚地知道我在做什么。从上周开始,您找到问题的答案了吗?@lrineau很遗憾,没有。