Gazebo Physics

API Reference

7.8.0
GetRayIntersection.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 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 
18 #ifndef GZ_PHYSICS_GETRAYINTERSECTION_HH_
19 #define GZ_PHYSICS_GETRAYINTERSECTION_HH_
20 
21 #include <cmath>
22 
25 #include <gz/physics/Geometry.hh>
27 
28 namespace gz
29 {
30 namespace physics
31 {
34 class GZ_PHYSICS_VISIBLE GetRayIntersectionFromLastStepFeature
35  : public virtual FeatureWithRequirements<ForwardStep>
36 {
37  public: template <typename PolicyT>
39  {
40  public: using Scalar = typename PolicyT::Scalar;
41  public: using VectorType =
42  typename FromPolicy<PolicyT>::template Use<LinearVector>;
43 
46 
53 
56 
58  public: bool IsHit() const { return std::isfinite(fraction); }
59  };
60 
61  public: template <typename PolicyT, typename FeaturesT>
62  class World : public virtual Feature::World<PolicyT, FeaturesT>
63  {
64  public: using VectorType =
65  typename FromPolicy<PolicyT>::template Use<LinearVector>;
67  public: using RayIntersectionData =
69 
74  const VectorType &_from, const VectorType &_to) const;
75  };
76 
77  public: template <typename PolicyT>
78  class Implementation : public virtual Feature::Implementation<PolicyT>
79  {
81  public: using VectorType =
82  typename FromPolicy<PolicyT>::template Use<LinearVector>;
83 
85  const Identity &_worldID,
86  const VectorType &_from,
87  const VectorType &_to) const = 0;
88  };
89 };
90 }
91 }
92 
93 #include "gz/physics/detail/GetRayIntersection.hh"
94 
95 #endif /* end of include guard: GZ_PHYSICS_GETRAYINTERSECTION_HH_ */