当前位置:网站首页>如何用OpenMesh创建一个四棱锥
如何用OpenMesh创建一个四棱锥
2022-07-01 19:03:00 【CSU迦叶】

自己凭空构造一个如图所示的四棱锥,基本信息是[V, E, F] = [5, 9, 6]
各个点的坐标是A(0,0,1) B(-1,1,0) C(1,1,0) D(1,-1,0) E(-1,-1,0)
确定面片添加顺序是AED->ACB->ADC->ABE->BDE->DBC
注意:每个面的点加入的顺序应为相对于该面片朝外的法向量是逆时针分布
// IoTestPro.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include <OpenMesh/Core/IO/MeshIO.hh>
#include <OpenMesh/Core/Mesh/TriMesh_ArraykernelT.hh>
#include <OpenMesh/Core/Mesh/PolyConnectivity.hh>
typedef OpenMesh::TriMesh_ArrayKernelT<> TriMesh;
int main()
{
TriMesh mesh;//预计是一个四棱锥
TriMesh::VertexHandle vhandle[5];//点的句柄数组
std::vector<TriMesh::VertexHandle> face_vhandles;//一个面中含有多个点
vhandle[0] = mesh.add_vertex(TriMesh::Point(0, 0, 2));//点A
vhandle[1] = mesh.add_vertex(TriMesh::Point(-1, 1, 0));//点B
vhandle[2] = mesh.add_vertex(TriMesh::Point(1, 1, 0));//点C
vhandle[3] = mesh.add_vertex(TriMesh::Point(1, -1, 0));//点D
vhandle[4] = mesh.add_vertex(TriMesh::Point(-1, -1, 0));//点E
//构造面AED并加入mesh
face_vhandles.push_back(vhandle['A' - 65]);
face_vhandles.push_back(vhandle['E' - 65]);
face_vhandles.push_back(vhandle['D' - 65]);
mesh.add_face(face_vhandles);
//构造面ACB并加入mesh
face_vhandles.clear();
face_vhandles.push_back(vhandle['A' - 65]);
face_vhandles.push_back(vhandle['C' - 65]);
face_vhandles.push_back(vhandle['B' - 65]);
mesh.add_face(face_vhandles);
//构造面ADC并加入mesh
face_vhandles.clear();
face_vhandles.push_back(vhandle['A' - 65]);
face_vhandles.push_back(vhandle['D' - 65]);
face_vhandles.push_back(vhandle['C' - 65]);
mesh.add_face(face_vhandles);
//构造面ABE并加入mesh
face_vhandles.clear();
face_vhandles.push_back(vhandle['A' - 65]);
face_vhandles.push_back(vhandle['B' - 65]);
face_vhandles.push_back(vhandle['E' - 65]);
mesh.add_face(face_vhandles);
//构造面BDE并加入mesh
face_vhandles.clear();
face_vhandles.push_back(vhandle['B' - 65]);
face_vhandles.push_back(vhandle['D' - 65]);
face_vhandles.push_back(vhandle['E' - 65]);
mesh.add_face(face_vhandles);
//构造面DBC并加入mesh
face_vhandles.clear();
face_vhandles.push_back(vhandle['D' - 65]);
face_vhandles.push_back(vhandle['B' - 65]);
face_vhandles.push_back(vhandle['C' - 65]);
mesh.add_face(face_vhandles);
return 0;
}
边栏推荐
- Develop those things: easycvr platform adds playback address authentication function
- On the next generation entrance of the metauniverse -- the implementation of brain computer interface
- Understand the structure in C language in one article
- 简单但现代的服务器仪表板Dashdot
- Tensorflow reports an error, could not load dynamic library 'libcudnn so. eight
- list大集合等比分割成多个小list集合
- EasyCVR通过国标GB28181协议接入设备,出现设备自动拉流是什么原因?
- 2022/6/8-2022/6/12
- Oracle 死锁测试
- STC 32-bit 8051 single chip microcomputer development example tutorial three program compilation setting and download
猜你喜欢

uniapp使用腾讯地图选点 没有window监听回传用户的位置信息,怎么处理

Redis installation and startup in Windows environment (background startup)

一个悄然崛起的国产软件,低调又强大!
![[research materials] iResearch tide Watching: seven major trends in the clothing industry - Download attached](/img/c8/a205ddc2835c87efa38808cf31f59e.jpg)
[research materials] iResearch tide Watching: seven major trends in the clothing industry - Download attached
![[Mysql]安装Mysql5.7](/img/c4/d7fb5ddf8e7be31f7a9ad68409e584.png)
[Mysql]安装Mysql5.7

Technology T3 domestic platform! Successfully equipped with "Yihui domestic real-time system sylixos"

Oracle physical architecture

GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速

毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?

Use of common built-in classes of JS
随机推荐
qobject_ Cast usage
The large list set is divided into multiple small list sets in equal proportion
振弦采集模块测量振弦传感器的流程步骤
1592 example 1 King (sgu223 loj10170 luogu1896 increase + / provincial election -) violent thinking pressure DP 01 Backpack
Summary of SQL aggregate query method for yyds dry goods inventory
Myslq ten kinds of locks, an article will take you to fully analyze
Unreal Engine packaging project
STC 32-bit 8051 single chip microcomputer development example tutorial three program compilation setting and download
cocoaPods 添加成功后,导入不了头文件或者not found file 报错
Related concepts of cookies and sessions
毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?
Hls4ml/vivado HLS error reporting solution
STC 32位8051单片机开发实例教程 二 I/O工作模式及其配置
How to prevent repeated submission of new orders
写博客文档
Stack Overflow 2022 开发者调查:行业走向何方?
Battery simulation of gazebo robot
Écrire un document de blog
Difference between redo and undo
Detailed configuration of network security "Splunk" in national vocational college skills competition