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
53d3daba
Commit
53d3daba
authored
May 04, 2020
by
Joseph Mirabel
Browse files
Fix initialization of Convex mesh.
parent
e469907c
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/hpp/fcl/shape/convex.h
View file @
53d3daba
...
...
@@ -53,6 +53,9 @@ template <typename PolygonT>
class
Convex
:
public
ConvexBase
{
public:
/// @brief Construct an uninitialized convex object
Convex
()
:
ConvexBase
(),
polygons
(
NULL
),
num_polygons
(
0
)
{}
/// @brief Constructing a convex, providing normal and offset of each polytype surface, and the points and shape topology information
/// \param ownStorage whether this class owns the pointers of points and
/// polygons. If owned, they are deleted upon destruction.
...
...
include/hpp/fcl/shape/details/convex.hxx
View file @
53d3daba
...
...
@@ -48,11 +48,11 @@ namespace fcl
template
<
typename
PolygonT
>
Convex
<
PolygonT
>::
Convex
(
bool
own_storage
,
Vec3f
*
points_
,
int
num_points_
,
PolygonT
*
polygons_
,
int
num_polygons_
)
:
ConvexBase
(
own_storage
,
points_
,
num_points_
),
PolygonT
*
polygons_
,
int
num_polygons_
)
:
ConvexBase
(),
polygons
(
polygons_
),
num_polygons
(
num_polygons_
)
{
initialize
(
own_storage
,
points_
,
num_points_
);
fillNeighbors
();
}
...
...
include/hpp/fcl/shape/geometric_shapes.h
View file @
53d3daba
...
...
@@ -312,10 +312,16 @@ public:
Vec3f
center
;
protected:
/// @brief Constructing a convex, providing normal and offset of each polytype surface, and the points and shape topology information
/// @brief Construct an uninitialized convex object
/// Initialization is done with ConvexBase::initialize.
ConvexBase
()
:
ShapeBase
(),
points
(
NULL
),
num_points
(
0
),
neighbors
(
NULL
),
nneighbors_
(
NULL
),
own_storage_
(
false
)
{}
/// @brief Initialize the points of the convex shape
/// This also initializes the ConvexBase::center.
/// \param points_ list of 3D points
/// \param num_points_ number of 3D points
ConvexBas
e
(
bool
ownStorage
,
Vec3f
*
points_
,
int
num_points_
);
void
initializ
e
(
bool
ownStorage
,
Vec3f
*
points_
,
int
num_points_
);
/// @brief Copy constructor
/// Only the list of neighbors is copied.
...
...
src/shape/geometric_shapes.cpp
View file @
53d3daba
...
...
@@ -44,12 +44,11 @@ namespace hpp
namespace
fcl
{
ConvexBase
::
ConvexBase
(
bool
own_storage
,
Vec3f
*
points_
,
int
num_points_
)
:
ShapeBase
(),
points
(
points_
),
num_points
(
num_points_
),
own_storage_
(
own_storage
)
void
ConvexBase
::
initialize
(
bool
own_storage
,
Vec3f
*
points_
,
int
num_points_
)
{
points
=
points_
;
num_points
=
num_points_
;
own_storage_
=
own_storage
;
computeCenter
();
}
...
...
@@ -60,7 +59,11 @@ ConvexBase::ConvexBase(const ConvexBase& other) :
center
(
other
.
center
),
own_storage_
(
other
.
own_storage_
)
{
if
(
neighbors
)
delete
[]
neighbors
;
if
(
nneighbors_
)
delete
[]
nneighbors_
;
if
(
own_storage_
)
{
if
(
own_storage_
&&
points
)
delete
[]
points
;
points
=
new
Vec3f
[
num_points
];
memcpy
(
points
,
other
.
points
,
sizeof
(
Vec3f
)
*
num_points
);
}
...
...
@@ -76,9 +79,9 @@ ConvexBase::ConvexBase(const ConvexBase& other) :
ConvexBase
::~
ConvexBase
()
{
delete
[]
neighbors
;
delete
[]
nneighbors_
;
if
(
own_storage_
)
delete
[]
points
;
if
(
neighbors
)
delete
[]
neighbors
;
if
(
nneighbors_
)
delete
[]
nneighbors_
;
if
(
own_storage_
&&
points
)
delete
[]
points
;
}
void
ConvexBase
::
computeCenter
()
...
...
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