Skip to content

Commit

Permalink
Resolve issue when referencing monomials in final reification.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyong committed Oct 26, 2019
1 parent 860669d commit 139e6de
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/gal/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace detail
compute_entity(std::array<ind_value<F>, N> const& data, std::index_sequence<I...>) noexcept
{
using entity_t = entity<A, F, ie.terms[I].element...>;
return entity_t{cterm<F, ie, I, std::make_index_sequence<ie.terms[I].count>>::value(data)...};
return entity_t{cterm<F, ie, ie.terms[I].mon_offset, std::make_index_sequence<ie.terms[I].count>>::value(data)...};
}

template <typename A, typename V, typename T, typename D>
Expand Down
2 changes: 1 addition & 1 deletion public/gal/entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace detail
constexpr size_t count = sizeof...(E);

return mv<A, count, count, count>{
mv_size{count, count, count}, {ind{id + N, rat{1}}...}, {mon{one, one, 1, N}...}, {term{1, N, E}...}};
mv_size{count, count, count}, {ind{id + N, one}...}, {mon{one, one, 1, N}...}, {term{1, N, E}...}};
}

template <typename T>
Expand Down
2 changes: 2 additions & 0 deletions test/test_ega.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <doctest/doctest.h>
#include <gal/ega.hpp>
#include <gal/engine.hpp>
#include <gal/expression_debug.hpp>
#include <gal/format.hpp>

#include <cstdio>
Expand All @@ -26,6 +27,7 @@ TEST_CASE("rotors")
auto result = gal::detail::product(ega_algebra::geometric{}, ie1, ie2);
auto reverse = gal::detail::reverse(ie1);

auto r = gal::evaluate<vector<>, vector<>>{}.debug([](auto v1, auto v2) { return v1 % v2; });
auto reflect = compute([](auto v1, auto v2) { return v1 % v2; }, v1, v2);
CHECK_EQ(reflect[0], doctest::Approx(1));
CHECK_EQ(reflect[1], doctest::Approx(-1));
Expand Down
9 changes: 9 additions & 0 deletions test/test_pga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ TEST_CASE("incidence")

std::cout << to_string(line) << std::endl;
}

SUBCASE("plane-construction")
{
point<> p1{1, 0, 0};
point<> p2{0, 1, 0};
point<> p3{0, 0, 1};
plane<> p = compute([](auto pl1, auto pl2, auto pl3) { return pl1 & pl2 & pl3; }, p1, p2, p3);
std::printf("plane: %f + %f*x + %f*y + %fz)\n", p.d, p.x, p.y, p.z);
}
}

TEST_CASE("motors")
Expand Down

0 comments on commit 139e6de

Please sign in to comment.