Skip to content

Commit

Permalink
all: remove warnings
Browse files Browse the repository at this point in the history
Some types have changed to correspond to their real use types
  • Loading branch information
jcarpent committed Nov 4, 2021
1 parent 71a5c39 commit 272bad0
Show file tree
Hide file tree
Showing 21 changed files with 240 additions and 239 deletions.
8 changes: 4 additions & 4 deletions include/hpp/fcl/BV/BV_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ struct HPP_FCL_DLLAPI BVNodeBase

/// @brief The start id the primitive belonging to the current node. The index is referred to the primitive_indices in BVHModel and from that
/// we can obtain the primitive's index in original data indirectly.
int first_primitive;
unsigned int first_primitive;

/// @brief The number of primitives belonging to the current node
int num_primitives;
unsigned int num_primitives;

/// @brief Default constructor
BVNodeBase()
: first_child(0)
, first_primitive(-1)
, num_primitives(-1)
, first_primitive(std::numeric_limits<unsigned int>::max()) // value we should help to raise an issue
, num_primitives(0)
{}

/// @brief Equality operator
Expand Down
11 changes: 6 additions & 5 deletions include/hpp/fcl/BVH/BVH_front.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ namespace fcl
struct HPP_FCL_DLLAPI BVHFrontNode
{
/// @brief The nodes to start in the future, i.e. the wave front of the traversal tree.
int left, right;
unsigned int left, right;

/// @brief The front node is not valid when collision is detected on the front node.
bool valid;

BVHFrontNode(int left_, int right_) : left(left_),
right(right_),
valid(true)
BVHFrontNode(unsigned int left_, unsigned int right_)
: left(left_)
, right(right_)
, valid(true)
{
}
};
Expand All @@ -71,7 +72,7 @@ struct HPP_FCL_DLLAPI BVHFrontNode
typedef std::list<BVHFrontNode> BVHFrontList;

/// @brief Add new front node into the front list
inline void updateFrontList(BVHFrontList* front_list, int b1, int b2)
inline void updateFrontList(BVHFrontList* front_list, unsigned int b1, unsigned int b2)
{
if(front_list) front_list->push_back(BVHFrontNode(b1, b2));
}
Expand Down
44 changes: 22 additions & 22 deletions include/hpp/fcl/BVH/BVH_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ class HPP_FCL_DLLAPI BVHModelBase
Vec3f* prev_vertices;

/// @brief Number of triangles
int num_tris;
unsigned int num_tris;

/// @brief Number of points
int num_vertices;
unsigned int num_vertices;

/// @brief The state of BVH building process
BVHBuildState build_state;
Expand Down Expand Up @@ -126,7 +126,7 @@ class HPP_FCL_DLLAPI BVHModelBase
void computeLocalAABB();

/// @brief Begin a new BVH model
int beginModel(int num_tris = 0, int num_vertices = 0);
int beginModel(unsigned int num_tris = 0, unsigned int num_vertices = 0);

/// @brief Add one point in the new BVH model
int addVertex(const Vec3f& p);
Expand Down Expand Up @@ -209,7 +209,7 @@ class HPP_FCL_DLLAPI BVHModelBase
{
FCL_REAL vol = 0;
Vec3f com(0,0,0);
for(int i = 0; i < num_tris; ++i)
for(unsigned int i = 0; i < num_tris; ++i)
{
const Triangle& tri = tri_indices[i];
FCL_REAL d_six_vol = (vertices[tri[0]].cross(vertices[tri[1]])).dot(vertices[tri[2]]);
Expand All @@ -223,7 +223,7 @@ class HPP_FCL_DLLAPI BVHModelBase
FCL_REAL computeVolume() const
{
FCL_REAL vol = 0;
for(int i = 0; i < num_tris; ++i)
for(unsigned int i = 0; i < num_tris; ++i)
{
const Triangle& tri = tri_indices[i];
FCL_REAL d_six_vol = (vertices[tri[0]].cross(vertices[tri[1]])).dot(vertices[tri[2]]);
Expand All @@ -242,7 +242,7 @@ class HPP_FCL_DLLAPI BVHModelBase
1/120.0, 1/60.0, 1/120.0,
1/120.0, 1/120.0, 1/60.0;

for(int i = 0; i < num_tris; ++i)
for(unsigned int i = 0; i < num_tris; ++i)
{
const Triangle& tri = tri_indices[i];
const Vec3f& v1 = vertices[tri[0]];
Expand All @@ -265,9 +265,9 @@ class HPP_FCL_DLLAPI BVHModelBase
/// @brief Refit the bounding volume hierarchy
virtual int refitTree(bool bottomup) = 0;

int num_tris_allocated;
int num_vertices_allocated;
int num_vertex_updated; /// for ccd vertex update
unsigned int num_tris_allocated;
unsigned int num_vertices_allocated;
unsigned int num_vertex_updated; /// for ccd vertex update
};

/// @brief A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as a degraded version of mesh)
Expand Down Expand Up @@ -307,7 +307,7 @@ class HPP_FCL_DLLAPI BVHModel
if(!res)
return false;

int other_num_primitives = 0;
unsigned int other_num_primitives = 0;
if(other.primitive_indices)
{

Expand All @@ -324,7 +324,7 @@ class HPP_FCL_DLLAPI BVHModel
}
}

// int num_primitives = 0;
// unsigned int num_primitives = 0;
// if(primitive_indices)
// {
//
Expand Down Expand Up @@ -353,7 +353,7 @@ class HPP_FCL_DLLAPI BVHModel
if(num_bvs != other.num_bvs)
return false;

for(int k = 0; k < num_bvs; ++k)
for(unsigned int k = 0; k < num_bvs; ++k)
{
if(bvs[k] != other.bvs[k])
return false;
Expand All @@ -371,21 +371,21 @@ class HPP_FCL_DLLAPI BVHModel
/// @brief We provide getBV() and getNumBVs() because BVH may be compressed (in future), so we must provide some flexibility here

/// @brief Access the bv giving the its index
const BVNode<BV>& getBV(int id) const
const BVNode<BV>& getBV(unsigned int i) const
{
assert (id < num_bvs);
return bvs[id];
assert (i < num_bvs);
return bvs[i];
}

/// @brief Access the bv giving the its index
BVNode<BV>& getBV(int id)
BVNode<BV>& getBV(unsigned int i)
{
assert (id < num_bvs);
return bvs[id];
assert (i < num_bvs);
return bvs[i];
}

/// @brief Get the number of bv in the BVH
int getNumBVs() const
unsigned int getNumBVs() const
{
return num_bvs;
}
Expand All @@ -408,14 +408,14 @@ class HPP_FCL_DLLAPI BVHModel
void deleteBVs();
bool allocateBVs();

int num_bvs_allocated;
unsigned int num_bvs_allocated;
unsigned int* primitive_indices;

/// @brief Bounding volume hierarchy
BVNode<BV>* bvs;

/// @brief Number of BV nodes in bounding volume hierarchy
int num_bvs;
unsigned int num_bvs;

/// @brief Build the bounding volume hierarchy
int buildTree();
Expand All @@ -430,7 +430,7 @@ class HPP_FCL_DLLAPI BVHModel
int refitTree_bottomup();

/// @brief Recursive kernel for hierarchy construction
int recursiveBuildTree(int bv_id, int first_primitive, unsigned int num_primitives);
int recursiveBuildTree(int bv_id, unsigned int first_primitive, unsigned int num_primitives);

/// @brief Recursive kernel for bottomup refitting
int recursiveRefitTree_bottomup(int bv_id);
Expand Down
24 changes: 12 additions & 12 deletions include/hpp/fcl/internal/traversal_node_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,25 @@ class TraversalNodeBase
virtual void postprocess() {}

/// @brief Whether b is a leaf node in the first BVH tree
virtual bool isFirstNodeLeaf(int /*b*/) const { return true; }
virtual bool isFirstNodeLeaf(unsigned int /*b*/) const { return true; }

/// @brief Whether b is a leaf node in the second BVH tree
virtual bool isSecondNodeLeaf(int /*b*/) const { return true; }
virtual bool isSecondNodeLeaf(unsigned int /*b*/) const { return true; }

/// @brief Traverse the subtree of the node in the first tree first
virtual bool firstOverSecond(int /*b1*/, int /*b2*/) const { return true; }
virtual bool firstOverSecond(unsigned int /*b1*/, unsigned int /*b2*/) const { return true; }

/// @brief Get the left child of the node b in the first tree
virtual int getFirstLeftChild(int b) const { return b; }
virtual int getFirstLeftChild(unsigned int b) const { return (int)b; }

/// @brief Get the right child of the node b in the first tree
virtual int getFirstRightChild(int b) const { return b; }
virtual int getFirstRightChild(unsigned int b) const { return (int)b; }

/// @brief Get the left child of the node b in the second tree
virtual int getSecondLeftChild(int b) const { return b; }
virtual int getSecondLeftChild(unsigned int b) const { return (int)b; }

/// @brief Get the right child of the node b in the second tree
virtual int getSecondRightChild(int b) const { return b; }
virtual int getSecondRightChild(unsigned int b) const { return (int)b; }

/// @brief Whether store some statistics information during traversal
void enableStatistics(bool enable) { enable_statistics = enable; }
Expand Down Expand Up @@ -110,16 +110,16 @@ class CollisionTraversalNodeBase : public TraversalNodeBase
virtual ~CollisionTraversalNodeBase() {}

/// @brief BV test between b1 and b2
virtual bool BVDisjoints(int b1, int b2) const = 0;
virtual bool BVDisjoints(unsigned int b1, unsigned int b2) const = 0;

/// BV test between b1 and b2
/// @param b1, b2 Bounding volumes to test,
/// @retval sqrDistLowerBound square of a lower bound of the minimal
/// distance between bounding volumes.
virtual bool BVDisjoints(int b1, int b2, FCL_REAL& sqrDistLowerBound) const = 0;
virtual bool BVDisjoints(unsigned int b1, unsigned int b2, FCL_REAL& sqrDistLowerBound) const = 0;

/// @brief Leaf test between node b1 and b2, if they are both leafs
virtual void leafCollides(int /*b1*/, int /*b2*/, FCL_REAL& /*sqrDistLowerBound*/) const = 0;
virtual void leafCollides(unsigned int /*b1*/, unsigned int /*b2*/, FCL_REAL& /*sqrDistLowerBound*/) const = 0;

/// @brief Check whether the traversal can stop
bool canStop() const { return this->request.isSatisfied(*(this->result)); }
Expand Down Expand Up @@ -149,13 +149,13 @@ class DistanceTraversalNodeBase : public TraversalNodeBase
/// @brief BV test between b1 and b2
/// @return a lower bound of the distance between the two BV.
/// @note except for OBB, this method returns the distance.
virtual FCL_REAL BVDistanceLowerBound(int /*b1*/, int /*b2*/) const
virtual FCL_REAL BVDistanceLowerBound(unsigned int /*b1*/, unsigned int /*b2*/) const
{
return (std::numeric_limits<FCL_REAL>::max)();
}

/// @brief Leaf test between node b1 and b2, if they are both leafs
virtual void leafComputeDistance(int b1, int b2) const = 0;
virtual void leafComputeDistance(unsigned int b1, unsigned int b2) const = 0;

/// @brief Check whether the traversal can stop
virtual bool canStop(FCL_REAL /*c*/) const
Expand Down
Loading

0 comments on commit 272bad0

Please sign in to comment.