Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
typed-geometry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Philip Trettner
typed-geometry
Commits
c4d093bc
Commit
c4d093bc
authored
4 years ago
by
Philip Trettner
Browse files
Options
Downloads
Patches
Plain Diff
added full 4x4 coefficient mat for quadrics
parent
ac9e89dc
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/typed-geometry/types/quadric.hh
+38
-0
38 additions, 0 deletions
src/typed-geometry/types/quadric.hh
with
38 additions
and
0 deletions
src/typed-geometry/types/quadric.hh
+
38
−
0
View file @
c4d093bc
...
...
@@ -131,6 +131,7 @@ struct quadric<3, ScalarT>
using
vec_t
=
tg
::
vec
<
3
,
ScalarT
>
;
using
pos_t
=
tg
::
pos
<
3
,
ScalarT
>
;
using
mat_t
=
tg
::
mat
<
3
,
3
,
ScalarT
>
;
using
mat4_t
=
tg
::
mat
<
4
,
4
,
ScalarT
>
;
// x^T A x - 2 b^T x + c
public:
...
...
@@ -184,8 +185,45 @@ public:
q
.
c
=
c
;
return
q
;
}
static
constexpr
quadric
from_coefficients
(
mat4_t
const
&
Q
)
{
quadric
q
;
q
.
A00
=
Q
[
0
][
0
];
q
.
A01
=
Q
[
0
][
1
];
q
.
A02
=
Q
[
0
][
2
];
q
.
A11
=
Q
[
1
][
1
];
q
.
A12
=
Q
[
1
][
2
];
q
.
A22
=
Q
[
2
][
2
];
q
.
b0
=
-
Q
[
3
][
0
];
q
.
b1
=
-
Q
[
3
][
1
];
q
.
b2
=
-
Q
[
3
][
2
];
q
.
c
=
Q
[
3
][
3
];
return
q
;
}
public
:
// x^T Q x
constexpr
mat
<
4
,
4
,
ScalarT
>
const
Q
()
const
{
mat
<
4
,
4
,
ScalarT
>
m
;
m
[
0
][
0
]
=
A00
;
m
[
0
][
1
]
=
A01
;
m
[
0
][
2
]
=
A02
;
m
[
1
][
0
]
=
A01
;
m
[
1
][
1
]
=
A11
;
m
[
1
][
2
]
=
A12
;
m
[
2
][
0
]
=
A02
;
m
[
2
][
1
]
=
A12
;
m
[
2
][
2
]
=
A22
;
m
[
3
][
0
]
=
-
b0
;
m
[
3
][
1
]
=
-
b1
;
m
[
3
][
2
]
=
-
b2
;
m
[
0
][
3
]
=
-
b0
;
m
[
1
][
3
]
=
-
b1
;
m
[
2
][
3
]
=
-
b2
;
m
[
3
][
3
]
=
c
;
return
m
;
}
constexpr
mat
<
3
,
3
,
ScalarT
>
const
A
()
const
{
mat
<
3
,
3
,
ScalarT
>
m
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment