Atoms Crowd  7.0.0
SAH.h
1 /*
2  Copyright (c) 2010 University of Illinois
3  All rights reserved.
4 
5  Developed by: DeNovo group, Graphis@Illinois
6  University of Illinois
7  http://denovo.cs.illinois.edu
8  http://graphics.cs.illinois.edu
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the
12  "Software"), to deal with the Software without restriction, including
13  without limitation the rights to use, copy, modify, merge, publish,
14  distribute, sublicense, and/or sell copies of the Software, and to
15  permit persons to whom the Software is furnished to do so, subject to
16  the following conditions:
17 
18  * Redistributions of source code must retain the above copyright
19  notice, this list of conditions and the following disclaimers.
20 
21  * Redistributions in binary form must reproduce the above
22  copyright notice, this list of conditions and the following disclaimers
23  in the documentation and/or other materials provided with the
24  distribution.
25 
26  * Neither the names of DeNovo group, Graphics@Illinois,
27  University of Illinois, nor the names of its contributors may be used to
28  endorse or promote products derived from this Software without specific
29  prior written permission.
30 
31  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34  IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
35  ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
36  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
37  SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
38 */
39 
40 #pragma once
41 #include <AtomsUtils/Globals.h>
42 #include <AtomsUtils/KdTree/Common.h>
43 #include <AtomsUtils/AtomsMath.h>
44 
45 #define Ct_DEFAULT 15.0f
46 #define Ci_DEFAULT 20.0f
47 #define emptyBonus_DEFAULT 0.0f
48 
49 namespace AtomsUtils
50 {
51  class ATOMSUTILS_EXPORT SAH {
52  public:
53  SAH(float Ct = Ct_DEFAULT,
54  float Ci = Ci_DEFAULT,
55  float emptyBonus = emptyBonus_DEFAULT);
56 
57  float calculateSAH(const AtomsMath::Box3f &nodeExtent, char axis,
58  unsigned int nA, unsigned int nB, float position) const;
59 
60  // convenient function
61  float operator()(const AtomsMath::Box3f &nodeExtent, char axis,
62  unsigned int nA, unsigned int nB, float position) const;
63 
64  // parameters in SAH formula
65  const float m_Ci; // triangle intersection cost
66  const float m_Ct; // node traversal cost
67  const float m_emptyBonus; // takes value between 0 and 1
68  // closer to 1 => encourage empty space splitting
69  // closer to 0 => discourage
70  };
71 }
72 
Definition: SAH.h:51
AtomsCore namespace.
Definition: Base64.h:13