VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
KdRay.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//
33//=======================================================================================
34#ifndef KDRAY_H
35#define KDRAY_H
36
39
40namespace kd_tree
41{
42/*
43 * Ray class, for use with the optimized ray-box intersection test
44 * described in:
45 *
46 * Amy Williams, Steve Barrus, R. Keith Morley, and Peter Shirley
47 * "An Efficient and Robust Ray-Box Intersection Algorithm"
48 * Journal of graphics tools, 10(1):49-54, 2005
49 *
50 */
51template <typename T>
52class Ray
53{
54public:
55 Ray(const T &originX, const T &originY, const T &originZ, const T &directionX, const T &directionY,
56 const T &directionZ)
57 {
58 this->originX = originX;
59 this->originY = originY;
60 this->originZ = originZ;
61
62 // normierung (fuer ray-triangle-intersection)
65
66 this->directionX = directionX * oneOverLength;
67 this->directionY = directionY * oneOverLength;
68 this->directionZ = directionZ * oneOverLength;
69
70 this->inv_directionX = T(1.0 / this->directionX); // ACHTUNG: BEWUSST KEINE ==0 Abfrage
71 this->inv_directionY = T(1.0 / this->directionY); // Alg verwendet exlitzit INF
72 this->inv_directionZ = T(1.0 / this->directionZ);
73
74 if (this->inv_directionX < 0.0)
75 this->signX = 1;
76 else
77 this->signX = 0;
78 if (this->inv_directionY < 0.0)
79 this->signY = 1;
80 else
81 this->signY = 0;
82 if (this->inv_directionZ < 0.0)
83 this->signZ = 1;
84 else
85 this->signZ = 0;
86 }
87
91
95
99
100 int signX;
101 int signY;
102 int signZ;
103};
104} // namespace kd_tree
105
106#endif // KDRAY_H
107
T directionX
Definition KdRay.h:92
int signY
Definition KdRay.h:101
int signZ
Definition KdRay.h:102
T inv_directionZ
Definition KdRay.h:98
int signX
Definition KdRay.h:100
T inv_directionY
Definition KdRay.h:97
T directionZ
Definition KdRay.h:94
T inv_directionX
Definition KdRay.h:96
T directionY
Definition KdRay.h:93
Ray(const T &originX, const T &originY, const T &originZ, const T &directionX, const T &directionY, const T &directionZ)
Definition KdRay.h:55
std::shared_ptr< T > SPtr