22 namespace trianglemesh {
28 #if defined(__CUDACC__)
29 void NormalizeNormalsCUDA
35 const int64_t n = normals.GetLength();
38 scalar_t* ptr = normals.GetDataPtr<scalar_t>();
42 int64_t idx = 3 * workload_idx;
43 scalar_t x = ptr[idx];
44 scalar_t y = ptr[idx + 1];
45 scalar_t z = ptr[idx + 2];
51 scalar_t norm = sqrt(x * x + y * y + z * z);
65 #if defined(__CUDACC__)
66 void ComputeTriangleNormalsCUDA
74 const int64_t n = normals.GetLength();
78 scalar_t* normal_ptr = normals.GetDataPtr<scalar_t>();
79 const int64_t* triangle_ptr = triangles_d.
GetDataPtr<int64_t>();
80 const scalar_t* vertex_ptr = vertices.GetDataPtr<scalar_t>();
84 int64_t idx = 3 * workload_idx;
86 int64_t triangle_id1 = triangle_ptr[idx];
87 int64_t triangle_id2 = triangle_ptr[idx + 1];
88 int64_t triangle_id3 = triangle_ptr[idx + 2];
90 scalar_t v01[3], v02[3];
91 v01[0] = vertex_ptr[3 * triangle_id2] -
92 vertex_ptr[3 * triangle_id1];
93 v01[1] = vertex_ptr[3 * triangle_id2 + 1] -
94 vertex_ptr[3 * triangle_id1 + 1];
95 v01[2] = vertex_ptr[3 * triangle_id2 + 2] -
96 vertex_ptr[3 * triangle_id1 + 2];
97 v02[0] = vertex_ptr[3 * triangle_id3] -
98 vertex_ptr[3 * triangle_id1];
99 v02[1] = vertex_ptr[3 * triangle_id3 + 1] -
100 vertex_ptr[3 * triangle_id1 + 1];
101 v02[2] = vertex_ptr[3 * triangle_id3 + 2] -
102 vertex_ptr[3 * triangle_id1 + 2];
#define OPEN3D_DEVICE
Definition: CUDAUtils.h:45
#define DISPATCH_FLOAT_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: Dispatch.h:77
T * GetDataPtr()
Definition: Tensor.h:1133
Tensor To(Dtype dtype, bool copy=false) const
Definition: Tensor.cpp:706
OPEN3D_HOST_DEVICE OPEN3D_FORCE_INLINE void cross_3x1(const scalar_t *A_3x1_input, const scalar_t *B_3x1_input, scalar_t *C_3x1_output)
Definition: Matrix.h:63
const Dtype Int64
Definition: Dtype.cpp:47
void ParallelFor(const Device &device, int64_t n, const func_t &func)
Definition: ParallelFor.h:103
void NormalizeNormalsCPU(core::Tensor &normals)
Definition: TriangleMeshImpl.h:33
void ComputeTriangleNormalsCPU(const core::Tensor &vertices, const core::Tensor &triangles, core::Tensor &normals)
Definition: TriangleMeshImpl.h:70
Definition: PinholeCameraIntrinsic.cpp:16