Skip to content

Commit

Permalink
[#27] QHull optimization and 2019 copyrights update
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia-glushchenko committed Dec 1, 2018
1 parent 471f6d3 commit 4ba3251
Show file tree
Hide file tree
Showing 14 changed files with 317 additions and 328 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) 2017 by Godlike
* Copyright (C) 2019 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down Expand Up @@ -377,7 +377,7 @@ glm::vec3 CalculateBarycentricCoordinates(glm::vec3 p, glm::vec3 a, glm::vec3 b,

/*
* @brief Calculate area of the triangle and returns true if area is equal to zero
*
*
* @param a triangle's point
* @param b triangle's point
* @param c triangle's point
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) 2018 by Godlike
* Copyright (C) 2019 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) 2017 by Godlike
* Copyright (C) 2019 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down
102 changes: 46 additions & 56 deletions Epona/include/Epona/HalfEdgeDataStructure.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 by Godlike
* Copyright (C) 2019 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down Expand Up @@ -28,9 +28,9 @@ class HalfEdgeDataStructure
HalfEdgeDataStructure() = default;

HalfEdgeDataStructure(HalfEdgeDataStructure const&) = delete;

HalfEdgeDataStructure& operator=(HalfEdgeDataStructure const& heds) = delete;

HalfEdgeDataStructure(HalfEdgeDataStructure&& heds)
{
m_halfEdgeList = std::move(heds.m_halfEdgeList);
Expand All @@ -52,7 +52,7 @@ class HalfEdgeDataStructure
m_faceIteratorMap = std::move(heds.m_faceIteratorMap);
m_faceVerticesIteratorMap = std::move(heds.m_faceVerticesIteratorMap);

return *this;
return *this;
}

/**
Expand Down Expand Up @@ -315,11 +315,11 @@ class HalfEdgeDataStructure
{
return AdjacentFaceCirculator<FaceType const>(*this);
}
operator HalfEdge*() const
{
return m_currentHalfEdge;
}

operator HalfEdge*() const
{
return m_currentHalfEdge;
}

private:
HalfEdge* m_currentHalfEdge;
Expand Down Expand Up @@ -355,11 +355,8 @@ class HalfEdgeDataStructure
*/
const_face_iterator GetAdjacentFaceIterator() const;

//! Stores face hyperplane
HyperPlane hyperPlane;

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

private:
HalfEdge* m_halfEdge;
Expand Down Expand Up @@ -400,48 +397,48 @@ class HalfEdgeDataStructure
uint64_t vertexIndex;
};

/**
* @brief Inserts face into the current data structure
* @param[in] a vertex index
* @param[in] b vertex index
* @param[in] c vertex index
*/
void MakeFace(uint64_t a, uint64_t b, uint64_t c)
{
MakeFace(a, b, c, {}, 0);
}
/**
* @brief Inserts face into the current data structure
* @param[in] a vertex index
* @param[in] b vertex index
* @param[in] c vertex index
*/
void MakeFace(uint64_t a, uint64_t b, uint64_t c)
{
MakeFace(a, b, c, 0);
}

/**
* @brief Inserts face into the current data structure
* @param a vertex index
* @param b vertex index
* @param c vertex index
* @param hp hyperplane containing input vertices
* @param index outside face index
* @param hp hyperplane containing input vertices
* @param index outside face index
*/
void MakeFace(uint64_t a, uint64_t b, uint64_t c, HyperPlane hp, 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
*/
template < typename T >
decltype(auto) GetFace(T index)
{
return GetFace(index[0], index[1], index[2]);
}

/**
* @brief Inserts face into the current data structure
* @type T array-like type with overaloded operator[]
* @param index face indices array of size 3
*/
template < typename T >
decltype(auto) GetFace(T index) const
{
return GetFace(index[0], index[1], index[2]);
}
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
*/
template < typename T >
decltype(auto) GetFace(T index)
{
return GetFace(index[0], index[1], index[2]);
}

/**
* @brief Inserts face into the current data structure
* @type T array-like type with overaloded operator[]
* @param index face indices array of size 3
*/
template < typename T >
decltype(auto) GetFace(T index) const
{
return GetFace(index[0], index[1], index[2]);
}

/**
* @brief Returns a face iterator
Expand Down Expand Up @@ -538,12 +535,5 @@ class HalfEdgeDataStructure
);
};

template < typename T >
std::tuple<uint64_t, uint64_t> GetRidge(HalfEdgeDataStructure::face_iterator it)
{


return {};
}
} // namespace epona
#endif // EPONA_HEDS_HPP
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) 2017 by Godlike
* Copyright (C) 2019 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down
8 changes: 4 additions & 4 deletions Epona/include/Epona/JacobiEigenvalue.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 by Godlike
* Copyright (C) 2019 by Godlike
* This code is licensed under the MIT license (MIT)
* (http://opensource.org/licenses/MIT)
*/
Expand Down Expand Up @@ -105,7 +105,7 @@ inline std::tuple<glm::mat3, glm::vec3> CalculateJacobiEigenvectorsEigenvalue(
uint8_t j;
uint16_t iterations = 0;

do
do
{
std::tie(i, j) = ::FindMaxNormOffDiagonal(symmetricMatrix);

Expand All @@ -114,7 +114,7 @@ inline std::tuple<glm::mat3, glm::vec3> CalculateJacobiEigenvectorsEigenvalue(
symmetricMatrix = (glm::transpose(rotationMatrix) * symmetricMatrix) * rotationMatrix;

std::tie(i, j) = ::FindMaxNormOffDiagonal(symmetricMatrix);
}
}
while ((++iterations < maxIterations) && (glm::abs(symmetricMatrix[i][j]) > coverageThreshold));

return std::tuple<glm::mat3, glm::vec3>{ eigenvectors, glm::vec3{ symmetricMatrix[0][0], symmetricMatrix[1][1], symmetricMatrix[2][2] } };
Expand Down Expand Up @@ -160,7 +160,7 @@ inline glm::mat3 CalculateJacobiEigenvectors(
glm::mat3 symmetricMatrix, float coverageThreshold = epona::fp::g_floatingPointThreshold, uint32_t maxIterations = 100
)
{
glm::mat3 eigenvectors(1);
glm::mat3 eigenvectors(1);
glm::mat3 rotationMatrix(1);
uint8_t i = 0;
uint8_t j = 0;
Expand Down
Loading

0 comments on commit 4ba3251

Please sign in to comment.