halfedge 结构

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本学期的高级计算机图像学作业的一部分, 实现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> &halfegde_p, vector<halfedge_face> &halfegde_f, vector<halfegde> &e);

// transform halfedge to obj
void halfedge2obj(vector<halfegde_point> halfegde_p, vector<halfedge_face> halfegde_f, vector<halfegde> e, float (*point)[3], int (*face)[3]);

// calculate points neighbour
void update_ne
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值