Point Cloud Library (PCL) 1.13.1
Loading...
Searching...
No Matches
device.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2011, Willow Garage, Inc.
6 *
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials provided
18 * with the distribution.
19 * * Neither the name of Willow Garage, Inc. nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 *
36 */
37
38#pragma once
39
40#include "internal.h"
41#include <pcl/gpu/utils/device/vector_math.hpp>
42
43namespace pcl
44{
45 namespace device
46 {
47 /** \brief Computers plane from 3 points (v, v1, v2), ensures that point P lies positive subspace.
48 * \param[in] v 3D point volume tsdf volume container
49 * \param[in] v1 3D point volume tsdf volume container
50 * \param[in] v2 3D point volume tsdf volume container
51 * \param[in] p point for sign check of plane coefs (should lie in positive subspace)
52 * \return a,b,c,d coefs vector
53 */
54 __device__ __host__ __forceinline__
55 float4 compute_plane(const float3& v, const float3& v1, const float3& v2, const float3& p)
56 {
57 float3 n = cross(v1 - v, v2 - v);
58
59 float d = -dot(n, v);
60
61 if (dot(n, p) + d < 0)
62 {
63 n*=-1.f;
64 d*=-1.f;
65 }
66 return make_float4(n.x, n.y, n.z, d);
67 }
68
69 __device__ __host__ __forceinline__ float3 tr(const PointType& p) { return make_float3(p.x, p.y, p.z); }
70
72 {
73 __device__ __forceinline__
74 bool operator()(const std::uint64_t& e1, const int& e2) const
75 {
76 int i1 = (int)(e1 >> 32);
77 return i1 < e2;
78 }
79 };
80
81 __device__ __host__ __forceinline__ float compue_inv_normal_norm(const float4& p) { return 1.f/sqrt(p.x*p.x + p.y*p.y + p.z*p.z); }
82
83
84 __device__ __host__ __forceinline__ float4& operator*=(float4& p, float v) { p.x*=v; p.y*=v; p.z*=v; p.w*=v; return p; }
85
86 }
87};
__device__ __forceinline__ float3 tr(const T &v)
__device__ __host__ __forceinline__ float compue_inv_normal_norm(const float4 &p)
Definition device.h:81
float4 PointType
Definition internal.hpp:58
__device__ __forceinline__ float dot(const float3 &v1, const float3 &v2)
Definition utils.hpp:59
__device__ __host__ __forceinline__ float4 compute_plane(const float3 &v, const float3 &v1, const float3 &v2, const float3 &p)
Computers plane from 3 points (v, v1, v2), ensures that point P lies positive subspace.
Definition device.h:55
__device__ __forceinline__ float3 & operator*=(float3 &vec, const float &v)
Definition utils.hpp:77
__device__ __host__ __forceinline__ float3 cross(const float3 &v1, const float3 &v2)
Definition utils.hpp:107
__device__ __forceinline__ bool operator()(const std::uint64_t &e1, const int &e2) const
Definition device.h:74