loop曲面细分中分裂、翻转的实现

关于loop曲面细分
http://dalab.se.sjtu.edu.cn/gitlab/courses/scotty3d/-/blob/750af030b0b1d9b7dccf6129ab078277d3639b61/src/student/meshedit.cpp
meshedit.cpp中flip_edge、split_edge和loop_subdivide函数的实现

顶点结构
class Vertex
{
public:
    Point3d pos;            // 顶点坐标
    Point3d newPos;            // 更新后顶点坐标
    bool ifCalNewPos = false;        // 用于区分新旧顶点
    bool isOnBoundary = false;    // 用于判断是否位于边界
    Index idxForSave;        // 用于新mesh写出
 
public:
    Vertex(Point3d& p) : pos(p) {}
};
半边结构
class Halfedge
{
public:
    shared_ptr<Vertex> v;
    weak_ptr<Halfedge> twin;
    weak_ptr<Halfedge> next;
    weak_ptr<Halfedge> prev;
    weak_ptr<Edge> e;
    weak_ptr<Face> f;
    
public:
    Halfedge() {}
    Halfedge(shared_ptr<Vertex>&  _v) {
        v = _v;
    }
};

边结构
class Edge
{
public:
    Index ID;
    shared_ptr<Halfedge> he1;
    shared_ptr<Halfedge> he2;
    Point3d newPos;            // 用于存储新顶点的坐标
    bool ifCalNewPos = false;        // 用于判断是否计算了新顶点
    bool ifNew = false;        // 用于判断是否为新插入的边
    bool isBoundary = false;        // 用于判断是否为边界
 
public:
    Edge() {
        static Index id = 0;
        ID = id++;
    }
};

面结构
class Face
{
public:
    shared_ptr<Halfedge> he;
    Point3d normal;
    bool ifNeedDelete = false;
 
public:
    Face(){}
    Face(shared_ptr<Halfedge>& _he) {
        he = _he;
    }
};