Open3D (C++ API)  0.18.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-2023 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
36
41 uint32_t AddTriangles(const core::Tensor &vertex_positions,
42 const core::Tensor &triangle_indices);
43
47 uint32_t AddTriangles(const TriangleMesh &mesh);
48
72 std::unordered_map<std::string, core::Tensor> CastRays(
73 const core::Tensor &rays, const int nthreads = 0);
74
89 const core::Tensor &rays,
90 const float tnear = 0.f,
91 const float tfar = std::numeric_limits<float>::infinity(),
92 const int nthreads = 0);
93
105 const int nthreads = 0);
106
131 std::unordered_map<std::string, core::Tensor> ListIntersections(
132 const core::Tensor &rays, const int nthreads = 0);
133
152 std::unordered_map<std::string, core::Tensor> ComputeClosestPoints(
153 const core::Tensor &query_points, const int nthreads = 0);
154
164 core::Tensor ComputeDistance(const core::Tensor &query_points,
165 const int nthreads = 0);
166
190 const int nthreads = 0,
191 const int nsamples = 1);
192
215 core::Tensor ComputeOccupancy(const core::Tensor &query_points,
216 const int nthreads = 0,
217 const int nsamples = 1);
218
227 static core::Tensor CreateRaysPinhole(const core::Tensor &intrinsic_matrix,
228 const core::Tensor &extrinsic_matrix,
229 int width_px,
230 int height_px);
231
241 static core::Tensor CreateRaysPinhole(double fov_deg,
242 const core::Tensor &center,
243 const core::Tensor &eye,
244 const core::Tensor &up,
245 int width_px,
246 int height_px);
247
249 static uint32_t INVALID_ID();
250
251private:
252 struct Impl;
253 std::unique_ptr<Impl> impl_;
254};
255
256} // namespace geometry
257} // namespace t
258} // namespace open3d
Definition Tensor.h:32
A scene class with basic ray casting and closest point queries.
Definition RaycastingScene.h:30
~RaycastingScene()
Definition RaycastingScene.cpp:708
std::unordered_map< std::string, core::Tensor > CastRays(const core::Tensor &rays, const int nthreads=0)
Computes the first intersection of the rays with the scene.
Definition RaycastingScene.cpp:771
core::Tensor ComputeDistance(const core::Tensor &query_points, const int nthreads=0)
Computes the distance to the surface of the scene.
Definition RaycastingScene.cpp:929
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:801
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:1066
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:822
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:841
static uint32_t INVALID_ID()
The value for invalid IDs.
Definition RaycastingScene.cpp:1164
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:1051
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:1023
uint32_t AddTriangles(const core::Tensor &vertex_positions, const core::Tensor &triangle_indices)
Add a triangle mesh to the scene.
Definition RaycastingScene.cpp:713
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:899
A triangle mesh contains vertices and triangles.
Definition TriangleMesh.h:92
Definition PinholeCameraIntrinsic.cpp:16
Definition RaycastingScene.cpp:328