当前位置:网站首页>如何用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;
}
边栏推荐
- Arduino Stepper库驱动28BYJ-48步进电机测试程序
- How can a programmer grow rapidly
- 振弦采集模塊測量振弦傳感器的流程步驟
- Wechat applet realizes keyword highlighting
- Richview RichEdit srichviewedit PageSize page setup and synchronization
- 2022/5/23-2022/5/30
- Detailed configuration of network security "Splunk" in national vocational college skills competition
- Simple but modern server dashboard dashdot
- list分割成满足和不满足条件的集合(partitioningBy)
- JS proxy
猜你喜欢

Hls4ml entry method
![[research data] observation on the differences of health preservation concepts among people in 2022 - Download attached](/img/50/926cc5bce83f8b195b3e2072b656bf.jpg)
[research data] observation on the differences of health preservation concepts among people in 2022 - 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"

优质笔记软件综合评测和详细盘点(一) Notion、Obsidian、RemNote、FlowUs

Richview trvdocparameters page parameter settings

STC 32-bit 8051 single chip microcomputer development example tutorial II i/o working mode and its configuration

Powerful, easy-to-use, professional editor / notebook software suitable for programmers / software developers, comprehensive evaluation and comprehensive recommendation

运动捕捉系统原理

Related concepts of cookies and sessions
随机推荐
开发那些事儿:EasyCVR平台添加播放地址鉴权功能
How to prevent repeated submission of new orders
Battery simulation of gazebo robot
Win11快捷键切换输入法无反应怎么办?快捷键切换输入法没有反应
面试题篇一
[Mysql]安装Mysql5.7
STC 32-bit 8051 single chip microcomputer development example tutorial three program compilation setting and download
February 15, 2022: sweeping robot. There is a floor sweeping robot in the room (represented by a grid). Each grid in the grid has two possibilities: empty and obstacles. The sweeping robot provides fo
Win11暂停更新点不了怎么办?Win11暂停更新是灰色的如何解决?
Set object value changes null value object
一个悄然崛起的国产软件,低调又强大!
Interesting! Database is also serverless!
对金额进行求和
Face recognition system opencv face detection
EURA欧瑞E1000系列变频器使用PID实现恒压供水功能的相关参数设置及接线
关于new Set( )还有哪些是你不知道的
Anaconda installs the virtual environment to the specified path
C#联合halcon应用——大华相机采集类
Develop those things: easycvr cluster device management page function display optimization
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速