【发布时间】:2020-05-13 23:29:58
【问题描述】:
我正在尝试为 CGAL 上的 triangulation_3 中的点赋予颜色。我只是以 CGAL describe here 中的例子为例
我对这个例子做了一个简单的修改,以便能够绘制三角剖分:
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Delaunay_triangulation_cell_base_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <CGAL/IO/Color.h>
#include <CGAL/draw_triangulation_3.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_with_info_3<CGAL::Color, K> Vb;
typedef CGAL::Delaunay_triangulation_cell_base_3<K> Cb;
typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Delaunay;
typedef Delaunay::Point Point;
int main()
{
Delaunay T;
T.insert(Point(0,0,0));
T.insert(Point(1,0,0));
T.insert(Point(0,1,0));
T.insert(Point(0,0,1));
T.insert(Point(2,2,2));
T.insert(Point(-1,0,1));
// Set the color of finite vertices of degree 6 to red.
Delaunay::Finite_vertices_iterator vit;
for (Delaunay::Vertex_handle v : T.finite_vertex_handles())
if (T.degree(v) == 6)
v->info() = CGAL::Color(0,255,0);
CGAL::draw(T);
return 0;
}
但是无论我在v->info() = CGAL::Color(0,255,0); 上涂上哪种颜色,draw 方法总是在显示的窗口中给出相同的红点:
我知道代码正在构建一个包含颜色信息的数据结构,但这可能与 draw 方法无关,所以我认为窗口没有显示绿点,因为这不是给点着色的方法.如果是这样,使用draw方法获得绿点三角剖分的方法是什么?'。
【问题讨论】:
标签: colors point cgal triangulation