Skip to content

Commit

Permalink
Patches for VS 2012
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyanli committed Aug 26, 2013
1 parent 1513345 commit 73aad07
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
28 changes: 14 additions & 14 deletions gpu/surface/src/cuda/convex_hull.cu
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ namespace pcl
template<bool use_max>
struct IndOp
{
__device__ __forceinline__ tuple<float, int> operator()(const tuple<float, int>& e1, const tuple<float, int>& e2) const
__device__ __forceinline__ thrust::tuple<float, int> operator()(const thrust::tuple<float, int>& e1, const thrust::tuple<float, int>& e2) const
{
tuple<float, int> res;
thrust::tuple<float, int> res;

if (use_max)
res.get<0>() = fmax(e1.get<0>(), e2.get<0>());
Expand All @@ -89,10 +89,10 @@ namespace pcl
struct X
{
__device__ __forceinline__
tuple<float, int>
operator()(const tuple<PointType, int>& in) const
thrust::tuple<float, int>
operator()(const thrust::tuple<PointType, int>& in) const
{
return tuple<float, int>(in.get<0>().x, in.get<1>());
return thrust::tuple<float, int>(in.get<0>().x, in.get<1>());
}
};

Expand All @@ -112,12 +112,12 @@ namespace pcl
LineDist(const PointType& p1, const PointType& p2) : x1(tr(p1)), x2(tr(p2)) {}

__device__ __forceinline__
tuple<float, int> operator()(const tuple<PointType, int>& in) const
thrust::tuple<float, int> operator()(const thrust::tuple<PointType, int>& in) const
{
float3 x0 = tr(in.get<0>());

float dist = norm(cross(x0 - x1, x0 - x2))/norm(x1 - x2);
return tuple<float, int>(dist, in.get<1>());
return thrust::tuple<float, int>(dist, in.get<1>());
}
};

Expand All @@ -131,11 +131,11 @@ namespace pcl
}

__device__ __forceinline__
tuple<float, int> operator()(const tuple<PointType, int>& in) const
thrust::tuple<float, int> operator()(const thrust::tuple<PointType, int>& in) const
{
float3 x0 = tr(in.get<0>());
float dist = fabs(dot(n, x0 - x1));
return tuple<float, int>(dist, in.get<1>());
return thrust::tuple<float, int>(dist, in.get<1>());
}
};

Expand All @@ -145,9 +145,9 @@ namespace pcl
counting_iterator<int> cbeg(0);
counting_iterator<int> cend = cbeg + thrust::distance(beg, end);

tuple<float, int> t = transform_reduce(
make_zip_iterator(make_tuple(beg, cbeg)),
make_zip_iterator(make_tuple(end, cend)),
thrust::tuple<float, int> t = transform_reduce(
make_zip_iterator(thrust::make_tuple(beg, cbeg)),
make_zip_iterator(thrust::make_tuple(end, cend)),
unop, init, binary);

return t.get<1>();
Expand All @@ -156,14 +156,14 @@ namespace pcl
template<typename It, typename Unary>
int transform_reduce_min_index(It beg, It end, Unary unop)
{
tuple<float, int> min_tuple(std::numeric_limits<float>::max(), 0);
thrust::tuple<float, int> min_tuple(std::numeric_limits<float>::max(), 0);
return transform_reduce_index(beg, end, unop, min_tuple, IndOp<false>());
}

template<typename It, typename Unary>
int transform_reduce_max_index(It beg, It end, Unary unop)
{
tuple<float, int> max_tuple(std::numeric_limits<float>::min(), 0);
thrust::tuple<float, int> max_tuple(std::numeric_limits<float>::min(), 0);
return transform_reduce_index(beg, end, unop, max_tuple, IndOp<true>());
}
}
Expand Down
4 changes: 4 additions & 0 deletions recognition/include/pcl/recognition/crh_alignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ namespace pcl

std::vector < std::pair<float, int> > scored_peaks (nr_bins_after_padding);
for (int i = 0; i < nr_bins_after_padding; i++)
#if defined(_WIN32) && _MSC_VER >= 1600
scored_peaks[i] = std::make_pair (invAB[i].r, i);
#else
scored_peaks[i] = std::make_pair<float, int> (invAB[i].r, i);
#endif

std::sort (scored_peaks.begin (), scored_peaks.end (), peaks_ordering ());

Expand Down

0 comments on commit 73aad07

Please sign in to comment.