Skip to content

Commit

Permalink
upgrade cxxopts to 3.2.1; code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
luk036 committed Mar 24, 2024
1 parent 9c87889 commit febda04
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions include/projgeom/euclid_plane.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ namespace fun {
* @param[in] c
* @return auto
*/
template <OrderedRing _Q> constexpr auto archimede(const _Q &a, const _Q &b, const _Q &c) {
template <OrderedRing _Q> constexpr auto archimedes(const _Q &a, const _Q &b, const _Q &c) {
return 4 * a * b - sq(a + b - c);
}

Expand Down Expand Up @@ -172,7 +172,7 @@ namespace fun {
template <typename T> constexpr auto Ptolemy(const T &quad) -> bool {
const auto &[Q12, Q23, Q34, Q14, Q13, Q24] = quad;
using _K = decltype(Q12);
return archimede(Q12 * Q34, Q23 * Q14, Q13 * Q24) == _K(0);
return archimedes(Q12 * Q34, Q23 * Q14, Q13 * Q24) == _K(0);
}

} // namespace fun
2 changes: 1 addition & 1 deletion include/projgeom/pg_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ namespace fun {
* @param[in] a input value
* @return a^2
*/
template <typename T> constexpr inline auto sq(const T &a) { return a * a; }
template <typename T> constexpr auto sq(const T &a) { return a * a; }

} // namespace fun
2 changes: 1 addition & 1 deletion standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

CPMAddPackage(
GITHUB_REPOSITORY jarro2783/cxxopts
VERSION 3.0.0
VERSION 3.2.1
OPTIONS "CXXOPTS_BUILD_EXAMPLES NO" "CXXOPTS_BUILD_TESTS NO" "CXXOPTS_ENABLE_INSTALL YES"
)

Expand Down
10 changes: 5 additions & 5 deletions test/source/test_euclid.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "projgeom/ck_plane.hpp" // for check_sine...
#include "projgeom/common_concepts.h" // for Value_type
#include "projgeom/euclid_plane.hpp" // for uc_point, archimede
#include "projgeom/euclid_plane.hpp" // for uc_point, archimedes
#include "projgeom/euclid_plane_measure.hpp" // for quadrance
#include "projgeom/fractions.hpp" // for operator*
#include "projgeom/pg_common.hpp" // for sq, cross
Expand Down Expand Up @@ -84,7 +84,7 @@ void chk_euclid(const Triple<Point> &triangle) {
auto q1p = quadrance(a2, a3p);
auto q2p = quadrance(a1, a3p);
auto q3p = quadrance(a1, a2);
auto tqf2 = archimede(q1p, q2p, q3p); // get 0
auto tqf2 = archimedes(q1p, q2p, q3p); // get 0

if constexpr (Integral<K>) {
CHECK(!is_parallel(l1, l2));
Expand All @@ -103,7 +103,7 @@ void chk_euclid(const Triple<Point> &triangle) {
CHECK(coincident(mt1 * mt2, mt3));
// CHECK(cross_s(l1, l2) == c3);
CHECK((c3 + s3) == K(1));
CHECK(tqf == archimede(q1, q2, q3));
CHECK(tqf == archimedes(q1, q2, q3));
CHECK(tsf == K(0));
CHECK(tqf2 == K(0));
// auto o2 = orthocenter(
Expand All @@ -126,7 +126,7 @@ void chk_euclid(const Triple<Point> &triangle) {
CHECK(distance(a1, a1) == Zero);
// CHECK(cross_s(l1, l2) == doctest::Approx(c3).epsilon(0.01));
CHECK((c3 + s3) - 1 == Zero);
CHECK(tqf - archimede(q1, q2, q3) == Zero);
CHECK(tqf - archimedes(q1, q2, q3) == Zero);
CHECK(tsf == Zero);
CHECK(tqf2 == Zero);
// CHECK(ApproxEqual(a1, orthocenter(std::array{std::move(o), // not
Expand Down Expand Up @@ -154,7 +154,7 @@ template <typename T> void chk_cyclic(const T &quadangle) {
std::move(q14), std::move(q24), std::move(q13)});
CHECK(okay);
} else {
auto t = archimede(q12 * q34, q23 * q14, q13 * q24);
auto t = archimedes(q12 * q34, q23 * q14, q13 * q24);
CHECK(t == Zero);
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/source/test_persp_plane.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <type_traits> // for move

#include "projgeom/common_concepts.h" // for Value_type
#include "projgeom/euclid_plane.hpp" // for archimede
#include "projgeom/euclid_plane.hpp" // for archimedes
#include "projgeom/fractions.hpp" // for operator*
#include "projgeom/persp_plane.hpp" // for persp_eucl...
#include "projgeom/pg_common.hpp" // for sq
Expand Down Expand Up @@ -62,13 +62,13 @@ template <typename PG> void chk_degenerate(const PG &myck) {
CHECK(!myck.is_parallel(l1, l2));
CHECK(!myck.is_parallel(l2, l3));
CHECK(coincident(t1 * t2, t3));
CHECK(tqf == archimede(q1, q2, q3));
CHECK(tqf == archimedes(q1, q2, q3));
CHECK(tsf == K(0));
} else {
CHECK(myck.l_inf().dot(l1 * l2) != Zero);
CHECK(myck.l_inf().dot(l2 * l3) != Zero);
CHECK(t1.dot(t2 * t3) == Zero);
CHECK(tqf - archimede(q1, q2, q3) == Zero);
CHECK(tqf - archimedes(q1, q2, q3) == Zero);
CHECK(tsf == Zero);
}
}
Expand All @@ -90,7 +90,7 @@ template <typename PG> void chk_degenerate2(const PG &myck) {

const auto tri2 = std::array{std::move(a1), std::move(a2), std::move(a4)};
const auto [qq1, qq2, qq3] = myck.tri_quadrance(tri2);
const auto tqf2 = archimede(qq1, qq2, qq3); // get 0
const auto tqf2 = archimedes(qq1, qq2, qq3); // get 0

if constexpr (Integral<K>) {
CHECK(tqf2 == 0);
Expand Down

0 comments on commit febda04

Please sign in to comment.