Gazebo Rendering

API Reference

6.6.3
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/common/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 ignition
29 {
30  namespace rendering
31  {
32  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
33  //
35  class IGNITION_RENDERING_VISIBLE RayQueryResult
36  {
38  public: double distance = -1;
39 
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 IGNITION_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 
93  public: virtual RayQueryResult ClosestPoint() = 0;
94  };
95  }
96  }
97 }
98 #endif
unsigned int objectId
Intersected object id.
Definition: gz/rendering/RayQuery.hh:46
STL class.
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
virtual math::Vector3d Direction() const =0
Get ray direction.
double distance
Intersection distance.
Definition: gz/rendering/RayQuery.hh:38
A class that stores ray query intersection results.
Definition: gz/rendering/RayQuery.hh:35
virtual void SetOrigin(const math::Vector3d &_origin)=0
Set ray origin.
A Ray Query class used for computing ray object intersections.
Definition: gz/rendering/RayQuery.hh:63
math::Vector3d point
Intersection point in 3d space.
Definition: gz/rendering/RayQuery.hh:42
Represents an object present in the scene graph. This includes sub-meshes, materials,...
Definition: gz/rendering/Object.hh:34
virtual ~RayQuery()
Destructor.
Definition: gz/rendering/RayQuery.hh:67
virtual RayQueryResult ClosestPoint()=0
Compute intersections.
virtual void SetDirection(const math::Vector3d &_dir)=0
Set ray direction.
virtual void SetFromCamera(const CameraPtr &_camera, const math::Vector2d &_coord)=0
Create the ray query from camera.
virtual math::Vector3d Origin() const =0
Get ray origin.
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING