Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Philip Trettner
typed-geometry
Commits
afa57ab9
Commit
afa57ab9
authored
Mar 30, 2020
by
Julius Nehring-Wirxel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed are_orthogonal for real.
parent
69649b8a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
src/typed-geometry/functions/tests/vec_tests.hh
src/typed-geometry/functions/tests/vec_tests.hh
+3
-1
No files found.
src/typed-geometry/functions/tests/vec_tests.hh
View file @
afa57ab9
...
...
@@ -32,7 +32,9 @@ template <int D, class ScalarT, class = enable_if<is_floating_point<ScalarT>>>
template
<
int
D
,
class
ScalarT
>
[[
nodiscard
]]
constexpr
bool
are_orthogonal
(
vec
<
D
,
ScalarT
>
const
&
a
,
vec
<
D
,
ScalarT
>
const
&
b
,
ScalarT
eps
=
100
*
D
*
tg
::
epsilon
<
ScalarT
>
)
{
return
abs
(
dot
(
a
,
b
))
<
max
(
max_element
(
abs
(
a
)),
max_element
(
abs
(
b
)))
*
eps
;
// the error scales with the square of the magnitude of the inputs
auto
const
scale
=
max
(
max_element
(
abs
(
a
)),
max_element
(
abs
(
b
)));
return
abs
(
dot
(
a
,
b
))
<
scale
*
scale
*
eps
;
}
template
<
int
D
,
class
ScalarT
>
...
...
Write
Preview
Markdown
is supported
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