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
37
#include <
basics/utilities/UbException.h
>
38
#include <
basics/utilities/UbMath.h
>
39
40
namespace
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
*/
51
template
<
typename
T>
52
class
Ray
53
{
54
public
:
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)
63
T
oneOverLength
=
64
T
(1.0 / std::sqrt(
directionX
*
directionX
+
directionY
*
directionY
+
directionZ
*
directionZ
));
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
88
T
originX
;
89
T
originY
;
90
T
originZ
;
91
92
T
directionX
;
93
T
directionY
;
94
T
directionZ
;
95
96
T
inv_directionX
;
97
T
inv_directionY
;
98
T
inv_directionZ
;
99
100
int
signX
;
101
int
signY
;
102
int
signZ
;
103
};
104
}
// namespace kd_tree
105
106
#endif
// KDRAY_H
107
UbException.h
UbMath.h
kd_tree::Ray
Definition
KdRay.h:53
kd_tree::Ray::directionX
T directionX
Definition
KdRay.h:92
kd_tree::Ray::signY
int signY
Definition
KdRay.h:101
kd_tree::Ray::signZ
int signZ
Definition
KdRay.h:102
kd_tree::Ray::originZ
T originZ
Definition
KdRay.h:90
kd_tree::Ray::inv_directionZ
T inv_directionZ
Definition
KdRay.h:98
kd_tree::Ray::signX
int signX
Definition
KdRay.h:100
kd_tree::Ray::inv_directionY
T inv_directionY
Definition
KdRay.h:97
kd_tree::Ray::directionZ
T directionZ
Definition
KdRay.h:94
kd_tree::Ray::inv_directionX
T inv_directionX
Definition
KdRay.h:96
kd_tree::Ray::directionY
T directionY
Definition
KdRay.h:93
kd_tree::Ray::originX
T originX
Definition
KdRay.h:88
kd_tree::Ray::originY
T originY
Definition
KdRay.h:89
kd_tree::Ray::Ray
Ray(const T &originX, const T &originY, const T &originZ, const T &directionX, const T &directionY, const T &directionZ)
Definition
KdRay.h:55
SPtr
std::shared_ptr< T > SPtr
Definition
PointerDefinitions.h:39
kd_tree
Definition
GbTriFaceMesh3D.h:51
src
basics
geometry3d
KdTree
KdRay.h
Generated on Wed Nov 18 2026 00:03:21 for VirtualFluids by
1.9.8