Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions EBGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@
#include "Source/EBGeometry_Union.hpp"
#include "Source/EBGeometry_UnionBVH.hpp"

/*!
@brief Name space for all of EBGeometry
*/
namespace EBGeometry {

}
6 changes: 3 additions & 3 deletions Examples/Union/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ int main() {
for (int j = 0; j < Ny; j++){
for (int k = 0; k < Nz; k++){

const T x = i * (2 * radius);
const T y = j * (2 * radius);
const T z = k * (2 * radius);
const T x = i * (3 * radius);
const T y = j * (3 * radius);
const T z = k * (3 * radius);

const Vec3 center(x,y,z);

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Users can also embed entire objects (e.g., analytic functions) in the BVHs, e.g.
BVHs can also be nested so that the BVH accelerator is used to embed objects that are themselves described by a BVH.
For example, a scene consisting of many objects described by surface grids can be embedded as a BVH-of-BVH type of scene.

<img src="example.png" width="800"/>
<img src="example.png" width="400"/>

In addition, EBGeometry provides standard operators for signed distance fields like rotations, translations, and scalings.
Multi-object scenes can be constructed with conventional unions, or with BVH-enabled unions (which can be orders of magnitudes faster).
Expand Down
9 changes: 3 additions & 6 deletions Source/EBGeometry_AnalyticDistanceFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,13 @@ class SphereSDF : public SignedDistanceFunction<T> {
}

/*!
@brief Signed distance function
@brief Signed distance function for sphere.
@param[in] a_point Position.
*/
virtual T signedDistance(const Vec3T<T>& a_point) const noexcept override {
const T sign = m_flipInside ? -1.0 : 1.0;

return sign * (m_radius - (a_point-m_center).length());
}

virtual T unsignedDistance2(const Vec3T<T>& a_point) const noexcept override {
return std::abs((a_point - m_center).length2() - m_radius*m_radius);
return sign * ((a_point - m_center).length() - m_radius);
}

protected:
Expand Down
15 changes: 8 additions & 7 deletions Source/EBGeometry_BVH.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ namespace BVH {

/*!
@brief Function for using top-down construction of the bounding volume hierarchy.
@param[in] a_stopFunc Termination function which tells us when to stop the recursion.
@param[in] a_partFunc Partitioning function. This is a polymorphic function which divides a set of primitives into two lists.
@param[in] a_bvFunc Polymorphic function which builds a bounding volume from a set of primitives.
@param[in] a_bvConstructor Polymorphic function which builds a bounding volume from a set of primitives.
@param[in] a_partitioner Partitioning function. This is a polymorphic function which divides a set of primitives into two lists.
@param[in] a_stopCrit Termination function which tells us when to stop the recursion.
@details The rules for terminating the hierarchy construction, how to partition sets of primitives, and how to enclose them by bounding volumes are
given in the input arguments (a_stopFunc, a_partFunc, a_bvFunc)
*/
Expand Down Expand Up @@ -209,8 +209,8 @@ namespace BVH {

/*!
@brief Function which computes the signed distance
@param[in] a_point 3D point in space
@param[in] a_whichPruning Pruning algorithm
@param[in] a_point 3D point in space
@param[in] a_pruning Pruning algorithm
@return Signed distance to the input point
@details This will select amongs the various implementations.
*/
Expand Down Expand Up @@ -490,7 +490,7 @@ namespace BVH {

/*!
@brief Set the bounding volume
@param[in] a_bv Bounding volume for this node.
@param[in] a_boundingVolume Bounding volume for this node.
*/
inline
void setBoundingVolume(const BV& a_boundingVolume) noexcept;
Expand Down Expand Up @@ -651,7 +651,8 @@ namespace BVH {

/*!
@brief Function which computes the signed distance
@param[in] a_point 3D point in space
@param[in] a_point 3D point in space
@param[in] a_pruning Pruning algorithm.
*/
inline
T signedDistance(const Vec3& a_point, const Prune a_pruning = Prune::Ordered2) const noexcept;
Expand Down
2 changes: 1 addition & 1 deletion Source/EBGeometry_BVHImplem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace BVH {

template <class T, class P, class BV, int K>
inline
NodeT<T, P, BV, K>::NodeT(const PrimitiveList& a_primitives) : NodeT<T, P, BV, K>() {
NodeT<T, P, BV, K>::NodeT(const std::vector<std::shared_ptr<const P> >& a_primitives) : NodeT<T, P, BV, K>() {
m_primitives = a_primitives;

m_nodeType = NodeType::Leaf;
Expand Down
8 changes: 4 additions & 4 deletions Source/EBGeometry_BoundingVolumes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

/*!
@file EBGeometry_BoundingVolumes.H
@file EBGeometry_BoundingVolumes.hpp
@brief Declaration of a various bounding volumes used for bounding volume hierarchy.
@author Robert Marskar
*/
Expand Down Expand Up @@ -58,7 +58,7 @@ namespace BoundingVolumes {

/*!
@brief Full constructor. Constructs a bounding sphere that encloses all the other bounding spheres
@param[in] a_others Other bounding spheres.
@param[in] a_otherSpheres Other bounding spheres.
*/
BoundingSphereT(const std::vector<BoundingSphereT<T> >& a_otherSpheres);

Expand Down Expand Up @@ -91,7 +91,7 @@ namespace BoundingVolumes {
*/
template <class P>
inline
void define(const std::vector<Vec3T<P> >& a_points, const BoundingVolumeAlgorithm& a_algorithm) noexcept;
void define(const std::vector<Vec3T<P> >& a_points, const BoundingVolumeAlgorithm& a_alg) noexcept;

/*!
@brief Check if this bounding sphere intersect another bounding sphere
Expand Down Expand Up @@ -219,7 +219,7 @@ namespace BoundingVolumes {
@brief Constructor which creates an AABB which encloses a set of other AABBs.
@param[in] a_others Other bounding boxes
*/
AABBT(const std::vector<AABBT>& a_others);
AABBT(const std::vector<AABBT<T> >& a_others);

/*!
@brief Destructor (does nothing)
Expand Down
2 changes: 1 addition & 1 deletion Source/EBGeometry_DcelFace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

/*!
@file EBGeometry_DcelFace.H
@file EBGeometry_DcelFace.hpp
@brief Declaration of a polygon face class for use in DCEL descriptions of polygon tesselations.
@author Robert Marskar
*/
Expand Down
2 changes: 1 addition & 1 deletion Source/EBGeometry_DcelMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

/*!
@file EBGeometry__DcelMesh.hpp
@file EBGeometry_DcelMesh.hpp
@brief Declaration of a mesh class which stores a DCEL mesh (with signed distance functions)
@author Robert Marskar
*/
Expand Down
10 changes: 5 additions & 5 deletions Source/EBGeometry_DcelParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ namespace Dcel {
inline
static void readASCII(Mesh& a_mesh, const std::string a_filename);



protected:

/*!
Expand Down Expand Up @@ -109,9 +107,11 @@ namespace Dcel {

/*!
@brief Read ASCII faces and create mesh connectivity.
@param[out] a_faces DCEL faces. Constructured in this routine.
@param[out] a_edges DCEL edges. Constructured in this routine.
@param[out] a_vertices DCEL edges. Constructured in readVerticesASCII.
@param[out] a_faces DCEL faces. Constructured in this routine.
@param[out] a_edges DCEL edges. Constructured in this routine.
@param[out] a_vertices DCEL edges. Constructured in readVerticesASCII.
@param[in] a_numFaces Total number of faces in mesh.
@param[inout] a_inputStream Input stream
@note The next getline() from inputStream must read the first face, i.e. we assume that read_ascii_vertices was called IMMEDIATELY before this function.
That function will center the fstream on the correct line in the input file.
*/
Expand Down
11 changes: 11 additions & 0 deletions Source/EBGeometry_NamespaceFooter.hpp
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
/* EBGeometry
* Copyright © 2022 Robert Marskar
* Please refer to Copyright.txt and LICENSE in the EBGeometry root directory.
*/

/*!
@file EBGeometry_NamespaceFooter.hpp
@brief Name space footer.
@author Robert Marskar
*/

}
11 changes: 11 additions & 0 deletions Source/EBGeometry_NamespaceHeader.hpp
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
/* EBGeometry
* Copyright © 2022 Robert Marskar
* Please refer to Copyright.txt and LICENSE in the EBGeometry root directory.
*/

/*!
@file EBGeometry_NamespaceHeader.hpp
@brief Name space header.
@author Robert Marskar
*/

namespace EBGeometry {
2 changes: 1 addition & 1 deletion Source/EBGeometry_SignedDistanceFunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SignedDistanceFunction {

/*!
@brief Scale signed distance function.
@param[in] a_Scaling factor.
@param[in] a_scale Scaling factor.
*/
inline
void scale(const Vec3T<T>& a_scale) noexcept;
Expand Down
6 changes: 5 additions & 1 deletion Source/EBGeometry_TransformOps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
#include "EBGeometry_Vec.hpp"
#include "EBGeometry_NamespaceHeader.hpp"

// Parent class for transformation operator.
/*!
@brief Base class for transformation operators.
*/
template <class T>
class TransformOp {
public:
Expand All @@ -33,6 +35,8 @@ class TransformOp {

/*!
@brief Transform input coordinate
@param[in] a_inputPoint Input point
@return Returns transformed point.
*/
virtual Vec3T<T> transform(const Vec3T<T>& a_inputPoint) const noexcept = 0;
};
Expand Down
24 changes: 11 additions & 13 deletions Source/EBGeometry_Vec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Vec2T {

/*!
@brief Copy constructor
@param[in] a_u Other vector
@param[in] u Other vector
@details Sets *this = u
*/
Vec2T(const Vec2T& u);
Expand Down Expand Up @@ -72,19 +72,19 @@ class Vec2T {
static constexpr Vec2T<T> one() noexcept;

/*!
@brief Return a vector with components x = y= -std::numeric_limits<T>::max()
@brief Return minimum possible representative vector.
*/
inline
static constexpr Vec2T<T> min() noexcept;

/*!
@brief Return a vector with components x = y= std::numeric_limits<T>::max()
@brief Return maximum possible representative vector.
*/
inline
static constexpr Vec2T<T> max() noexcept;

/*!
@brief Return a vector with components x = y= std::numeric_limits<T>::infinity()
@brief Return a vector with inf components.
*/
inline
static constexpr Vec2T<T> infinity() noexcept;
Expand Down Expand Up @@ -190,7 +190,7 @@ class Vec2T {
};

/*!
@brief Multiplication operator in the form s*Vec2T<T>.
@brief Multiplication operator in the form s*Vec2T
@param[in] s Multiplication factor
@param[in] a_other Other vector
@return Returns a new vector with components x = s*a_other.x (and same for y)
Expand All @@ -200,7 +200,7 @@ inline
Vec2T<T> operator*(const T& s, const Vec2T<T>& a_other) noexcept;

/*!
@brief Division operator in the form s*Vec2T<T>.
@brief Division operator in the form s*Vec2T.
@param[in] s Division factor
@param[in] a_other Other vector
@return Returns a new vector with components x = (1/s)*a_other.x (and same for y)
Expand Down Expand Up @@ -259,33 +259,33 @@ class Vec3T {
static constexpr Vec3T<T> one() noexcept;

/*!
@brief Return a vector with components x = y = z = -std::numeric_limits<T>::max()
@brief Return a vector with minimum representable components.
*/
inline
static constexpr Vec3T<T> min() noexcept;

/*!
@brief Return a vector with components x = y = z = std::numeric_limits<T>::max()
@brief Return a vector with maximum representable components.
*/
inline
static constexpr Vec3T<T> max() noexcept;

/*!
@brief Return a vector with components x = y = z = std::numeric_limits<T>::infinity()
@brief Return a vector with inf components.
*/
inline
static constexpr Vec3T<T> infinity() noexcept;

/*!
@brief Return component in vector. (i=0 => x and so on)
@param[in] a_i Index. Must be < 3
@param[in] i Index. Must be < 3
*/
inline
T& operator[](int i) noexcept;

/*!
@brief Return non-modifiable component in vector. (i=0 => x and so on)
@param[in] a_i Index. Must be < 3
@param[in] i Index. Must be < 3
*/
inline
const T& operator[](int i) const noexcept;
Expand Down Expand Up @@ -422,8 +422,6 @@ class Vec3T {
inline
Vec3T<T>& operator/=(const T& s) noexcept;



/*!
@brief Vector minimum function. Returns a new vector with componentwise minimums.
@param[in] u Other vector
Expand Down
6 changes: 0 additions & 6 deletions Source/EBGeometry_VecImplem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,6 @@ Vec3T<T> operator*(const T& s, const Vec3T<T>& a_other) noexcept {
return a_other*s;
}

template <class T>
inline
Vec3T<T> operator*(const Vec3T<T>& u, const Vec3T<T>& v) noexcept {
return u * v;
}

template <class T>
inline
Vec3T<T> operator/(const T& s, const Vec3T<T>& a_other) noexcept {
Expand Down
20 changes: 20 additions & 0 deletions Sphinx/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading