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
Humanoid Path Planner
hpp-fcl
Commits
8471b409
Verified
Commit
8471b409
authored
Sep 11, 2021
by
Justin Carpentier
Browse files
python: export meshes vertices
parent
5beff602
Pipeline
#16029
passed with stage
in 28 minutes and 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
python/collision-geometries.cc
View file @
8471b409
...
...
@@ -77,12 +77,20 @@ typedef std::vector<Triangle> Triangles;
struct
BVHModelBaseWrapper
{
static
Vec3f
vertices
(
const
BVHModelBase
&
bvh
,
int
i
)
typedef
Eigen
::
Matrix
<
double
,
Eigen
::
Dynamic
,
3
>
MatrixX3
;
typedef
Eigen
::
Map
<
MatrixX3
>
MapMatrixX3
;
static
Vec3f
&
vertice
(
BVHModelBase
&
bvh
,
int
i
)
{
if
(
i
>=
bvh
.
num_vertices
)
throw
std
::
out_of_range
(
"index is out of range"
);
return
bvh
.
vertices
[
i
];
}
static
MapMatrixX3
vertices
(
BVHModelBase
&
bvh
)
{
return
MapMatrixX3
(
bvh
.
vertices
[
0
].
data
(),
bvh
.
num_vertices
,
3
);
}
static
Triangle
tri_indices
(
const
BVHModelBase
&
bvh
,
int
i
)
{
if
(
i
>=
bvh
.
num_tris
)
throw
std
::
out_of_range
(
"index is out of range"
);
...
...
@@ -461,8 +469,12 @@ void exposeCollisionGeometries ()
class_
<
BVHModelBase
,
bases
<
CollisionGeometry
>
,
BVHModelPtr_t
,
noncopyable
>
(
"BVHModelBase"
,
no_init
)
.
def
(
"vertice"
,
&
BVHModelBaseWrapper
::
vertice
,
bp
::
args
(
"self"
,
"index"
),
"Retrieve the vertex given by its index."
,
bp
::
return_internal_reference
<>
())
.
def
(
"vertices"
,
&
BVHModelBaseWrapper
::
vertices
,
bp
::
args
(
"self"
,
"index"
),
"Retrieve the vertex given by its index."
)
bp
::
args
(
"self"
),
"Retrieve the vertex given by its index."
,
bp
::
with_custodian_and_ward_postcall
<
0
,
1
>
())
.
def
(
"tri_indices"
,
&
BVHModelBaseWrapper
::
tri_indices
,
bp
::
args
(
"self"
,
"index"
),
"Retrieve the triangle given by its index."
)
.
def_readonly
(
"num_vertices"
,
&
BVHModelBase
::
num_vertices
)
...
...
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