Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
aadd967f
Commit
aadd967f
authored
5 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Add is_inside
parent
fce1a96e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SimoxUtility/shapes/AxisAlignedBoundingBox.cpp
+9
-3
9 additions, 3 deletions
SimoxUtility/shapes/AxisAlignedBoundingBox.cpp
SimoxUtility/shapes/AxisAlignedBoundingBox.h
+23
-0
23 additions, 0 deletions
SimoxUtility/shapes/AxisAlignedBoundingBox.h
with
32 additions
and
3 deletions
SimoxUtility/shapes/AxisAlignedBoundingBox.cpp
+
9
−
3
View file @
aadd967f
...
...
@@ -273,9 +273,15 @@ namespace simox
bool
aabb
::
is_colliding
(
const
AxisAlignedBoundingBox
&
a
,
const
AxisAlignedBoundingBox
&
b
)
{
return
(
a
.
minX
()
<=
b
.
maxX
()
and
a
.
maxX
()
>=
b
.
minX
()
and
a
.
minY
()
<=
b
.
maxY
()
and
a
.
maxY
()
>=
b
.
minY
()
and
a
.
minZ
()
<=
b
.
maxZ
()
and
a
.
maxZ
()
>=
b
.
minZ
());
return
(
a
.
min_x
()
<=
b
.
max_x
()
and
a
.
max_x
()
>=
b
.
min_x
()
and
a
.
min_y
()
<=
b
.
max_y
()
and
a
.
max_y
()
>=
b
.
min_y
()
and
a
.
min_z
()
<=
b
.
max_z
()
and
a
.
max_z
()
>=
b
.
min_z
());
}
bool
aabb
::
is_inside
(
const
AxisAlignedBoundingBox
&
aabb
,
const
Eigen
::
Vector3f
&
p
)
{
return
aabb
.
min_x
()
<=
p
.
x
()
and
aabb
.
min_y
()
<=
p
.
y
()
and
aabb
.
min_z
()
<=
p
.
z
()
and
p
.
x
()
<=
aabb
.
max_x
()
and
p
.
y
()
<=
aabb
.
max_y
()
and
p
.
z
()
<=
aabb
.
max_z
();
}
}
...
...
This diff is collapsed.
Click to expand it.
SimoxUtility/shapes/AxisAlignedBoundingBox.h
+
23
−
0
View file @
aadd967f
...
...
@@ -92,6 +92,11 @@ namespace simox
/// Checks whether `*this` is colliding (i.e. overlapping) with `other`.
bool
is_colliding
(
const
AxisAlignedBoundingBox
&
other
)
const
;
/// Indicates whether `point` is inside `*this`.
template
<
class
PointT
>
bool
is_inside
(
const
PointT
&
p
);
private:
...
...
@@ -123,6 +128,24 @@ namespace aabb
/// Checks whether `lhs` is colliding (i.e. overlapping) with `rhs`.
bool
is_colliding
(
const
AxisAlignedBoundingBox
&
lhs
,
const
AxisAlignedBoundingBox
&
rhs
);
/// Indicates whether `point` is inside `aabb`.
bool
is_inside
(
const
AxisAlignedBoundingBox
&
aabb
,
const
Eigen
::
Vector3f
&
point
);
/// Indicates whether `point` is inside `aabb`.
/// `PointT` must have members variables x, y, z.
template
<
class
PointT
>
bool
is_inside
(
const
AxisAlignedBoundingBox
&
aabb
,
const
PointT
&
p
)
{
return
aabb
.
min_x
()
<=
p
.
x
and
aabb
.
min_y
()
<=
p
.
y
and
aabb
.
min_z
()
<=
p
.
z
and
p
.
x
<=
aabb
.
max_x
()
and
p
.
y
<=
aabb
.
max_y
()
and
p
.
z
<=
aabb
.
max_z
();
}
}
template
<
class
PointT
>
bool
AxisAlignedBoundingBox
::
is_inside
(
const
PointT
&
p
)
{
return
aabb
::
is_inside
(
*
this
,
p
);
}
}
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