Open3D (C++ API)  0.17.0
TransformationConverterImpl.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 // Private header. Do not include in Open3d.h.
9 
10 #pragma once
11 
12 #include <cmath>
13 
14 #include "open3d/core/CUDAUtils.h"
15 
16 namespace open3d {
17 namespace t {
18 namespace pipelines {
19 namespace kernel {
20 
22 template <typename scalar_t>
24  scalar_t *transformation_ptr, const scalar_t *pose_ptr) {
25  transformation_ptr[0] = cos(pose_ptr[2]) * cos(pose_ptr[1]);
26  transformation_ptr[1] =
27  -1 * sin(pose_ptr[2]) * cos(pose_ptr[0]) +
28  cos(pose_ptr[2]) * sin(pose_ptr[1]) * sin(pose_ptr[0]);
29  transformation_ptr[2] =
30  sin(pose_ptr[2]) * sin(pose_ptr[0]) +
31  cos(pose_ptr[2]) * sin(pose_ptr[1]) * cos(pose_ptr[0]);
32  transformation_ptr[4] = sin(pose_ptr[2]) * cos(pose_ptr[1]);
33  transformation_ptr[5] =
34  cos(pose_ptr[2]) * cos(pose_ptr[0]) +
35  sin(pose_ptr[2]) * sin(pose_ptr[1]) * sin(pose_ptr[0]);
36  transformation_ptr[6] =
37  -1 * cos(pose_ptr[2]) * sin(pose_ptr[0]) +
38  sin(pose_ptr[2]) * sin(pose_ptr[1]) * cos(pose_ptr[0]);
39  transformation_ptr[8] = -1 * sin(pose_ptr[1]);
40  transformation_ptr[9] = cos(pose_ptr[1]) * sin(pose_ptr[0]);
41  transformation_ptr[10] = cos(pose_ptr[1]) * cos(pose_ptr[0]);
42 }
43 
44 #ifdef BUILD_CUDA_MODULE
49 template <typename scalar_t>
50 void PoseToTransformationCUDA(scalar_t *transformation_ptr,
51  const scalar_t *pose_ptr);
52 #endif
53 
54 } // namespace kernel
55 } // namespace pipelines
56 } // namespace t
57 } // namespace open3d
Common CUDA utilities.
#define OPEN3D_HOST_DEVICE
Definition: CUDAUtils.h:44
OPEN3D_HOST_DEVICE void PoseToTransformationImpl(scalar_t *transformation_ptr, const scalar_t *pose_ptr)
Shared implementation for PoseToTransformation function.
Definition: TransformationConverterImpl.h:23
Definition: PinholeCameraIntrinsic.cpp:16