本学期的高级计算机图像学作业的一部分, 实现halfedge结构。 我用obj结构和halfedge互相转化来完成这样一件事。
halfedge.h:
#ifndef HALFEDGE_VECTOR_H_
#define HALFEDGE_VECTOR_H_
#include <iostream>
using namespace std;
#include <vector>
typedef struct
{
float x;
float y;
float z;
int edge_index;
// whether a new point
bool isnew;
// the neighbour of a point
vector<int> beighbour;
} halfegde_point;
typedef struct
{
int one_edge_index;
} halfedge_face;
typedef struct
{
int original_point_index;
int face_index;
int twin_edge_index;
int next_edge_index;
int previous_edge_index;
// whether splited
bool issplited;
// splited point's index
int split_point_index;
} halfegde;
//默认逆时针
bool twins(vector<halfegde> e, halfegde a, halfegde b);
// index begin from 0;
// transform obj to halfedge
void obj2halfedge(float (*point)[3], int point_count, int (*face)[3], int face_count, vector<halfegde_point> &

这篇博客主要介绍了在高级计算机图像学课程中,作者作为作业完成的halfedge结构实现。通过转换OBJ文件格式,展示了halfedge结构在几何建模中的应用。
最低0.47元/天 解锁文章
4479

被折叠的 条评论
为什么被折叠?



