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
a02d95ec
Unverified
Commit
a02d95ec
authored
5 years ago
by
Joseph Mirabel
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #123 from jcarpent/devel
Expose additional quantities in Python
parents
a17be7ee
830c2b46
No related branches found
Branches containing commit
Tags
v0.3.2c
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/hpp/fcl/BV/AABB.h
+3
-3
3 additions, 3 deletions
include/hpp/fcl/BV/AABB.h
python/collision-geometries.cc
+93
-4
93 additions, 4 deletions
python/collision-geometries.cc
with
96 additions
and
7 deletions
include/hpp/fcl/BV/AABB.h
+
3
−
3
View file @
a02d95ec
...
...
@@ -230,16 +230,16 @@ static inline AABB translate(const AABB& aabb, const Vec3f& t)
return
res
;
}
static
inline
AABB
rotate
(
const
AABB
&
aabb
,
const
Matrix3f
&
t
)
static
inline
AABB
rotate
(
const
AABB
&
aabb
,
const
Matrix3f
&
R
)
{
AABB
res
(
t
*
aabb
.
min_
);
AABB
res
(
R
*
aabb
.
min_
);
Vec3f
corner
(
aabb
.
min_
);
const
std
::
size_t
bit
[
3
]
=
{
1
,
2
,
4
};
for
(
std
::
size_t
ic
=
1
;
ic
<
8
;
++
ic
)
{
// ic = 0 corresponds to aabb.min_. Skip it.
for
(
std
::
size_t
i
=
0
;
i
<
3
;
++
i
)
{
corner
[
i
]
=
(
ic
&&
bit
[
i
])
?
aabb
.
max_
[
i
]
:
aabb
.
min_
[
i
];
}
res
+=
t
*
corner
;
res
+=
R
*
corner
;
}
return
res
;
}
...
...
This diff is collapsed.
Click to expand it.
python/collision-geometries.cc
+
93
−
4
View file @
a02d95ec
//
// Software License Agreement (BSD License)
//
// Copyright (c) 2019 CNRS-LAAS INRIA
// Copyright (c) 2019
-2020
CNRS-LAAS INRIA
// Author: Joseph Mirabel
// All rights reserved.
//
...
...
@@ -183,6 +183,13 @@ void exposeShapes ()
}
boost
::
python
::
tuple
AABB_distance_proxy
(
const
AABB
&
self
,
const
AABB
&
other
)
{
Vec3f
P
,
Q
;
FCL_REAL
distance
=
self
.
distance
(
other
,
&
P
,
&
Q
);
return
boost
::
python
::
tuple
((
distance
,
P
,
Q
));
}
void
exposeCollisionGeometries
()
{
...
...
@@ -220,6 +227,76 @@ void exposeCollisionGeometries ()
.
value
(
"GEOM_OCTREE"
,
GEOM_OCTREE
)
;
}
namespace
bp
=
boost
::
python
;
class_
<
AABB
>
(
"AABB"
,
"A class describing the AABB collision structure, which is a box in 3D space determined by two diagonal points"
,
no_init
)
.
def
(
init
<>
(
"Default constructor"
))
.
def
(
init
<
Vec3f
>
(
bp
::
arg
(
"v"
),
"Creating an AABB at position v with zero size."
))
.
def
(
init
<
Vec3f
,
Vec3f
>
(
bp
::
args
(
"a"
,
"b"
),
"Creating an AABB with two endpoints a and b."
))
.
def
(
init
<
AABB
,
Vec3f
>
(
bp
::
args
(
"core"
,
"delta"
),
"Creating an AABB centered as core and is of half-dimension delta."
))
.
def
(
init
<
Vec3f
,
Vec3f
,
Vec3f
>
(
bp
::
args
(
"a"
,
"b"
,
"c"
),
"Creating an AABB contains three points."
))
.
def
(
"contain"
,
(
bool
(
AABB
::*
)(
const
Vec3f
&
)
const
)
&
AABB
::
contain
,
bp
::
args
(
"self"
,
"p"
),
"Check whether the AABB contains a point p."
)
.
def
(
"contain"
,
(
bool
(
AABB
::*
)(
const
AABB
&
)
const
)
&
AABB
::
contain
,
bp
::
args
(
"self"
,
"other"
),
"Check whether the AABB contains another AABB."
)
.
def
(
"overlap"
,
(
bool
(
AABB
::*
)(
const
AABB
&
)
const
)
&
AABB
::
overlap
,
bp
::
args
(
"self"
,
"other"
),
"Check whether two AABB are overlap."
)
.
def
(
"overlap"
,
(
bool
(
AABB
::*
)(
const
AABB
&
,
AABB
&
)
const
)
&
AABB
::
overlap
,
bp
::
args
(
"self"
,
"other"
,
"overlapping_part"
),
"Check whether two AABB are overlaping and return the overloaping part if true."
)
.
def
(
"distance"
,
(
FCL_REAL
(
AABB
::*
)(
const
AABB
&
)
const
)
&
AABB
::
distance
,
bp
::
args
(
"self"
,
"other"
),
"Distance between two AABBs."
)
// .def("distance",
// AABB_distance_proxy,
// bp::args("self","other"),
// "Distance between two AABBs.")
.
def
(
bp
::
self
+
bp
::
self
)
.
def
(
bp
::
self
+=
bp
::
self
)
.
def
(
bp
::
self
+=
Vec3f
())
.
def
(
"size"
,
&
AABB
::
volume
,
bp
::
arg
(
"self"
),
"Size of the AABB."
)
.
def
(
"center"
,
&
AABB
::
center
,
bp
::
arg
(
"self"
),
"Center of the AABB."
)
.
def
(
"width"
,
&
AABB
::
width
,
bp
::
arg
(
"self"
),
"Width of the AABB."
)
.
def
(
"height"
,
&
AABB
::
height
,
bp
::
arg
(
"self"
),
"Height of the AABB."
)
.
def
(
"depth"
,
&
AABB
::
depth
,
bp
::
arg
(
"self"
),
"Depth of the AABB."
)
.
def
(
"volume"
,
&
AABB
::
volume
,
bp
::
arg
(
"self"
),
"Volume of the AABB."
)
.
def
(
"expand"
,
(
AABB
&
(
AABB
::*
)(
const
AABB
&
,
FCL_REAL
))
&
AABB
::
expand
,
bp
::
args
(
"self"
,
"core"
,
"ratio"
),
"Expand the AABB by increase the thickness of the plate by a ratio."
,
bp
::
return_internal_reference
<>
())
.
def
(
"expand"
,
(
AABB
&
(
AABB
::*
)(
const
Vec3f
&
))
&
AABB
::
expand
,
bp
::
args
(
"self"
,
"delta"
),
"Expand the half size of the AABB by delta, and keep the center unchanged."
,
bp
::
return_internal_reference
<>
());
def
(
"translate"
,
(
AABB
(
*
)(
const
AABB
&
,
const
Vec3f
&
))
&
translate
,
bp
::
args
(
"aabb"
,
"t"
),
"Translate the center of AABB by t"
);
def
(
"rotate"
,
(
AABB
(
*
)(
const
AABB
&
,
const
Matrix3f
&
))
&
rotate
,
bp
::
args
(
"aabb"
,
"R"
),
"Rotate the AABB object by R"
);
if
(
!
eigenpy
::
register_symbolic_link_to_registered_type
<
CollisionGeometry
>
())
{
...
...
@@ -235,7 +312,17 @@ void exposeCollisionGeometries ()
.
def
(
"computeVolume"
,
&
CollisionGeometry
::
computeVolume
)
.
def
(
"computeMomentofInertiaRelatedToCOM"
,
&
CollisionGeometry
::
computeMomentofInertiaRelatedToCOM
)
.
def_readwrite
(
"aabb_radius"
,
&
CollisionGeometry
::
aabb_radius
,
"AABB radius"
)
.
def_readwrite
(
"aabb_radius"
,
&
CollisionGeometry
::
aabb_radius
,
"AABB radius."
)
.
def_readwrite
(
"aabb_center"
,
&
CollisionGeometry
::
aabb_center
,
"AABB center in local coordinate."
)
.
def_readwrite
(
"aabb_local"
,
&
CollisionGeometry
::
aabb_local
,
"AABB in local coordinate, used for tight AABB when only translation transform."
)
.
def
(
"isOccupied"
,
&
CollisionGeometry
::
isOccupied
,
bp
::
arg
(
"self"
),
"Whether the object is completely occupied."
)
.
def
(
"isFree"
,
&
CollisionGeometry
::
isFree
,
bp
::
arg
(
"self"
),
"Whether the object is completely free."
)
.
def
(
"isUncertain"
,
&
CollisionGeometry
::
isUncertain
,
bp
::
arg
(
"self"
),
"Whether the object has some uncertainty."
)
.
def_readwrite
(
"cost_density"
,
&
CollisionGeometry
::
cost_density
,
"Collision cost for unit volume."
)
.
def_readwrite
(
"threshold_occupied"
,
&
CollisionGeometry
::
threshold_occupied
,
"Threshold for occupied ( >= is occupied)."
)
.
def_readwrite
(
"threshold_free"
,
&
CollisionGeometry
::
threshold_free
,
"Threshold for free (<= is free)."
)
;
}
...
...
@@ -243,8 +330,10 @@ void exposeCollisionGeometries ()
class_
<
BVHModelBase
,
bases
<
CollisionGeometry
>
,
BVHModelPtr_t
,
noncopyable
>
(
"BVHModelBase"
,
no_init
)
.
def
(
"vertices"
,
&
BVHModelBaseWrapper
::
vertices
)
.
def
(
"tri_indices"
,
&
BVHModelBaseWrapper
::
tri_indices
)
.
def
(
"vertices"
,
&
BVHModelBaseWrapper
::
vertices
,
bp
::
args
(
"self"
,
"index"
),
"Retrieve the vertex given by its index."
)
.
def
(
"tri_indices"
,
&
BVHModelBaseWrapper
::
tri_indices
,
bp
::
args
(
"self"
,
"index"
),
"Retrieve the triangle given by its index."
)
.
def_readonly
(
"num_vertices"
,
&
BVHModelBase
::
num_vertices
)
.
def_readonly
(
"num_tris"
,
&
BVHModelBase
::
num_tris
)
...
...
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