37 template <
typename scalar_t>
39 const scalar_t* transformation_ptr, scalar_t* points_ptr) {
40 scalar_t x[4] = {transformation_ptr[0] * points_ptr[0] +
41 transformation_ptr[1] * points_ptr[1] +
42 transformation_ptr[2] * points_ptr[2] +
43 transformation_ptr[3],
44 transformation_ptr[4] * points_ptr[0] +
45 transformation_ptr[5] * points_ptr[1] +
46 transformation_ptr[6] * points_ptr[2] +
47 transformation_ptr[7],
48 transformation_ptr[8] * points_ptr[0] +
49 transformation_ptr[9] * points_ptr[1] +
50 transformation_ptr[10] * points_ptr[2] +
51 transformation_ptr[11],
52 transformation_ptr[12] * points_ptr[0] +
53 transformation_ptr[13] * points_ptr[1] +
54 transformation_ptr[14] * points_ptr[2] +
55 transformation_ptr[15]};
57 points_ptr[0] = x[0] / x[3];
58 points_ptr[1] = x[1] / x[3];
59 points_ptr[2] = x[2] / x[3];
62 template <
typename scalar_t>
64 const scalar_t* transformation_ptr, scalar_t* normals_ptr) {
65 scalar_t x[3] = {transformation_ptr[0] * normals_ptr[0] +
66 transformation_ptr[1] * normals_ptr[1] +
67 transformation_ptr[2] * normals_ptr[2],
68 transformation_ptr[4] * normals_ptr[0] +
69 transformation_ptr[5] * normals_ptr[1] +
70 transformation_ptr[6] * normals_ptr[2],
71 transformation_ptr[8] * normals_ptr[0] +
72 transformation_ptr[9] * normals_ptr[1] +
73 transformation_ptr[10] * normals_ptr[2]};
75 normals_ptr[0] = x[0];
76 normals_ptr[1] = x[1];
77 normals_ptr[2] = x[2];
80 template <
typename scalar_t>
82 const scalar_t* R_ptr, scalar_t* points_ptr,
const scalar_t* center) {
83 scalar_t x[3] = {points_ptr[0] - center[0], points_ptr[1] - center[1],
84 points_ptr[2] - center[2]};
87 R_ptr[0] * x[0] + R_ptr[1] * x[1] + R_ptr[2] * x[2] + center[0];
89 R_ptr[3] * x[0] + R_ptr[4] * x[1] + R_ptr[5] * x[2] + center[1];
91 R_ptr[6] * x[0] + R_ptr[7] * x[1] + R_ptr[8] * x[2] + center[2];
94 template <
typename scalar_t>
96 const scalar_t* R_ptr, scalar_t* normals_ptr) {
97 scalar_t x[3] = {R_ptr[0] * normals_ptr[0] + R_ptr[1] * normals_ptr[1] +
98 R_ptr[2] * normals_ptr[2],
99 R_ptr[3] * normals_ptr[0] + R_ptr[4] * normals_ptr[1] +
100 R_ptr[5] * normals_ptr[2],
101 R_ptr[6] * normals_ptr[0] + R_ptr[7] * normals_ptr[1] +
102 R_ptr[8] * normals_ptr[2]};
104 normals_ptr[0] = x[0];
105 normals_ptr[1] = x[1];
106 normals_ptr[2] = x[2];
110 void TransformPointsCUDA
116 scalar_t* points_ptr =
points.GetDataPtr<scalar_t>();
117 const scalar_t* transformation_ptr =
124 points_ptr + 3 * workload_idx);
130 void TransformNormalsCUDA
136 scalar_t* normals_ptr = normals.GetDataPtr<scalar_t>();
137 const scalar_t* transformation_ptr =
144 normals_ptr + 3 * workload_idx);
150 void RotatePointsCUDA
158 scalar_t* points_ptr = points.GetDataPtr<scalar_t>();
159 const scalar_t* R_ptr = R.
GetDataPtr<scalar_t>();
160 const scalar_t* center_ptr = center.GetDataPtr<scalar_t>();
165 points_ptr + 3 * workload_idx,
172 void RotateNormalsCUDA
178 scalar_t* normals_ptr = normals.GetDataPtr<scalar_t>();
179 const scalar_t* R_ptr = R.
GetDataPtr<scalar_t>();
184 R_ptr, normals_ptr + 3 * workload_idx);
#define OPEN3D_FORCE_INLINE
Definition: CUDAUtils.h:62
void ParallelFor(const Device &device, int64_t n, const func_t &func)
Definition: ParallelFor.h:122
Device GetDevice() const
Definition: Tensor.cpp:1365
#define OPEN3D_DEVICE
Definition: CUDAUtils.h:64
#define OPEN3D_HOST_DEVICE
Definition: CUDAUtils.h:63
Definition: PinholeCameraIntrinsic.cpp:35
#define DISPATCH_FLOAT_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: Dispatch.h:96
T * GetDataPtr()
Definition: Tensor.h:1074