Commit dd90a0d2 authored by Philip Trettner's avatar Philip Trettner

Merge branch 'feature/quadric2' into 'develop'

Feature/quadric2

See merge request !86
parents 1a093c6c a23bdb40
......@@ -41,15 +41,10 @@ template <class ScalarT>
}
template <class T>
tg::mat<1, 1, T> self_outer_product(tg::vec<2, T> const& v)
tg::mat<1, 1, T> self_outer_product(tg::vec<1, T> const& v)
{
auto const a = v.x;
auto const b = v.y;
tg::mat<2, 2, T> M;
M[0][0] = a * a;
tg::mat<1, 1, T> M;
M[0][0] = v[0] * v[0];
return M;
}
template <class T>
......
......@@ -37,6 +37,7 @@ struct quadric<2, ScalarT>
using scalar_t = ScalarT;
using vec_t = tg::vec<2, ScalarT>;
using pos_t = tg::pos<2, ScalarT>;
using mat_t = tg::mat<2, 2, ScalarT>;
// x^T A x - 2 b^T x + c
public:
......@@ -52,6 +53,18 @@ public:
public:
constexpr quadric() = default;
static constexpr quadric from_coefficients(mat_t const& A, vec_t const& b, scalar_t c)
{
quadric q;
q.A00 = A[0][0];
q.A01 = A[0][1];
q.A11 = A[1][1];
q.b0 = b[0];
q.b1 = b[1];
q.c = c;
return q;
}
// TODO: constexpr explicit quadric(mat<3, 3, ScalarT> const& m);
// TODO: constexpr explicit operator mat<3, 3, ScalarT>() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment