VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
Vertex.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
32//=======================================================================================
33#ifndef VERTEX_H
34#define VERTEX_H
35
36#include <stdio.h>
37#include <memory>
38#include <ostream>
39
41
42namespace vf::gpu {
43
44struct Vertex
45{
46public:
47 real x, y, z;
48
49 Vertex(real x, real y, real z);
50 Vertex();
51
52 real getEuclideanDistanceTo(const Vertex &w) const;
53 Vertex operator-(const Vertex &v) const;
54 Vertex operator+(const Vertex &v) const;
55 Vertex operator*(const real& value) const;
56 Vertex operator/(const real& value) const;
57
58 real operator*(const Vertex &w) const;
59 struct Vertex crossProduct(const Vertex &w) const;
60 real length() const;
61 void normalize();
62 real getMagnitude() const;
63 int isEqual(const Vertex &w) const;
64 real getInnerAngle(const Vertex &w) const;
65
66 bool operator==(const Vertex &v) const;
67
68 bool isXbetween(real min, real max) const;
69 bool isYbetween(real min, real max) const;
70 bool isZbetween(real min, real max) const;
71
72 static void setMinMax(real &minX, real &maxX, real &minY, real &maxY, real &minZ, real &maxZ, const Vertex &v1, const Vertex &v2, const Vertex &v3);
73 static void calculateMinMax(const real &value1, const real &value2, const real &value3, real &min, real &max);
74
75 void print() const;
76 void print(std::ostream &ost) const;
77 void printFormatted(std::ostream &ost) const;
78
79};
80
81}
82
83#endif
84
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
real getEuclideanDistanceTo(const Vertex &w) const
Definition Vertex.cpp:43
Vertex operator/(const real &value) const
Definition Vertex.cpp:63
real getMagnitude() const
Definition Vertex.cpp:99
static void setMinMax(real &minX, real &maxX, real &minY, real &maxY, real &minZ, real &maxZ, const Vertex &v1, const Vertex &v2, const Vertex &v3)
Definition Vertex.cpp:164
void printFormatted(std::ostream &ost) const
Definition Vertex.cpp:136
bool isXbetween(real min, real max) const
Definition Vertex.cpp:149
Vertex operator+(const Vertex &v) const
Definition Vertex.cpp:53
Vertex operator-(const Vertex &v) const
Definition Vertex.cpp:48
bool operator==(const Vertex &v) const
Definition Vertex.cpp:143
static void calculateMinMax(const real &value1, const real &value2, const real &value3, real &min, real &max)
Definition Vertex.cpp:183
real length() const
Definition Vertex.cpp:81
struct Vertex crossProduct(const Vertex &w) const
Definition Vertex.cpp:73
int isEqual(const Vertex &w) const
Definition Vertex.cpp:105
bool isZbetween(real min, real max) const
Definition Vertex.cpp:159
Vertex operator*(const real &value) const
Definition Vertex.cpp:58
real getInnerAngle(const Vertex &w) const
Definition Vertex.cpp:110
void normalize()
Definition Vertex.cpp:86
bool isYbetween(real min, real max) const
Definition Vertex.cpp:154
void print() const
Definition Vertex.cpp:124