Skip to content

Commit

Permalink
[#27] Documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia-glushchenko authored and MrDmitry committed Dec 7, 2018
1 parent 4ad6d17 commit 2f63ca8
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 46 deletions.
4 changes: 2 additions & 2 deletions Epona/include/Epona/Analysis.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down Expand Up @@ -381,7 +381,7 @@ glm::vec3 CalculateBarycentricCoordinates(glm::vec3 p, glm::vec3 a, glm::vec3 b,
* @param a triangle's point
* @param b triangle's point
* @param c triangle's point
* @return if points are on the same line
* @return true if area is equal to zero
*/
inline bool OneLine(glm::vec3 a, glm::vec3 b, glm::vec3 c)
{
Expand Down
2 changes: 1 addition & 1 deletion Epona/include/Epona/Debug.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down
2 changes: 1 addition & 1 deletion Epona/include/Epona/FloatingPoint.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down
19 changes: 10 additions & 9 deletions Epona/include/Epona/HalfEdgeDataStructure.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down Expand Up @@ -355,7 +355,7 @@ class HalfEdgeDataStructure
*/
const_face_iterator GetAdjacentFaceIterator() const;

//! Stores face index
//! Face index
uint32_t index;

private:
Expand Down Expand Up @@ -413,15 +413,15 @@ class HalfEdgeDataStructure
* @param a vertex index
* @param b vertex index
* @param c vertex index
* @param hp hyperplane containing input vertices
* @param index outside face index
*/
void MakeFace(uint64_t a, uint64_t b, uint64_t c, uint32_t index);

/**
* @brief Inserts face into the current data structure
* @type T array-like type with overaloded operator[]
* @param index face indices array of size 3
* @brief Returns face iterator
* @type T array-like type with overaloded operator[]
* @param index face indices
* @return face iterator
*/
template < typename T >
decltype(auto) GetFace(T index)
Expand All @@ -430,9 +430,10 @@ class HalfEdgeDataStructure
}

/**
* @brief Inserts face into the current data structure
* @type T array-like type with overaloded operator[]
* @param index face indices array of size 3
* @brief Returns face iterator
* @type T array-like type with overaloded operator[]
* @param index face indices
* @return face iterator
*/
template < typename T >
decltype(auto) GetFace(T index) const
Expand Down
2 changes: 1 addition & 1 deletion Epona/include/Epona/HyperPlane.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down
16 changes: 8 additions & 8 deletions Epona/include/Epona/JacobiEigenvalue.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand All @@ -15,11 +15,10 @@
namespace
{
/**
* @brief Finds maximal absolute value off diagonal matrix element and sets its indices
* @brief Finds maximal absolute value off diagonal matrix element and returns its indices
*
* @param[in] mat matrix to search
* @param[out] i max element row index
* @param[out] j max element column index
* @param mat matrix to search
* @return typle of i j indices
*/
inline std::tuple<uint8_t, uint8_t> FindMaxNormOffDiagonal(glm::mat3 mat)
{
Expand Down Expand Up @@ -50,6 +49,7 @@ inline std::tuple<uint8_t, uint8_t> FindMaxNormOffDiagonal(glm::mat3 mat)
* @param[in] mat matrix to rotate
* @param[in] i element row index
* @param[in] j element column index
* @param[in] coverageThreshold coverage precision threshold
*
* @return angle in radians
*/
Expand Down Expand Up @@ -93,7 +93,7 @@ namespace epona
*
* @param[in] symmetricMatrix target symmetric matrix
* @param[in] coverageThreshold coverage precision threshold
* @param[in] maxIterations maximum amount of iteration
* @param[in] maxIterations maximum number of iterations
*/
inline std::tuple<glm::mat3, glm::vec3> CalculateJacobiEigenvectorsEigenvalue(
glm::mat3 symmetricMatrix, float coverageThreshold = epona::fp::g_floatingPointThreshold, uint32_t maxIterations = 100
Expand Down Expand Up @@ -125,7 +125,7 @@ inline std::tuple<glm::mat3, glm::vec3> CalculateJacobiEigenvectorsEigenvalue(
*
* @param[in] symmetricMatrix target symmetric matrix
* @param[in] coverageThreshold coverage precision threshold
* @param[in] maxIterations maximum amount of iteration
* @param[in] maxIterations maximum number of iterations
*/
inline glm::vec3 CalculateJacobiEigenvalue(
glm::mat3 symmetricMatrix, float coverageThreshold = epona::fp::g_floatingPointThreshold, uint32_t maxIterations = 100
Expand Down Expand Up @@ -154,7 +154,7 @@ inline glm::vec3 CalculateJacobiEigenvalue(
*
* @param[in] symmetricMatrix target symmetric matrix
* @param[in] coverageThreshold coverage precision threshold
* @param[in] maxIterations maximum amount of iteration
* @param[in] maxIterations maximum number of iterations
*/
inline glm::mat3 CalculateJacobiEigenvectors(
glm::mat3 symmetricMatrix, float coverageThreshold = epona::fp::g_floatingPointThreshold, uint32_t maxIterations = 100
Expand Down
33 changes: 17 additions & 16 deletions Epona/include/Epona/QuickhullConvexHull.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down Expand Up @@ -73,13 +73,14 @@ struct Ridge {
/**
* @brief Calculates initial tetrehedron for the convex hull
*
* @note vertices size must be >= 4 and non degenerate
* @note vertices size must be >= 4 and nondegenerate
*
* @param vertices input vertex data
* @return convex hull
*/
epona::ConvexHull CalculateConvexHullInitialTetrahedron(std::vector<glm::vec3> const& vertices)
{
//Find directions of the maximum spread for the calculation of the frist approximation of the convex hull
//Find directions of the maximum spread for the calculation of the first approximation of the convex hull
glm::mat3 basis = epona::CalculateJacobiEigenvectors(
epona::CalculateCovarianceMatrix(
vertices.begin(), vertices.end(), epona::CalculateExpectedValue(vertices.begin(), vertices.end())));
Expand Down Expand Up @@ -175,15 +176,15 @@ namespace epona
{

/**
* @brief Updates conex hull based on the vertices data
* @brief Updates convex hull based on the vertices data
*
* @note vertices size must be >= 4 and non degenerate
* @note vertices size must be >= 4 and nondegenerate
* @attention The only way to update vertex data is to append some additional vertices
*
* @param[in, out] hull convex hull to update
* @param[in] vertices updated input vertex data on which hull was based
* @param[in] maxIterations maximum allowed iterations count
* @param[in] distanceThreshold vertex is an inlier if its signed distance is less or equal to the threshold
* @param[in] maxIterations maximum number of iterations
* @param[in] distanceThreshold inlier vertex distance threshold
*/
inline bool RecalculateConvexHull(ConvexHull& hull, std::vector<glm::vec3> const& vertices, uint32_t maxIterations = 100, float distanceThreshold = 1e-3f)
{
Expand Down Expand Up @@ -248,7 +249,7 @@ inline bool RecalculateConvexHull(ConvexHull& hull, std::vector<glm::vec3> const
auto adjFaceIt = hull.heds.GetFace(hull.faces[visibleFaces[vf]])->GetAdjacentFaceIterator();

for (uint8_t i = 0; i < 3; ++i, ++adjFaceIt) {
//NOTE: will work faster then open address map till ~ visitedFaces.size() < 100
//NOTE: will work faster than open address map till ~ visitedFaces.size() < 100
if (std::find(visitedFaces.begin(), visitedFaces.end(), adjFaceIt->index) == visitedFaces.end())
{
visitedFaces.push_back(adjFaceIt->index);
Expand Down Expand Up @@ -286,7 +287,7 @@ inline bool RecalculateConvexHull(ConvexHull& hull, std::vector<glm::vec3> const
{
auto halfEdge = static_cast<HalfEdgeDataStructure::HalfEdge*>(adjFaceIt);
::Ridge const ridge{ static_cast<uint32_t>(halfEdge->vertexIndex), static_cast<uint32_t>(halfEdge->prev->vertexIndex) };
//NOTE: will work faster then open address map till ~ boundary.size() < 100
//NOTE: will work faster than open address map till ~ boundary.size() < 100
if (std::find(boundary.begin(), boundary.end(), ridge) == boundary.end())
{
boundary.push_back(ridge);
Expand All @@ -304,12 +305,12 @@ inline bool RecalculateConvexHull(ConvexHull& hull, std::vector<glm::vec3> const
for (uint32_t vf : visibleFaces) {
auto face = hull.faces[vf];
for (uint8_t i = 0; i < 3; ++i) {
//NOTE: will work faster then open address map till ~ (boundary/outliers).size() < 100
//NOTE: will work faster than open address map till ~ (boundary/outliers).size() < 100
if (std::find(boundary.begin(), boundary.end(), face[i]) == boundary.end()
&& std::find(temporaryOutliers.begin(), temporaryOutliers.end(), face[i]) == temporaryOutliers.end())
{
temporaryOutliers.push_back(face[i]);
//NOTE: will work faster then open address map till ~ hull.indieces.size() < 100
//NOTE: will work faster than open address map till ~ hull.indieces.size() < 100
auto it = std::find(hull.indices.begin(), hull.indices.end(), face[i]);
if (it != hull.indices.end())
hull.indices.erase(it);
Expand Down Expand Up @@ -350,7 +351,7 @@ inline bool RecalculateConvexHull(ConvexHull& hull, std::vector<glm::vec3> const
hull.planes.emplace_back(vertices[extremeOutlierIndex], vertices[ridge.aVertex], vertices[ridge.bVertex], &mean);
}
hull.heds.MakeFace(extremeOutlierIndex, ridge.aVertex, ridge.bVertex, faceIndex);
//NOTE: will work faster then open address map till ~ hull.indieces.size() < 100
//NOTE: will work faster than open address map till ~ hull.indieces.size() < 100
if (std::find(hull.indices.begin(), hull.indices.end(), extremeOutlierIndex) == hull.indices.end())
hull.indices.push_back(extremeOutlierIndex);
}
Expand Down Expand Up @@ -397,13 +398,13 @@ inline bool RecalculateConvexHull(ConvexHull& hull, std::vector<glm::vec3> const
}

/**
* @brief Calculates conex hull based on the vertices data using Quickhull convex hull algorithm
* @brief Calculates convex hull based on the vertices data using Quickhull convex hull algorithm
*
* @note vertices size must be >= 4 and non degenerate
* @note vertices size must be >= 4 and nondegenerate
*
* @param[in] vertices updated input vertex data on which hull was based
* @param[in] maxIterations maximum allowed iterations count
* @param[in] distanceThreshold vertex is an inlier if its signed distance is less or equal to the threshold
* @param[in] maxIterations maximum number of iterations
* @param[in] distanceThreshold inlier vertex distance threshold
* @return convex hull object
*/
inline ConvexHull CalculateConvexHull(std::vector<glm::vec3> const& vertices, uint32_t maxIterations = 100, float distanceThreshold = 1e-3f)
Expand Down
2 changes: 1 addition & 1 deletion Epona/include/Epona/debug/DebugDummy.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down
2 changes: 1 addition & 1 deletion Epona/include/Epona/debug/DebugImplementation.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down
2 changes: 1 addition & 1 deletion Epona/sources/Analysis.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2017 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down
4 changes: 2 additions & 2 deletions Epona/sources/HalfEdgeDataStructure.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down Expand Up @@ -62,7 +62,7 @@ void HalfEdgeDataStructure::MakeFace(uint64_t a, uint64_t b, uint64_t c, uint32_
auto const backFaceIterator = m_facesList.emplace(m_facesList.end(), *newHalfEdges.back());
m_faceIteratorMap[&*backFaceIterator] = backFaceIterator;
m_faceVerticesIteratorMap[faceVerticesKey] = backFaceIterator;
backFaceIterator->index = index;
backFaceIterator->index = index;

//Initialize half edges
IntializeHalfEdge(newHalfEdges[0], &*newHalfEdges[1], &*newHalfEdges[2], &*backFaceIterator, a, b);
Expand Down
2 changes: 1 addition & 1 deletion Epona/sources/HyperPlane.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2017 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down
4 changes: 2 additions & 2 deletions test/AnalysisTests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Godlike
* Copyright (C) 2018 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down Expand Up @@ -2840,4 +2840,4 @@ TEST_CASE("Complex geometry, [ConvexHull]")
REQUIRE_NOTHROW(
epona::CalculateConvexHull(vertices, 1000)
);
}
}

0 comments on commit 2f63ca8

Please sign in to comment.