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
abba38e2
Commit
abba38e2
authored
Feb 06, 2021
by
Aaron Grabowy
Browse files
Added contains(objA, objB) default implementation when vertices_of(objB) is available
parent
baf38aeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/typed-geometry/functions/objects/contains.hh
View file @
abba38e2
...
...
@@ -46,6 +46,19 @@ template <int D, class ScalarT>
return
b
==
o
;
}
// default implementation for contains(objA, objB) that works for all convex objB with vertices_of defined
template
<
class
A
,
class
B
>
[[
nodiscard
]]
constexpr
auto
contains
(
A
const
&
a
,
B
const
&
b
,
dont_deduce
<
typename
B
::
scalar_t
>
eps
=
static_cast
<
typename
B
::
scalar_t
>
(
0
))
->
decltype
(
vertices_of
(
b
),
false
)
{
for
(
auto
const
&
vertex
:
vertices_of
(
b
))
if
(
!
contains
(
a
,
vertex
,
eps
))
return
false
;
return
true
;
}
// object specific implementations for contains(obj, pos)
template
<
class
ScalarT
>
[[
nodiscard
]]
constexpr
bool
contains
(
aabb
<
1
,
ScalarT
>
const
&
b
,
ScalarT
const
&
o
,
dont_deduce
<
ScalarT
>
eps
=
ScalarT
(
0
))
{
...
...
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