Text archives Help
- From: abe@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r892 - in trunk: Core Core/Math Model/Groups Model/Primitives
- Date: Tue, 7 Feb 2006 11:35:20 -0700 (MST)
Author: abe
Date: Tue Feb 7 11:35:19 2006
New Revision: 892
Added:
trunk/Core/Math/HaltonSequence.cc
trunk/Core/Math/HaltonSequence.h
Modified:
trunk/Core/CMakeLists.txt
trunk/Model/Groups/RealisticBvh.cc
trunk/Model/Primitives/Hemisphere.cc
trunk/Model/Primitives/Hemisphere.h
Log:
Moved Halton sequence code out of disco package into Core.
A Core/Math/HaltonSequence.h
A Core/Math/HaltonSequence.cc
M Core/CMakeLists.txt
Fixed the hemisphere code (how did it ever work??).
M Model/Groups/RealisticBvh.cc
M Model/Primitives/Hemisphere.cc
M Model/Primitives/Hemisphere.h
Modified: trunk/Core/CMakeLists.txt
==============================================================================
--- trunk/Core/CMakeLists.txt (original)
+++ trunk/Core/CMakeLists.txt Tue Feb 7 11:35:19 2006
@@ -28,6 +28,8 @@
Exceptions/OutputError.cc
)
SET (CORE_SOURCES ${CORE_SOURCES}
+ Math/HaltonSequence.cc
+ Math/HaltonSequence.h
Math/MT_RNG.h
Math/MT_RNG.cc
Math/Noise.h
Added: trunk/Core/Math/HaltonSequence.cc
==============================================================================
--- (empty file)
+++ trunk/Core/Math/HaltonSequence.cc Tue Feb 7 11:35:19 2006
@@ -0,0 +1,33 @@
+
+
+
+/*
+ For more information, please see:
http://software.sci.utah.edu
+
+ The MIT License
+
+ Copyright (c) 2005-2006
+ Scientific Computing and Imaging Institute, University of Utah
+
+ License for the specific language governing rights and limitations under
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#include <Core/Math/HaltonSequence.h>
+
Added: trunk/Core/Math/HaltonSequence.h
==============================================================================
--- (empty file)
+++ trunk/Core/Math/HaltonSequence.h Tue Feb 7 11:35:19 2006
@@ -0,0 +1,94 @@
+#ifndef MANTA_CORE_MATH_HALTON
+#define MANTA_CORE_MATH_HALTON
+
+/*
+ For more information, please see:
http://software.sci.utah.edu
+
+ The MIT License
+
+ Copyright (c) 2005-2006
+ Scientific Computing and Imaging Institute, University of Utah
+
+ License for the specific language governing rights and limitations under
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#include <MantaTypes.h>
+#include <Core/Geometry/PointVector.h>
+
+namespace Manta {
+
+ template< typename T, int S >
+ class HaltonSequence {
+ public:
+ HaltonSequence( int n_ = 1 ) : n( n ) { };
+
+ // Generate the next number in the sequence.
+ void next( PointT<T,S> &p ) {
+ static const int halton_sequence_primes[] = { 2, 3, 5, 7 };
+ for (int i=0;i<S;++i) {
+ p[i] = folded_radical_inverse( n, halton_sequence_primes[i] );
+ }
+ ++n;
+ }
+
+ private:
+
+ inline Real radical_inverse( int n, int b ) {
+
+ Real val = 0;
+ Real inv_b = 1.0 / (Real)b;
+ Real inv_bi = inv_b;
+
+ while (n > 0) {
+ int di = n % b;
+ val += di * inv_bi;
+ n /= b;
+ inv_bi *= inv_b;
+ }
+
+ return val;
+ };
+
+ inline Real folded_radical_inverse( int n, int b ) {
+
+ Real val = 0;
+ Real inv_b = 1.0 / (Real)b;
+ Real inv_bi = inv_b;
+ int offset = 0;
+
+ while ((val+b*inv_bi) != val) {
+ int d = ((n+offset) % b);
+ val += d * inv_bi;
+ n /= b;
+ inv_bi *= inv_b;
+ ++offset;
+ }
+
+ return val;
+ };
+
+ // Private members.
+ int n;
+ };
+
+};
+
+
+#endif
Modified: trunk/Model/Groups/RealisticBvh.cc
==============================================================================
--- trunk/Model/Groups/RealisticBvh.cc (original)
+++ trunk/Model/Groups/RealisticBvh.cc Tue Feb 7 11:35:19 2006
@@ -80,7 +80,7 @@
for (int i=0;i<size;++i) {
array[i]->computeBounds( context, bounds );
}
-
+
// Find a pivot point.
Point pivot((Vector(bounds[0]) + Vector(bounds[1])) * 0.5);
@@ -145,7 +145,7 @@
// Split along the axis.
int mid_point = qsplit( array, size, pivot[axis], axis );
-
+
// save the split axis.
new_node->split_axis = axis;
Modified: trunk/Model/Primitives/Hemisphere.cc
==============================================================================
--- trunk/Model/Primitives/Hemisphere.cc (original)
+++ trunk/Model/Primitives/Hemisphere.cc Tue Feb 7 11:35:19 2006
@@ -16,7 +16,7 @@
: PrimitiveCommon(material, this), _c(center), _r(radius), _n(normal)
{
setupAxes();
- _inv_r = 1/_inv_r;
+ _inv_r = 1/_r;
}
Hemisphere::~Hemisphere() {
Modified: trunk/Model/Primitives/Hemisphere.h
==============================================================================
--- trunk/Model/Primitives/Hemisphere.h (original)
+++ trunk/Model/Primitives/Hemisphere.h Tue Feb 7 11:35:19 2006
@@ -1,6 +1,34 @@
#ifndef Manta_Model_Hemisphere_h
#define Manta_Model_Hemisphere_h
+/*
+ For more information, please see:
http://software.sci.utah.edu
+
+ The MIT License
+
+ Copyright (c) 2005-2006
+ Scientific Computing and Imaging Institute, University of Utah
+
+ License for the specific language governing rights and limitations under
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
#include <Model/Primitives/PrimitiveCommon.h>
#include <Interface/TexCoordMapper.h>
#include <Core/Geometry/PointVector.h>
- [MANTA] r892 - in trunk: Core Core/Math Model/Groups Model/Primitives, abe, 02/07/2006
Archive powered by MHonArc 2.6.16.