当前位置:网站首页>如何用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;
}
边栏推荐
- PHP获取微信小程序和小程序商店外链地址
- Develop those things: easycvr cluster device management page function display optimization
- Modsim basic use (Modbus simulator)
- How to prevent repeated submission of new orders
- Use Zadig to build a continuous delivery platform from 0 to 1
- 为定时器和延时器等其它情况的回调函数绑定当前作用域的this
- Write blog documents
- Set object value changes null value object
- Sum the amount
- Is Dao safe? Build finance encountered a malicious governance takeover and was looted!
猜你喜欢

Process steps of vibrating wire acquisition module for measuring vibrating wire sensor

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

How to turn off the boot auto start software in win11
![[multithreading] lock strategy](/img/97/5cacfd2de73d3c3b8acabf6b5c5ce3.png)
[multithreading] lock strategy

fastDFS入门

一个悄然崛起的国产软件,低调又强大!

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

windows环境 redis安装和启动(后台启动)

EasyCVR集群视频广场页面切换时,请求流未能终止的问题优化

牛客编程题--必刷101之字符串(高效刷题,举一反三)
随机推荐
实例讲解将Graph Explorer搬上JupyterLab
2022/5/23-2022/5/30
Modsim basic use (Modbus simulator)
STC 32位8051单片机开发实例教程 二 I/O工作模式及其配置
A quietly rising domestic software, low-key and powerful!
为定时器和延时器等其它情况的回调函数绑定当前作用域的this
Write blog documents
PowerDesigner设计Name和Comment 替换
STC 32位8051单片机开发实例教程 三 程序编译设置与下载
After adding cocoapods successfully, the header file cannot be imported or an error is reported in not found file
Realize pyramids through JS (asterisk pyramid, palindrome symmetric digital pyramid)
[Blue Bridge Cup web] analysis of the real topic of the 13th Blue Bridge Cup web university group match in 2022
Technology T3 domestic platform! Successfully equipped with "Yihui domestic real-time system sylixos"
RichView 文档中的 ITEM
How can a programmer grow rapidly
Solve the problem of slow or failed vscode download
On the next generation entrance of the metauniverse -- the implementation of brain computer interface
math_ Use differentiation to calculate approximate value
Interview question 1