首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CGAL Triangulation_3上的颜色点

CGAL Triangulation_3上的颜色点
EN

Stack Overflow用户
提问于 2020-05-13 23:29:58
回答 1查看 175关注 0票数 0

我试图在CGAL上给点颜色到一个triangulation_3中。我只是以CGAL描述这里的例子为例

我对这个例子做了一个简单的修改,以便能够绘制三角剖分:

代码语言:javascript
复制
#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);上添加了哪种颜色,方法绘制总是在显示的窗口中显示相同的红色点:

我知道代码正在构造一个包含颜色信息的数据结构,但是它可以独立于绘图方法,所以我认为窗口没有显示绿色点,因为这不是点的颜色。如果是的话,用抽签法得到带绿点的三角剖分是什么方法?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-14 06:06:29

在当前的形式中,观看者无法改变顶点或边缘的颜色。

但是修改代码很容易。

  1. 在项目中复制文件3.h
  2. 编辑方法void compute_vertex(Vertex_const_handle vh) (此文件中的第92行)以使用以颜色为参数的add_point方法:add_point(vh->point(), vh->info());
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61786639

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档