当前位置:网站首页>如何用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;
}
边栏推荐
- MYSLQ十种锁,一篇文章带你全解析
- Getting started with fastdfs
- [Mysql]安装Mysql5.7
- 3D全景模型展示可视化技术演示
- 优质笔记软件综合评测和详细盘点(一) Notion、Obsidian、RemNote、FlowUs
- Easycvr accesses the equipment through the national standard gb28181 protocol. What is the reason for the automatic streaming of the equipment?
- 3D panoramic model display visualization technology demonstration
- Optimization of the problem that the request flow fails to terminate during page switching of easycvr cluster video Plaza
- STC 32-bit 8051 single chip microcomputer development example tutorial three program compilation setting and download
- Powerful, easy-to-use, professional editor / notebook software suitable for programmers / software developers, comprehensive evaluation and comprehensive recommendation
猜你喜欢
Develop those things: easycvr cluster device management page function display optimization
Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?
P2433 [deep foundation 1-2] primary school mathematics n in one
墨天轮沙龙 | 清华乔嘉林:Apache IoTDB,源于清华,建设开源生态之路
面试题篇一
强大、好用、适合程序员/软件开发者的专业编辑器/笔记软件综合评测和全面推荐
Interview questions shared in today's group
Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, builds an open source ecological road
【多线程】锁策略
Win11怎么关闭开机自启动软件
随机推荐
关于元宇宙下一代入口——脑机接口的实现
300题线性代数 第四讲 线性方程组
Review the collection container again
振弦采集模块测量振弦传感器的流程步骤
[research data] observation on the differences of health preservation concepts among people in 2022 - Download attached
EURA欧瑞E1000系列变频器使用PID实现恒压供水功能的相关参数设置及接线
【多线程】 实现单例模式 ( 饿汉、懒汉 ) 实现线程安全的单例模式 (双重效验锁)
Understand the structure in C language in one article
The large list set is divided into multiple small list sets in equal proportion
今日群里分享的面试题
独家消息:阿里云悄然推出RPA云电脑,已与多家RPA厂商开放合作
How to prevent repeated submission of new orders
Use Zadig to build a continuous delivery platform from 0 to 1
数据分析师听起来很高大上?了解这几点你再决定是否转型
【蓝桥杯Web】2022年第十三届蓝桥杯Web大学组国赛真题解析
Develop those things: easycvr platform adds playback address authentication function
Win11 how to hide the taskbar? Win11 method to hide the taskbar
math_ Use differentiation to calculate approximate value
2022/6/8-2022/6/12
1592 example 1 King (sgu223 loj10170 luogu1896 increase + / provincial election -) violent thinking pressure DP 01 Backpack