Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
coal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Coal
coal
Commits
2c716202
Commit
2c716202
authored
5 years ago
by
Joseph Mirabel
Browse files
Options
Downloads
Patches
Plain Diff
Add node type as attribute of MeshLoader.
parent
a48e934b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/hpp/fcl/mesh_loader/loader.h
+32
-7
32 additions, 7 deletions
include/hpp/fcl/mesh_loader/loader.h
src/mesh_loader/loader.cpp
+5
-9
5 additions, 9 deletions
src/mesh_loader/loader.cpp
with
37 additions
and
16 deletions
include/hpp/fcl/mesh_loader/loader.h
+
32
−
7
View file @
2c716202
...
...
@@ -39,6 +39,7 @@
#include
<boost/shared_ptr.hpp>
#include
<hpp/fcl/fwd.hh>
#include
<hpp/fcl/config.hh>
#include
<hpp/fcl/math/vec_3f.h>
#include
<hpp/fcl/collision_object.h>
...
...
@@ -52,9 +53,23 @@ namespace fcl {
public:
virtual
~
MeshLoader
()
{}
virtual
CollisionGeometryPtr_t
load
(
const
std
::
string
&
filename
,
/// \param bvType ignored
/// \deprecated Use MeshLoader::load(const std::string&, const Vec3f&)
CollisionGeometryPtr_t
load
(
const
std
::
string
&
filename
,
const
Vec3f
&
scale
,
const
NODE_TYPE
&
bvType
);
const
NODE_TYPE
&
bvType
)
HPP_FCL_DEPRECATED
{
(
void
)
bvType
;
return
load
(
filename
,
scale
);
}
virtual
CollisionGeometryPtr_t
load
(
const
std
::
string
&
filename
,
const
Vec3f
&
scale
);
MeshLoader
(
const
NODE_TYPE
&
bvType
=
BV_OBBRSS
)
:
bvType_
(
bvType
)
{}
private
:
const
NODE_TYPE
bvType_
;
};
/// Class for building polyhedron from files with cache mechanism.
...
...
@@ -66,17 +81,27 @@ namespace fcl {
public:
virtual
~
CachedMeshLoader
()
{}
virtual
CollisionGeometryPtr_t
load
(
const
std
::
string
&
filename
,
CachedMeshLoader
(
const
NODE_TYPE
&
bvType
=
BV_OBBRSS
)
:
MeshLoader
(
bvType
)
{}
/// \param bvType ignored
/// \deprecated Use MeshLoader::load(const std::string&, const Vec3f&)
CollisionGeometryPtr_t
load
(
const
std
::
string
&
filename
,
const
Vec3f
&
scale
,
const
NODE_TYPE
&
bvType
);
const
NODE_TYPE
&
bvType
)
HPP_FCL_DEPRECATED
{
(
void
)
bvType
;
return
load
(
filename
,
scale
);
}
virtual
CollisionGeometryPtr_t
load
(
const
std
::
string
&
filename
,
const
Vec3f
&
scale
);
struct
Key
{
std
::
string
filename
;
Vec3f
scale
;
NODE_TYPE
bvType
;
Key
(
const
std
::
string
&
f
,
const
Vec3f
&
s
,
const
NODE_TYPE
&
t
)
:
filename
(
f
),
scale
(
s
)
,
bvType
(
t
)
{}
Key
(
const
std
::
string
&
f
,
const
Vec3f
&
s
)
:
filename
(
f
),
scale
(
s
)
{}
bool
operator
<
(
const
CachedMeshLoader
::
Key
&
b
)
const
;
};
...
...
This diff is collapsed.
Click to expand it.
src/mesh_loader/loader.cpp
+
5
−
9
View file @
2c716202
...
...
@@ -45,8 +45,6 @@ namespace fcl {
bool
CachedMeshLoader
::
Key
::
operator
<
(
const
CachedMeshLoader
::
Key
&
b
)
const
{
const
CachedMeshLoader
::
Key
&
a
=
*
this
;
if
(
a
.
bvType
<
b
.
bvType
)
return
true
;
if
(
a
.
bvType
>
b
.
bvType
)
return
false
;
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
if
(
a
.
scale
[
i
]
<
b
.
scale
[
i
])
return
true
;
else
if
(
a
.
scale
[
i
]
>
b
.
scale
[
i
])
return
false
;
...
...
@@ -63,10 +61,9 @@ namespace fcl {
}
CollisionGeometryPtr_t
MeshLoader
::
load
(
const
std
::
string
&
filename
,
const
Vec3f
&
scale
,
const
NODE_TYPE
&
bvType
)
const
Vec3f
&
scale
)
{
switch
(
bvType
)
{
switch
(
bvType
_
)
{
case
BV_AABB
:
return
_load
<
AABB
>
(
filename
,
scale
);
case
BV_OBB
:
return
_load
<
OBB
>
(
filename
,
scale
);
case
BV_RSS
:
return
_load
<
RSS
>
(
filename
,
scale
);
...
...
@@ -81,13 +78,12 @@ namespace fcl {
}
CollisionGeometryPtr_t
CachedMeshLoader
::
load
(
const
std
::
string
&
filename
,
const
Vec3f
&
scale
,
const
NODE_TYPE
&
bvType
)
const
Vec3f
&
scale
)
{
Key
key
(
filename
,
scale
,
bvType
);
Key
key
(
filename
,
scale
);
Cache_t
::
const_iterator
_cached
=
cache_
.
find
(
key
);
if
(
_cached
==
cache_
.
end
())
{
CollisionGeometryPtr_t
geom
=
MeshLoader
::
load
(
filename
,
scale
,
bvType
);
CollisionGeometryPtr_t
geom
=
MeshLoader
::
load
(
filename
,
scale
);
cache_
.
insert
(
std
::
make_pair
(
key
,
geom
));
return
geom
;
}
else
{
...
...
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