VR-Engage  2.2
Loading...
Searching...
No Matches
ladder.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file ladder.h
7//! \ingroup vreVrfobjcore
8//! \brief Ladder representation class for VREngage
9//!
10//! This file defines the DtLadder class, which provides a representation of a ladder
11//! in VREngage simulations, including its base, top, and orientation. It processes navigation
12//! ladder data to create a usable representation that enables human entities to climb ladders.
13
14#pragma once
15
17
18#include <matrix/vlVector.h>
19#include <matrix/vlDcm.h>
20
21#include <vector>
22
23class DtNavLadder;
24class DtPhysicalWorld;
25
26namespace makVre
27{
28//! \brief Helper class that represents a climbable ladder in simulations
29//!
30//! This class provides a representation of a ladder, including its base, top,
31//! orientation, and entry/exit points. It processes navigation ladder data to
32//! determine the locations where a human entity can mount or dismount the ladder,
33//! as well as the ladder's physical characteristics like pitch, heading and length.
35{
36public:
37 //! \brief Default constructor
38 //!
39 //! Creates a new ladder representation with default values.
40 //! Must be initialized with init() before use.
42
43 //! \brief Virtual destructor
44 //!
45 //! Cleans up resources used by the ladder representation.
46 virtual ~DtLadder();
47
48 //! \brief Copy constructor
49 //! \param orig The source ladder to copy from
50 //!
51 //! Creates a new ladder representation as a copy of the provided original.
52 DtLadder(const DtLadder& orig);
53
54 //! \brief Assignment operator
55 //! \param orig The source ladder to copy from
56 //! \return Reference to this ladder after assignment
57 //!
58 //! Assigns the contents of the provided ladder to this one.
60
61 //! \brief Equivalence operator
62 //! \param other The ladder to compare with
63 //! \return True if the ladders are equivalent, false otherwise
64 //!
65 //! Compares this ladder with another to determine if they are equivalent.
66 virtual bool operator==(const DtLadder& other);
67
68 //! \brief Initializes the ladder from navigation data
69 //! \param navLadder The navigation ladder data to initialize from
70 //! \param physicalWorld Pointer to the physical world for terrain queries
71 //!
72 //! Initializes this ladder representation based on the provided navigation ladder
73 //! data and physical world. This calculates the ladder's base, top, orientation,
74 //! and entry/exit points.
75 virtual void init(const DtNavLadder& navLadder, DtPhysicalWorld* physicalWorld);
76
77 //! \brief Gets the ladder base position
78 //! \return The position of the ladder's base in local coordinates
79 //!
80 //! Returns the position where the bottom of the ladder contacts the ground.
81 virtual DtVector base() const;
82
83 //! \brief Gets the ladder base entry/exit point
84 //! \return The position where an entity would enter/exit at the ladder's base
85 //!
86 //! Returns the position where an entity would stand to mount or dismount
87 //! the ladder at its base.
88 virtual DtVector baseEntryExit() const;
89
90 //! \brief Gets the ladder top position
91 //! \return The position of the ladder's top in local coordinates
92 //!
93 //! Returns the position of the top end of the ladder.
94 virtual DtVector top() const;
95
96 //! \brief Gets the ladder top entry/exit point
97 //! \return The position where an entity would enter/exit at the ladder's top
98 //!
99 //! Returns the position where an entity would stand to mount or dismount
100 //! the ladder at its top.
101 virtual DtVector topEntryExit() const;
102
103 //! \brief Gets the ladder heading
104 //! \return The heading angle in radians
105 //!
106 //! Returns the heading angle of the ladder in radians. This represents
107 //! the direction the ladder is facing when viewed from above.
108 virtual double heading() const;
109
110 //! \brief Gets the ladder pitch
111 //! \return The pitch angle in radians
112 //!
113 //! Returns the pitch angle of the ladder in radians. This represents
114 //! the steepness of the ladder relative to the ground.
115 virtual double pitch() const;
116
117 //! \brief Gets the ladder length
118 //! \return The length of the ladder in meters
119 //!
120 //! Returns the total length of the ladder from base to top.
121 virtual double length() const;
122
123 //! \brief Gets the ladder orientation matrix
124 //! \return The direction cosine matrix representing the ladder's orientation
125 //!
126 //! Returns a direction cosine matrix representing the ladder's orientation
127 //! in local coordinates.
128 virtual DtDcm localOrientation() const;
129
130protected:
131 //! \brief Calculates ladder properties from point data
132 //!
133 //! Internal method that calculates the ladder's base, top, heading, pitch,
134 //! length, and orientation based on the ladder points.
136
137
138protected:
139 //! \brief Ordered list of points on the ladder
140 //!
141 //! Stores points along the ladder in local (database) coordinates.
142 std::vector<DtVector> myLocalPointsOnLadder;
143
144 //! \brief Ordered list of entry/exit points
145 //!
146 //! Stores points near the ladder on the terrain in local coordinates,
147 //! where an entity would stand to mount or dismount the ladder.
148 //! Has one-to-one correspondence with myLocalPointsOnLadder.
149 std::vector<DtVector> myLocalLadderEntryExitPoints;
150
151 //! \brief Index of the base point in the points array
152 //!
153 //! Stores the index of the base point within myLocalPointsOnLadder.
155
156 //! \brief Index of the top point in the points array
157 //!
158 //! Stores the index of the top point within myLocalPointsOnLadder.
160
161 //! \brief The ladder heading in radians
162 //!
163 //! Stores the heading angle of the ladder in radians.
164 double myHeading;
165
166 //! \brief The ladder pitch in radians
167 //!
168 //! Stores the pitch angle of the ladder in radians.
169 double myPitch;
170
171 //! \brief The ladder length in meters
172 //!
173 //! Stores the total length of the ladder from base to top.
174 double myLength;
175
176 //! \brief The ladder orientation matrix
177 //!
178 //! Stores a direction cosine matrix representing the ladder's orientation
179 //! in local coordinates.
181
182 //! \brief Pointer to the physical world
183 //!
184 //! Stores a pointer to the physical world used for terrain queries.
185 DtPhysicalWorld* myPhysicalWorld;
186};
187} // namespace makVre
DtDcm myLocalOrientation
The ladder orientation matrix.
Definition ladder.h:180
double myPitch
The ladder pitch in radians.
Definition ladder.h:169
virtual DtVector baseEntryExit() const
Gets the ladder base entry/exit point.
double myHeading
The ladder heading in radians.
Definition ladder.h:164
std::vector< DtVector > myLocalLadderEntryExitPoints
Ordered list of entry/exit points.
Definition ladder.h:149
virtual double heading() const
Gets the ladder heading.
int myBaseIndex
Index of the base point in the points array.
Definition ladder.h:154
virtual double pitch() const
Gets the ladder pitch.
virtual void init(const DtNavLadder &navLadder, DtPhysicalWorld *physicalWorld)
Initializes the ladder from navigation data.
int myTopIndex
Index of the top point in the points array.
Definition ladder.h:159
DtLadder()
Default constructor.
virtual double length() const
Gets the ladder length.
virtual DtVector top() const
Gets the ladder top position.
double myLength
The ladder length in meters.
Definition ladder.h:174
virtual DtDcm localOrientation() const
Gets the ladder orientation matrix.
virtual bool operator==(const DtLadder &other)
Equivalence operator.
std::vector< DtVector > myLocalPointsOnLadder
Ordered list of points on the ladder.
Definition ladder.h:142
DtLadder(const DtLadder &orig)
Copy constructor.
DtLadder & operator=(const DtLadder &orig)
Assignment operator.
virtual DtVector topEntryExit() const
Gets the ladder top entry/exit point.
virtual void calculateBaseTopAndOrientation()
Calculates ladder properties from point data.
virtual DtVector base() const
Gets the ladder base position.
virtual ~DtLadder()
Virtual destructor.
DtPhysicalWorld * myPhysicalWorld
Pointer to the physical world.
Definition ladder.h:185
Export macros for the VREngage Object Core library.
#define VREVRFOBJCORE_DLL
Platform-specific DLL export/import declaration.
Definition export.h:27
Include export definitions for this library.
Definition glsVreMessageUtil.h:49