当前位置:网站首页>如何用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;
}
边栏推荐
- STC 32位8051单片机开发实例教程 三 程序编译设置与下载
- What if the win11 shortcut key switching input method doesn't respond? Shortcut key switching input method does not respond
- 【let var const】
- 【C语言】详解 memset() 函数用法
- Simple but modern server dashboard dashdot
- 关于一个神奇函数的用法
- [research materials] iResearch tide Watching: seven major trends in the clothing industry - Download attached
- C#聯合halcon應用——大華相機采集類
- EasyCVR集群视频广场页面切换时,请求流未能终止的问题优化
- Write blog documents
猜你喜欢

Use Zadig to build a continuous delivery platform from 0 to 1

Win11快捷键切换输入法无反应怎么办?快捷键切换输入法没有反应

Servlet knowledge points

漏洞复现-.Net-ueditor上传

Getting started with fastdfs

fastDFS入门

Use of common built-in classes of JS

Bind this of the current scope for callback functions in other cases such as timers and delayers

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

RichView 文档中的 ITEM
随机推荐
使用Zadig从0到1搭建持续交付平台
STC 32-bit 8051 single chip microcomputer development example tutorial three program compilation setting and download
Use Zadig to build a continuous delivery platform from 0 to 1
对金额进行求和
[Mysql]安装Mysql5.7
Arduino stepper library drive 28byj-48 stepper motor test program
Servlet knowledge points
C#联合halcon应用——大华相机采集类
Items in richview documents
qobject_ Cast usage
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
[untitled]
Install redis under Linux and configure the environment
300题线性代数 第四讲 线性方程组
振弦采集模塊測量振弦傳感器的流程步驟
[research data] observation on the differences of health preservation concepts among people in 2022 - Download attached
Face recognition system opencv face detection
The large list set is divided into multiple small list sets in equal proportion
On the next generation entrance of the metauniverse -- the implementation of brain computer interface
有意思了!数据库也搞Serverless!