-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
178 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ We recommend using [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) to consum | |
* Installation with CPM | ||
|
||
```cmake | ||
CPMAddPackage("gh:viennatools/[email protected].0") | ||
CPMAddPackage("gh:viennatools/[email protected].1") | ||
``` | ||
|
||
* With a local installation | ||
|
@@ -101,7 +101,7 @@ ctest --test-dir build | |
|
||
## Contributing | ||
|
||
If you want to contribute to ViennaRay, make sure to follow the [LLVM Coding guidelines](https://llvm.org/docs/CodingStandards.html). Before creating a pull request, make sure ALL files have been formatted by clang-format, which can be done using the `format-project.sh` script in the root directory. | ||
If you want to contribute to ViennaRay, make sure to follow the [LLVM Coding guidelines](https://llvm.org/docs/CodingStandards.html). Before creating a pull request, make sure ALL files have been formatted by clang-format. | ||
|
||
## Authors | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
project(reflection LANGUAGES CXX) | ||
|
||
add_executable(${PROJECT_NAME} "${PROJECT_NAME}.cpp") | ||
target_link_libraries(${PROJECT_NAME} PRIVATE ViennaRay) | ||
|
||
add_dependencies(ViennaRay_Tests ${PROJECT_NAME}) | ||
add_test(NAME ${PROJECT_NAME} COMMAND $<TARGET_FILE:${PROJECT_NAME}>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#include <rayReflection.hpp> | ||
#include <vcTimer.hpp> | ||
|
||
#include <fstream> | ||
|
||
using namespace viennaray; | ||
|
||
int main() { | ||
|
||
using NumericType = double; | ||
constexpr int N = 50000; | ||
RNG rngState(12351263); | ||
Timer timer; | ||
|
||
{ | ||
std::array<Vec3D<NumericType>, N> directions; | ||
|
||
// diffuse reflection | ||
Vec3D<NumericType> normal = {0.0, 0.0, 1.0}; | ||
|
||
timer.start(); | ||
for (int i = 0; i < N; ++i) { | ||
directions[i] = ReflectionDiffuse<NumericType, 3>(normal, rngState); | ||
} | ||
timer.finish(); | ||
|
||
std::cout << "Time for " << N | ||
<< " diffuse reflections: " << timer.currentDuration * 1e-6 | ||
<< " ms" << std::endl; | ||
|
||
std::ofstream file("diffuse_reflection.txt"); | ||
for (auto const &dir : directions) { | ||
file << dir[0] << " " << dir[1] << " " << dir[2] << std::endl; | ||
} | ||
file.close(); | ||
} | ||
|
||
Vec3D<NumericType> normal = {0.0, 0.0, 1.0}; | ||
NumericType const minAngle = 85.0 * M_PI / 180.0; | ||
NumericType incAngle = 75.0 * M_PI / 180.0; | ||
Vec3D<NumericType> rayDir = {0.0, -std::sin(incAngle), -std::cos(incAngle)}; | ||
auto coneAngle = M_PI_2 - std::min(incAngle, minAngle); | ||
|
||
std::cout << "minAngle: " << minAngle << std::endl; | ||
std::cout << "incAngle: " << incAngle << std::endl; | ||
std::cout << "incAngle [deg]: " << incAngle * 180.0 / M_PI << std::endl; | ||
std::cout << "coneAngle: " << coneAngle << std::endl; | ||
|
||
{ | ||
std::array<Vec3D<NumericType>, N> directions; | ||
|
||
// coned specular reflection | ||
timer.start(); | ||
for (int i = 0; i < N; ++i) { | ||
directions[i] = ReflectionConedCosine<NumericType, 3>( | ||
rayDir, normal, rngState, coneAngle); | ||
} | ||
timer.finish(); | ||
|
||
std::cout << "Time for " << N | ||
<< " coned specular reflections: " << timer.currentDuration * 1e-6 | ||
<< " ms" << std::endl; | ||
|
||
std::ofstream file("coned_specular_reflection.txt"); | ||
for (auto const &dir : directions) { | ||
file << dir[0] << " " << dir[1] << " " << dir[2] << std::endl; | ||
} | ||
file.close(); | ||
} | ||
|
||
{ | ||
std::array<Vec3D<NumericType>, N> directions; | ||
|
||
// coned specular reflection | ||
timer.start(); | ||
for (int i = 0; i < N; ++i) { | ||
directions[i] = rayInternal::ReflectionConedCosineOld<NumericType, 3>( | ||
rayDir, normal, rngState, coneAngle); | ||
} | ||
timer.finish(); | ||
|
||
std::cout << "Time for " << N << " coned specular reflections (old): " | ||
<< timer.currentDuration * 1e-6 << " ms" << std::endl; | ||
|
||
std::ofstream file("coned_specular_reflection_old.txt"); | ||
for (auto const &dir : directions) { | ||
file << dir[0] << " " << dir[1] << " " << dir[2] << std::endl; | ||
} | ||
file.close(); | ||
} | ||
|
||
return 0; | ||
} |