DelaunayTriangulation
A C++ Object Oriented data structure with algorithms that could be used to generate a Delaunay triangulation
Vertex.hpp
Go to the documentation of this file.
1//
2// Created by matt on 17/11/2019.
3//
4#include <vector>
5#include <ostream>
6#include "IMesh.hpp"
7#include "Vec.hpp"
8
9#pragma once
17class Vertex {
18private:
19 int index;
22 std::vector<double> attributes;
23public:
30 Vertex(int index, int dim, IMesh* owner) : index(index), owner(owner), vec(0, 0, 0, dim) {};
34 Vertex() : index(-1), owner(), vec(0, 0, 0, 3) {};
38 ~Vertex() {};
39 // Getters & Setters
44 int getIndex() const;
49 void setIndex(int index);
54 const std::vector<double> &getAttributes() const;
59 void setAttributes(const std::vector<double> &attributes);
64 const Vec &getVec() const;
69 void setVec(const Vec &vec);
70
71 // Comparison Operators
77 bool operator==(const Vertex &rhs) const;
83 bool operator!=(const Vertex &rhs) const;
84
85 // Stream Operators
92 friend std::istream &operator>>(std::istream &is, Vertex &vertex);
99 friend std::ostream &operator<<(std::ostream &os, Vertex &vertex);
106 friend std::ofstream &operator<<(std::ofstream &ofs, Vertex &vertex);
107};
108
IMesh class header.
Vec class header.
Shallow class allowing Mesh to be imported in classes which Mesh owns.
Definition: IMesh.hpp:14
Class representing coordinates of a Vector.
Definition: Vec.hpp:17
Class representing a vertex of a cell.
Definition: Vertex.hpp:17
friend std::istream & operator>>(std::istream &is, Vertex &vertex)
Input stream operator.
Definition: Vertex.cpp:27
void setAttributes(const std::vector< double > &attributes)
Mutator for private member attributes.
Definition: Vertex.cpp:23
int index
Index of the triangle from file.
Definition: Vertex.hpp:19
Vec vec
Vec class storing the coordinates of the vertex.
Definition: Vertex.hpp:21
void setVec(const Vec &vec)
Mutator for private member vec.
Definition: Vertex.cpp:68
std::vector< double > attributes
Vector of attributes of the Vertex (16 points of precision)
Definition: Vertex.hpp:22
const Vec & getVec() const
Accessor for private member vec.
Definition: Vertex.cpp:64
IMesh * owner
Pointer to interface class of the Mesh the Vertex is a part of.
Definition: Vertex.hpp:20
bool operator==(const Vertex &rhs) const
Equality operator.
Definition: Vertex.cpp:53
Vertex()
Default constructor.
Definition: Vertex.hpp:34
friend std::ostream & operator<<(std::ostream &os, Vertex &vertex)
Output stream operator.
Definition: Vertex.cpp:38
bool operator!=(const Vertex &rhs) const
Non-equality operator.
Definition: Vertex.cpp:60
int getIndex() const
Accessor for private member index.
Definition: Vertex.cpp:11
~Vertex()
Default destructor.
Definition: Vertex.hpp:38
Vertex(int index, int dim, IMesh *owner)
Constructor populating index and owner and instantiating vec.
Definition: Vertex.hpp:30
void setIndex(int index)
Mutator for private member index.
Definition: Vertex.cpp:15
const std::vector< double > & getAttributes() const
Accessor for private member attributes.
Definition: Vertex.cpp:19