-
Notifications
You must be signed in to change notification settings - Fork 3
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
0 parents
commit d133428
Showing
20 changed files
with
2,630 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#include <cassert> | ||
|
||
#define ASSERT(x, ...) assert(x) |
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,79 @@ | ||
#pragma once | ||
|
||
#include "Vector.hpp" | ||
|
||
namespace Pvl { | ||
|
||
template <typename T, int Dim> | ||
class BoundingBox { | ||
Vector<T, Dim> lower_; | ||
Vector<T, Dim> upper_; | ||
|
||
public: | ||
BoundingBox() | ||
: lower_(std::numeric_limits<T>::max()) | ||
, upper_(std::numeric_limits<T>::lowest()) {} | ||
|
||
BoundingBox(const Vector<T, Dim>& lower, const Vector<T, Dim>& upper) | ||
: lower_(lower) | ||
, upper_(upper) {} | ||
|
||
Vector<T, Dim>& lower() { | ||
return lower_; | ||
} | ||
|
||
const Vector<T, Dim>& lower() const { | ||
return lower_; | ||
} | ||
|
||
Vector<T, Dim>& upper() { | ||
return upper_; | ||
} | ||
|
||
const Vector<T, Dim>& upper() const { | ||
return upper_; | ||
} | ||
|
||
Vector<T, Dim> size() const { | ||
return upper_ - lower_; | ||
} | ||
|
||
Vector<T, Dim> center() const { | ||
return T(0.5) * (upper_ + lower_); | ||
} | ||
|
||
|
||
bool contains(const Vector<T, Dim>& p) const { | ||
for (int i = 0; i < Dim; ++i) { | ||
if (p[i] < lower_[i] || p[i] > upper_[i]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
void extend(const Vector<T, Dim>& p) { | ||
lower_ = min(lower_, p); | ||
upper_ = max(upper_, p); | ||
} | ||
}; | ||
|
||
/// \brief Splits the box along given coordinate. | ||
/// | ||
/// The splitting plane must pass through the box. | ||
template <typename T, int Dim> | ||
std::pair<BoundingBox<T, Dim>, BoundingBox<T, Dim>> splitBox(const BoundingBox<T, Dim>& box, | ||
const int dim, | ||
const T x) { | ||
/*ASSERT(isValid());*/ | ||
ASSERT(dim < Dim); | ||
ASSERT(x >= box.lower()[dim] && x <= box.upper()[dim]); | ||
BoundingBox<T, Dim> b1 = box; | ||
BoundingBox<T, Dim> b2 = box; | ||
b1.lower()[dim] = x; | ||
b2.upper()[dim] = x; | ||
return std::make_pair(b1, b2); | ||
} | ||
|
||
|
||
} // namespace Pvl |
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,32 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(pvl LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
find_package(TBB REQUIRED tbb) | ||
|
||
add_executable(pvl | ||
main.cpp | ||
Utils.hpp | ||
Assert.hpp | ||
Math.hpp | ||
Vector.hpp | ||
Matrix.hpp | ||
Svd.hpp | ||
Box.hpp | ||
KdTree.h KdTree.inl.h | ||
PlyWriter.hpp PlyReader.hpp | ||
Cloud.hpp | ||
Kernels.hpp | ||
TriangleMesh.hpp | ||
MeshUtils.hpp | ||
Range.hpp | ||
Graph.hpp Graph.inl.hpp | ||
UniformGrid.hpp | ||
OctreeGrid.hpp | ||
MarchingCubes.hpp MarchingCubes.cpp | ||
) | ||
|
||
target_link_libraries(pvl PRIVATE tbb) |
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,3 @@ | ||
#pragma once | ||
|
||
namespace Pvl {} |
Oops, something went wrong.