Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Philip Trettner
typed-geometry
Commits
b6fc632a
Commit
b6fc632a
authored
Jun 22, 2020
by
Julius Nehring-Wirxel
Browse files
Added from_coefficients for 2d quadric.
parent
831901c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/typed-geometry/types/quadric.hh
View file @
b6fc632a
...
...
@@ -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;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment