18 template <
typename scalar_t>
20 const scalar_t* transformation_ptr, scalar_t* points_ptr) {
21 scalar_t x[4] = {transformation_ptr[0] * points_ptr[0] +
22 transformation_ptr[1] * points_ptr[1] +
23 transformation_ptr[2] * points_ptr[2] +
24 transformation_ptr[3],
25 transformation_ptr[4] * points_ptr[0] +
26 transformation_ptr[5] * points_ptr[1] +
27 transformation_ptr[6] * points_ptr[2] +
28 transformation_ptr[7],
29 transformation_ptr[8] * points_ptr[0] +
30 transformation_ptr[9] * points_ptr[1] +
31 transformation_ptr[10] * points_ptr[2] +
32 transformation_ptr[11],
33 transformation_ptr[12] * points_ptr[0] +
34 transformation_ptr[13] * points_ptr[1] +
35 transformation_ptr[14] * points_ptr[2] +
36 transformation_ptr[15]};
38 points_ptr[0] = x[0] / x[3];
39 points_ptr[1] = x[1] / x[3];
40 points_ptr[2] = x[2] / x[3];
43 template <
typename scalar_t>
45 const scalar_t* transformation_ptr, scalar_t* normals_ptr) {
46 scalar_t x[3] = {transformation_ptr[0] * normals_ptr[0] +
47 transformation_ptr[1] * normals_ptr[1] +
48 transformation_ptr[2] * normals_ptr[2],
49 transformation_ptr[4] * normals_ptr[0] +
50 transformation_ptr[5] * normals_ptr[1] +
51 transformation_ptr[6] * normals_ptr[2],
52 transformation_ptr[8] * normals_ptr[0] +
53 transformation_ptr[9] * normals_ptr[1] +
54 transformation_ptr[10] * normals_ptr[2]};
56 normals_ptr[0] = x[0];
57 normals_ptr[1] = x[1];
58 normals_ptr[2] = x[2];
61 template <
typename scalar_t>
63 const scalar_t* R_ptr, scalar_t* points_ptr,
const scalar_t* center) {
64 scalar_t x[3] = {points_ptr[0] - center[0], points_ptr[1] - center[1],
65 points_ptr[2] - center[2]};
68 R_ptr[0] * x[0] + R_ptr[1] * x[1] + R_ptr[2] * x[2] + center[0];
70 R_ptr[3] * x[0] + R_ptr[4] * x[1] + R_ptr[5] * x[2] + center[1];
72 R_ptr[6] * x[0] + R_ptr[7] * x[1] + R_ptr[8] * x[2] + center[2];
75 template <
typename scalar_t>
77 const scalar_t* R_ptr, scalar_t* normals_ptr) {
78 scalar_t x[3] = {R_ptr[0] * normals_ptr[0] + R_ptr[1] * normals_ptr[1] +
79 R_ptr[2] * normals_ptr[2],
80 R_ptr[3] * normals_ptr[0] + R_ptr[4] * normals_ptr[1] +
81 R_ptr[5] * normals_ptr[2],
82 R_ptr[6] * normals_ptr[0] + R_ptr[7] * normals_ptr[1] +
83 R_ptr[8] * normals_ptr[2]};
85 normals_ptr[0] = x[0];
86 normals_ptr[1] = x[1];
87 normals_ptr[2] = x[2];
91 void TransformPointsCUDA
97 scalar_t* points_ptr = points.GetDataPtr<scalar_t>();
98 const scalar_t* transformation_ptr =
99 transformation.GetDataPtr<scalar_t>();
101 core::ParallelFor(transformation.GetDevice(), points.GetLength(),
102 [=] OPEN3D_DEVICE(int64_t workload_idx) {
103 TransformPointsKernel(
105 points_ptr + 3 * workload_idx);
111 void TransformNormalsCUDA
117 scalar_t* normals_ptr = normals.GetDataPtr<scalar_t>();
118 const scalar_t* transformation_ptr =
119 transformation.GetDataPtr<scalar_t>();
121 core::ParallelFor(transformation.GetDevice(), normals.GetLength(),
122 [=] OPEN3D_DEVICE(int64_t workload_idx) {
123 TransformNormalsKernel(
125 normals_ptr + 3 * workload_idx);
131 void RotatePointsCUDA
139 scalar_t* points_ptr = points.GetDataPtr<scalar_t>();
140 const scalar_t* R_ptr = R.GetDataPtr<scalar_t>();
141 const scalar_t* center_ptr = center.GetDataPtr<scalar_t>();
143 core::ParallelFor(R.GetDevice(), points.GetLength(),
144 [=] OPEN3D_DEVICE(int64_t workload_idx) {
145 RotatePointsKernel(R_ptr,
146 points_ptr + 3 * workload_idx,
153 void RotateNormalsCUDA
159 scalar_t* normals_ptr = normals.GetDataPtr<scalar_t>();
160 const scalar_t* R_ptr = R.GetDataPtr<scalar_t>();
162 core::ParallelFor(R.GetDevice(), normals.GetLength(),
163 [=] OPEN3D_DEVICE(int64_t workload_idx) {
165 R_ptr, normals_ptr + 3 * workload_idx);
#define OPEN3D_HOST_DEVICE
Definition: CUDAUtils.h:44
#define OPEN3D_FORCE_INLINE
Definition: CUDAUtils.h:43
#define DISPATCH_FLOAT_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: Dispatch.h:77
Definition: PinholeCameraIntrinsic.cpp:16