CGAL库——学习一
来源:互联网 发布:百度贴吧网络连接失败 编辑:程序博客网 时间:2024/05/02 04:17
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>#include <CGAL/Triangulation_3.h>#include <iostream>#include <fstream>#include <cassert>#include <list>#include <vector>using namespace std;typedef CGAL::Exact_predicates_inexact_constructions_kernel K;typedef CGAL::Triangulation_3<K> Triangulation;typedef Triangulation::Cell_handle Cell_handle;typedef Triangulation::Vertex_handle Vertex_handle;typedef Triangulation::Locate_type Locate_type;typedef Triangulation::Point Point;int main(){ // construction from a list of points : std::list<Point> L; // L.push_front(Point(0,0,0)); //增加一point到链表头。 //这个时候list L 应该是 (0,1,0) (1,0,0) (0,0,0) L.push_front(Point(1,0,0)); L.push_front(Point(0,1,0)); //这个函数直接就构成TIN了嘛?原理是什么 直接声明就构成TIN了?还有合理不合理啊? 确实是直接构成TIN了! 而且合法 也就是直接定义而且赋值了! Triangulation T(L.begin(), L.end()); T.is_valid(); std::cout<<T.is_valid()<<endl; Triangulation::size_type n = T.number_of_vertices(); // insertion from a vector : std::vector<Point> V(3); V[0] = Point(0,0,1); V[1] = Point(1,1,1); V[2] = Point(2,2,2); n = n + T.insert(V.begin(), V.end()); //这个函数既insert了这几个点,而且return了几个点。 assert( n == 6 ); // 6 points have been inserted assert( T.is_valid() ); // checking validity of T Locate_type lt; int li, lj; Point p(0,0,0); Cell_handle c = T.locate(p, lt, li, lj); // // p is the vertex of c of index li : //If the k-face is a cell, li and lj have no meaning; if it is a facet (resp. vertex), //li gives the index of the facet (resp. vertex) and lj has no meaning; if it is and edge, li and lj give the indices of its vertices. assert( lt == Triangulation::VERTEX ); assert( c->vertex(li)->point() == p ); Vertex_handle v = c->vertex( (li+1)&3 ); // v is another vertex of c Cell_handle nc = c->neighbor(li); // nc = neighbor of c opposite to the vertex associated with p // nc must have vertex v : int nli; assert( nc->has_vertex( v, nli ) ); // nli is the index of v in nc std::ofstream oFileT("output",std::ios::out); // writing file output; oFileT << T; Triangulation T1; std::ifstream iFileT("output",std::ios::in); // reading file output; iFileT >> T1; assert( T1.is_valid() ); assert( T1.number_of_vertices() == T.number_of_vertices() ); assert( T1.number_of_cells() == T.number_of_cells() ); getchar(); return 0;}
0 0
- CGAL库——学习一
- CGAL——学习2
- CGAL——学习3
- CGAL 学习之—Triangulation_2
- CGAL库
- CGAL库
- cgal学习的苦恼
- CGAL中数值求解示例—OpenNL
- CGAL中数值求解示例—OpenNL
- CGAL
- CGAL
- cgal学习之QT篇
- CGAL 4.11 官方文档 软件包概述 ——多边形类
- CGAL 计算机几何算法库
- CGAL 计算机几何算法库
- CGAL中2D Arrangements学习笔记
- 2017.4.28开始学习PCL,CGAL
- CGAL 4.10 官方文档 软件包概述 ——算术与代数类
- Android studio下载与安装
- SpringMVC 重定向
- 一 javase学习记录07
- IBM高级工程师谈数据湖管理
- 链表做题总结
- CGAL库——学习一
- Redis:ERR Client sent AUTH, but no password is set
- 硬盘原理(转)
- C++实现排序算法
- Python安装与MySq数据库链接碰到的问题与错误整理
- Win32 SDK学习笔记1
- Leetcode Algorithm 055. Jump Game
- java 多线程 生产者消费者模式
- Win8.1、Win10安装msi程序报2052、2053错误的解决方法