Newer
Older
cg / hw04 / src / Vertex.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_VERTEX_H
#define OPENGL_EXAMPLE_VERTEX_H

#include <iostream>
class Mesh;

using namespace std;

class Vertex {
public:

    float p[3]{}; // coordinates
    Mesh *mesh{};  // parent mesh
    int valence;

    Vertex();
    explicit Vertex(Mesh* mesh);
    explicit Vertex(Mesh* mesh, float point[3]);
    Vertex(Mesh* mesh, float x, float y, float z);
    void Print() {
        cout << valence << "x " << p[0] << " " << p[1] << " " << p[2] << endl;
    }
    void operator*=( float a);
    void operator+=( Vertex a);

    Vertex* copy(Mesh* mesh);

};

Vertex operator+( Vertex a, Vertex b);
Vertex operator-( Vertex a, Vertex b);
Vertex operator*( float a, Vertex b);
float operator*( Vertex a, Vertex b);
Vertex operator%( Vertex a, Vertex b);
bool operator==(Vertex a, Vertex b);


#endif //OPENGL_EXAMPLE_VERTEX_H