Gazebo Rendering

API Reference

6.6.3
gz/rendering/Utils.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_UTILS_HH_
18 #define GZ_RENDERING_UTILS_HH_
19 
20 #include <vector>
21 
22 #include <gz/math/Helpers.hh>
23 #include <gz/math/AxisAlignedBox.hh>
24 #include <gz/math/Vector2.hh>
25 #include <gz/math/Vector3.hh>
26 #include <gz/math/Pose3.hh>
27 
28 #include "gz/rendering/Camera.hh"
29 #include "gz/rendering/config.hh"
30 #include "gz/rendering/Export.hh"
31 #include "gz/rendering/RayQuery.hh"
32 
33 
34 namespace ignition
35 {
37  namespace rendering
38  {
39  // Inline bracket to help doxygen filtering.
40  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
41  //
49  IGNITION_RENDERING_VISIBLE
51  const math::Vector2i &_screenPos,
52  const CameraPtr &_camera,
53  const RayQueryPtr &_rayQuery,
54  float _maxDistance = 10.0);
55 
64  IGNITION_RENDERING_VISIBLE
66  const math::Vector2i &_screenPos,
67  const CameraPtr &_camera,
68  const RayQueryPtr &_rayQuery,
69  RayQueryResult &_rayResult,
70  float _maxDistance = 10.0);
71 
79  IGNITION_RENDERING_VISIBLE
81  const math::Vector2i &_screenPos,
82  const CameraPtr &_camera,
83  const RayQueryPtr &_rayQuery,
84  const float _offset = 0.0);
85 
88  IGNITION_RENDERING_VISIBLE
89  float screenScalingFactor();
90 
96  IGNITION_RENDERING_VISIBLE
99  const ignition::math::Pose3d &_pose);
100 
110  IGNITION_RENDERING_VISIBLE
112  const ignition::math::Matrix4d &_projectionMatrix,
113  double _width, double _height);
114  }
115  }
116 }
117 #endif
shared_ptr< RayQuery > RayQueryPtr
Shared pointer to RayQuery.
Definition: gz/rendering/RenderTypes.hh:223
Vector2< int > Vector2i
ignition::math::AxisAlignedBox transformAxisAlignedBox(const ignition::math::AxisAlignedBox &_box, const ignition::math::Pose3d &_pose)
Transform a bounding box.
math::Vector3d screenToScene(const math::Vector2i &_screenPos, const CameraPtr &_camera, const RayQueryPtr &_rayQuery, float _maxDistance=10.0)
Retrieve the first point on a surface in the 3D scene hit by a ray cast from the given 2D screen coor...
float screenScalingFactor()
Get the screen scaling factor.
shared_ptr< Camera > CameraPtr
Shared pointer to Camera.
Definition: gz/rendering/RenderTypes.hh:107
ignition::math::Matrix3d projectionToCameraIntrinsic(const ignition::math::Matrix4d &_projectionMatrix, double _width, double _height)
Convert a given camera projection matrix to an intrinsics matrix. Intrinsics matrix is different from...
Vector3< double > Vector3d
math::Vector3d screenToPlane(const math::Vector2i &_screenPos, const CameraPtr &_camera, const RayQueryPtr &_rayQuery, const float _offset=0.0)
Retrieve the point on a plane at z = 0 in the 3D scene hit by a ray cast from the given 2D screen coo...