Newer
Older
cg / hw04 / src / Tri.h
// Copyright (c) 2021. Pascal Syma <pascal@syma.dev> and Antonio Martinez Casadesus <acasadesus@stud.hs-bremen.de>.
// All rights reserved.

//
// Created by Pascal on 17.05.2021.
//

#ifndef OPENGL_EXAMPLE_TRI_H
#define OPENGL_EXAMPLE_TRI_H

class Mesh;

class Tri {
public:
    int iv[3]{}; // vertex indices
    int it[3]{}; // adjacent triangle indices
    int ie[3]{}; // edge vertex indices
    Mesh *mesh;  // parent mesh

    /// Base-constructor
    /// \param mesh Parent mesh
    explicit Tri(Mesh *mesh);

    /// Create new triangle based on vertex indices of the parent mesh.
    /// \param mesh Parent mesh
    /// \param i Array of vertex indices
    explicit Tri(Mesh *mesh, int i[3]);

    /// Create new triangle based on vertex indices of the parent mesh.
    /// \param mesh parent mesh
    /// \param i First vertex index
    /// \param j Second vertex index
    /// \param k Third vertex index
    Tri(Mesh *mesh, int i, int j, int k);

    void Print();

    /// Deep-clone this triangle.
    /// \param mesh Parent mesh of the new triangle
    /// \return New triangle
    Tri *copy(Mesh *mesh);
};


#endif //OPENGL_EXAMPLE_TRI_H