Open3D (C++ API)  0.19.0
Loading...
Searching...
No Matches
RaycastingScene.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// Copyright (c) 2018-2024 www.open3d.org
5// SPDX-License-Identifier: MIT
6// ----------------------------------------------------------------------------
7
8#pragma once
9
10#include <memory>
11
12#include "open3d/Macro.h"
13#include "open3d/core/Tensor.h"
16
17namespace open3d {
18namespace t {
19namespace geometry {
20
31public:
33 RaycastingScene(int64_t nthreads = 0,
34 const core::Device &device = core::Device("CPU:0"));
35
37
43 uint32_t AddTriangles(const core::Tensor &vertex_positions,
44 const core::Tensor &triangle_indices);
45
49 uint32_t AddTriangles(const TriangleMesh &mesh);
50
74 std::unordered_map<std::string, core::Tensor> CastRays(
75 const core::Tensor &rays, const int nthreads = 0) const;
76
91 const core::Tensor &rays,
92 const float tnear = 0.f,
93 const float tfar = std::numeric_limits<float>::infinity(),
94 const int nthreads = 0);
95
107 const int nthreads = 0);
108
133 std::unordered_map<std::string, core::Tensor> ListIntersections(
134 const core::Tensor &rays, const int nthreads = 0);
135
154 std::unordered_map<std::string, core::Tensor> ComputeClosestPoints(
155 const core::Tensor &query_points, const int nthreads = 0);
156
166 core::Tensor ComputeDistance(const core::Tensor &query_points,
167 const int nthreads = 0);
168
192 const int nthreads = 0,
193 const int nsamples = 1);
194
217 core::Tensor ComputeOccupancy(const core::Tensor &query_points,
218 const int nthreads = 0,
219 const int nsamples = 1);
220
229 static core::Tensor CreateRaysPinhole(const core::Tensor &intrinsic_matrix,
230 const core::Tensor &extrinsic_matrix,
231 int width_px,
232 int height_px);
233
243 static core::Tensor CreateRaysPinhole(double fov_deg,
244 const core::Tensor &center,
245 const core::Tensor &eye,
246 const core::Tensor &up,
247 int width_px,
248 int height_px);
249
251 static uint32_t INVALID_ID();
252
253private:
254 struct Impl;
255 struct CPUImpl;
256#ifdef BUILD_SYCL_MODULE
257 struct SYCLImpl;
258#endif
259 std::unique_ptr<Impl> impl_;
260};
261
262} // namespace geometry
263} // namespace t
264} // namespace open3d
double t
Definition SurfaceReconstructionPoisson.cpp:172
Definition Device.h:18
Definition Tensor.h:32
A scene class with basic ray casting and closest point queries.
Definition RaycastingScene.h:30
~RaycastingScene()
Definition RaycastingScene.cpp:1226
core::Tensor ComputeDistance(const core::Tensor &query_points, const int nthreads=0)
Computes the distance to the surface of the scene.
Definition RaycastingScene.cpp:1486
core::Tensor TestOcclusions(const core::Tensor &rays, const float tnear=0.f, const float tfar=std::numeric_limits< float >::infinity(), const int nthreads=0)
Checks if the rays have any intersection with the scene.
Definition RaycastingScene.cpp:1349
static core::Tensor CreateRaysPinhole(const core::Tensor &intrinsic_matrix, const core::Tensor &extrinsic_matrix, int width_px, int height_px)
Creates rays for the given camera parameters.
Definition RaycastingScene.cpp:1623
core::Tensor CountIntersections(const core::Tensor &rays, const int nthreads=0)
Computes the number of intersection of the rays with the scene.
Definition RaycastingScene.cpp:1370
std::unordered_map< std::string, core::Tensor > CastRays(const core::Tensor &rays, const int nthreads=0) const
Computes the first intersection of the rays with the scene.
Definition RaycastingScene.cpp:1315
std::unordered_map< std::string, core::Tensor > ListIntersections(const core::Tensor &rays, const int nthreads=0)
Lists the intersections of the rays with the scene.
Definition RaycastingScene.cpp:1390
static uint32_t INVALID_ID()
The value for invalid IDs.
Definition RaycastingScene.cpp:1721
core::Tensor ComputeOccupancy(const core::Tensor &query_points, const int nthreads=0, const int nsamples=1)
Computes the occupancy at the query point positions.
Definition RaycastingScene.cpp:1608
core::Tensor ComputeSignedDistance(const core::Tensor &query_points, const int nthreads=0, const int nsamples=1)
Computes the signed distance to the surface of the scene.
Definition RaycastingScene.cpp:1580
uint32_t AddTriangles(const core::Tensor &vertex_positions, const core::Tensor &triangle_indices)
Add a triangle mesh to the scene.
Definition RaycastingScene.cpp:1231
std::unordered_map< std::string, core::Tensor > ComputeClosestPoints(const core::Tensor &query_points, const int nthreads=0)
Computes the closest points on the surfaces of the scene.
Definition RaycastingScene.cpp:1456
A triangle mesh contains vertices and triangles.
Definition TriangleMesh.h:96
Definition PinholeCameraIntrinsic.cpp:16
Definition RaycastingScene.cpp:824
Definition RaycastingScene.cpp:358