Toggle navigation
PlayRho
0.9.0
GitHub
Main Page
Modules
Classes
Files
Examples
File List
File Members
Collision
RayCastOutput.hpp
Go to the documentation of this file.
1
/*
2
* Original work Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3
* Modified work Copyright (c) 2017 Louis Langholtz https://github.com/louis-langholtz/PlayRho
4
*
5
* This software is provided 'as-is', without any express or implied
6
* warranty. In no event will the authors be held liable for any damages
7
* arising from the use of this software.
8
*
9
* Permission is granted to anyone to use this software for any purpose,
10
* including commercial applications, and to alter it and redistribute it
11
* freely, subject to the following restrictions:
12
*
13
* 1. The origin of this software must not be misrepresented; you must not
14
* claim that you wrote the original software. If you use this software
15
* in a product, an acknowledgment in the product documentation would be
16
* appreciated but is not required.
17
* 2. Altered source versions must be plainly marked as such, and must not be
18
* misrepresented as being the original software.
19
* 3. This notice may not be removed or altered from any source distribution.
20
*/
21
22
#ifndef PLAYRHO_COLLISION_RAYCASTOUTPUT_HPP
23
#define PLAYRHO_COLLISION_RAYCASTOUTPUT_HPP
24
27
28
#include <
PlayRho/Common/BoundedValue.hpp
>
29
#include <
PlayRho/Common/OptionalValue.hpp
>
30
#include <
PlayRho/Collision/RayCastInput.hpp
>
31
32
namespace
playrho
{
33
namespace
detail {
34
35
template
<std::
size_t
N>
36
struct
AABB
;
37
38
}
// namespace detail
39
42
enum class
RayCastOpcode
43
{
46
Terminate
,
47
50
IgnoreFixture
,
51
55
ClipRay
,
56
60
ResetRay
61
};
62
63
namespace
d2 {
64
65
class
Shape;
66
class
Fixture;
67
class
DistanceProxy;
68
class
DynamicTree;
69
73
struct
RayCastHit
74
{
76
UnitVec
normal
;
77
80
UnitInterval<Real>
fraction
=
UnitInterval<Real>
{0};
81
};
82
86
using
RayCastOutput
=
Optional<RayCastHit>
;
87
90
using
DynamicTreeRayCastCB
= std::function<
Real
(
Fixture
* fixture,
ChildCounter
child,
91
const
RayCastInput
& input)>;
92
94
using
FixtureRayCastCB
= std::function<
RayCastOpcode
(
Fixture
* fixture,
ChildCounter
child,
95
Length2
point,
UnitVec
normal)>;
96
101
106
RayCastOutput
RayCast
(
Length
radius,
Length2
location,
const
RayCastInput
& input) noexcept;
107
111
RayCastOutput
RayCast
(
const
detail::AABB<2>
& aabb,
const
RayCastInput
& input) noexcept;
112
118
RayCastOutput
RayCast
(
const
DistanceProxy
& proxy,
const
RayCastInput
& input,
119
const
Transformation
& transform) noexcept;
120
128
RayCastOutput
RayCast
(
const
Shape
& shape,
ChildCounter
childIndex,
129
const
RayCastInput
& input,
const
Transformation
& transform) noexcept;
130
149
bool
RayCast
(
const
DynamicTree
& tree,
RayCastInput
input,
const
DynamicTreeRayCastCB
& callback);
150
162
bool
RayCast
(
const
DynamicTree
& tree,
const
RayCastInput
& input,
FixtureRayCastCB
callback);
163
165
166
}
// namespace d2
167
}
// namespace playrho
168
169
#endif // PLAYRHO_COLLISION_RAYCASTOUTPUT_HPP
170