Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
hpp-fcl
Commits
44254981
Commit
44254981
authored
Sep 10, 2019
by
Joseph Mirabel
Browse files
[Python] Update bindings.
parent
69c3ad5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
python/collision-geometries.cc
View file @
44254981
...
...
@@ -47,18 +47,15 @@ using namespace hpp::fcl;
using
boost
::
shared_ptr
;
using
boost
::
noncopyable
;
template
<
typename
BV
>
struct
BVHModelWrapper
struct
BVHModelBaseWrapper
{
typedef
BVHModel
<
BV
>
BVHModel_t
;
static
Vec3f
vertices
(
const
BVHModel_t
&
bvh
,
int
i
)
static
Vec3f
vertices
(
const
BVHModelBase
&
bvh
,
int
i
)
{
if
(
i
>=
bvh
.
num_vertices
)
throw
std
::
out_of_range
(
"index is out of range"
);
return
bvh
.
vertices
[
i
];
}
static
Triangle
tri_indices
(
const
BVHModel
_t
&
bvh
,
int
i
)
static
Triangle
tri_indices
(
const
BVHModel
Base
&
bvh
,
int
i
)
{
if
(
i
>=
bvh
.
num_tris
)
throw
std
::
out_of_range
(
"index is out of range"
);
return
bvh
.
tri_indices
[
i
];
...
...
@@ -69,19 +66,10 @@ template <typename BV>
void
exposeBVHModel
(
const
std
::
string
&
bvname
)
{
typedef
BVHModel
<
BV
>
BVHModel_t
;
typedef
BVHModelWrapper
<
BV
>
Wrapper_t
;
std
::
string
type
=
"BVHModel"
+
bvname
;
class_
<
BVHModel_t
,
bases
<
CollisionGeometry
>
,
shared_ptr
<
BVHModel_t
>
>
class_
<
BVHModel_t
,
bases
<
BVHModelBase
>
,
shared_ptr
<
BVHModel_t
>
>
(
type
.
c_str
(),
init
<>
())
.
def
(
"vertices"
,
&
Wrapper_t
::
vertices
)
.
def
(
"tri_indices"
,
&
Wrapper_t
::
tri_indices
)
.
def_readonly
(
"num_vertices"
,
&
BVHModel_t
::
num_vertices
)
.
def_readonly
(
"num_tris"
,
&
BVHModel_t
::
num_tris
)
.
def_readonly
(
"convex"
,
&
BVHModel_t
::
convex
)
.
def
(
"buildConvexRepresentation"
,
&
BVHModel_t
::
buildConvexRepresentation
)
;
}
...
...
@@ -236,6 +224,17 @@ void exposeCollisionGeometries ()
exposeShapes
();
class_
<
BVHModelBase
,
bases
<
CollisionGeometry
>
,
BVHModelPtr_t
,
noncopyable
>
(
"BVHModelBase"
,
no_init
)
.
def
(
"vertices"
,
&
BVHModelBaseWrapper
::
vertices
)
.
def
(
"tri_indices"
,
&
BVHModelBaseWrapper
::
tri_indices
)
.
def_readonly
(
"num_vertices"
,
&
BVHModelBase
::
num_vertices
)
.
def_readonly
(
"num_tris"
,
&
BVHModelBase
::
num_tris
)
.
def_readonly
(
"convex"
,
&
BVHModelBase
::
convex
)
.
def
(
"buildConvexRepresentation"
,
&
BVHModelBase
::
buildConvexRepresentation
)
;
exposeBVHModel
<
OBB
>
(
"OBB"
);
exposeBVHModel
<
OBBRSS
>
(
"OBBRSS"
);
}
python/fcl.cc
View file @
44254981
...
...
@@ -53,7 +53,7 @@ using boost::noncopyable;
void
exposeMeshLoader
()
{
class_
<
MeshLoader
>
(
"MeshLoader"
,
init
<
optional
<
NODE_TYPE
>
>
())
.
def
(
"load"
,
static_cast
<
CollisionGeometry
Ptr_t
(
MeshLoader
::*
)
(
const
std
::
string
&
,
const
Vec3f
&
)
>
(
&
MeshLoader
::
load
))
.
def
(
"load"
,
static_cast
<
BVHModel
Ptr_t
(
MeshLoader
::*
)
(
const
std
::
string
&
,
const
Vec3f
&
)
>
(
&
MeshLoader
::
load
))
;
class_
<
CachedMeshLoader
,
bases
<
MeshLoader
>
>
(
"CachedMeshLoader"
,
init
<
optional
<
NODE_TYPE
>
>
())
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment