Gazebo Rendering

API Reference

7.4.2
gz/rendering/RayQuery.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef GZ_RENDERING_RAYQUERY_HH_
18 #define GZ_RENDERING_RAYQUERY_HH_
19 
20 #include <gz/utils/SuppressWarning.hh>
21 #include <gz/math/Vector3.hh>
22 
23 #include "gz/rendering/config.hh"
24 #include "gz/rendering/Camera.hh"
25 #include "gz/rendering/Scene.hh"
26 #include "gz/rendering/Visual.hh"
27 
28 namespace gz
29 {
30  namespace rendering
31  {
32  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
33  //
35  class GZ_RENDERING_VISIBLE RayQueryResult
36  {
38  public: double distance = -1;
39 
41  GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
43  GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
44 
46  public: unsigned int objectId = 0;
47 
49  public: operator bool() const
50  {
51  return distance > 0;
52  }
53 
55  public: operator bool()
56  {
57  return distance > 0;
58  }
59  };
60 
63  class GZ_RENDERING_VISIBLE RayQuery
64  : public virtual Object
65  {
67  public: virtual ~RayQuery();
68 
71  public: virtual void SetOrigin(const math::Vector3d &_origin) = 0;
72 
75  public: virtual math::Vector3d Origin() const = 0;
76 
79  public: virtual void SetDirection(const math::Vector3d &_dir) = 0;
80 
83  public: virtual math::Vector3d Direction() const = 0;
84 
88  public: virtual void SetFromCamera(const CameraPtr &_camera,
89  const math::Vector2d &_coord) = 0;
90 
107  public: virtual RayQueryResult ClosestPoint(
108  bool _forceSceneUpdate = true) = 0;
109  };
110  }
111  }
112 }
113 #endif