82 lines
3.2 KiB
C++
82 lines
3.2 KiB
C++
#pragma once
|
|
|
|
#include "Thing.h"
|
|
#include "Vector2.h"
|
|
#include "Vector3.h"
|
|
|
|
namespace Passer {
|
|
namespace RoboidControl {
|
|
|
|
/// @brief A plament is used to specify where a Thing is placed on the Roboid.
|
|
/// @details
|
|
/// It is not always necessary to exactly specify the position and orientation
|
|
/// of a Thing. You can use a simple constructor in that case:
|
|
///
|
|
/// \code
|
|
/// Thing* thing = new Thing();
|
|
/// Placement p = Placement(thing);
|
|
/// \endcode
|
|
///
|
|
/// The thing can be placed using carthesian coordinates in meters, while the
|
|
/// orientation is specified with the horizontal and vertical direction. Whenö
|
|
/// both horizontal and vertical direction are zero, the Thing is aligned with
|
|
/// the parent thing in the hierarchy. When there is no parent, the thing is
|
|
/// directed such that it is looking forward.
|
|
///
|
|
/// \code
|
|
/// Thing* thing = new Thing();
|
|
/// Placement p = Placement(thing, Vector3(-0.04F, 0.0F, 0.06F), 0.0F, 0.0F);
|
|
/// \endcode
|
|
/// In the example above, the thing is placed 4 cm to the left and 6 cm to the
|
|
/// front relative to the parent. The orientation is the same as the parent. The
|
|
/// second line can be simplified, as the default angles are zero and a Vector2
|
|
/// position can be used which is a placement in the horizontal plane:
|
|
///
|
|
/// \code
|
|
/// Placement p = Placement(thing, Vector2(-0.04F, 0.06F));
|
|
/// \endcode
|
|
class Placement {
|
|
public:
|
|
/// @brief Placement of a Thing on a Roboid
|
|
/// @param thing The Thing which is placed
|
|
/// @param position The position of the Thing in carthesian coordinates
|
|
/// @param horizontalDirection The horizontal direction angle of the Thing.
|
|
/// Negative angles are to the left.
|
|
/// @param verticalAngle The vertical direction angle of the Thing. Negative
|
|
/// angles are downward.
|
|
Placement(Thing *thing, Vector3 position = Vector3::zero,
|
|
float horizontalDirection = 0.0F, float verticalAngle = 0.0F);
|
|
/// @brief Placement of a Thing on a Roboid without position
|
|
/// @param thing The Thing which is place
|
|
/// @param horizontalDirection The horizontal direction angle of the Thing.
|
|
/// Negative angles are to the left.
|
|
/// @param verticalDirection The vertical direction angle of the Thing.
|
|
/// Negative angles are downward.
|
|
Placement(Thing *thing, float horizontalDirection,
|
|
float verticalDirection = 0.0F);
|
|
/// @brief Default constructor with a zero placement
|
|
Placement();
|
|
|
|
/// @brief The parent placement in the Roboid hierarchy
|
|
/// @remark Reserved for future use
|
|
Placement *parent = nullptr;
|
|
/// @brief An array of children of this placement in the Roboid hierarchy
|
|
/// @remark Reserved for future use
|
|
Placement **children = nullptr;
|
|
/// @brief The number of children of this placemet in the Roboid hierarchy
|
|
/// @remark Reserved for future use
|
|
unsigned int childCount = 0;
|
|
|
|
/// @brief The Thing which is placed
|
|
Thing *thing;
|
|
/// @brief The position of the Thing in carthesian coordinates
|
|
Vector3 position;
|
|
/// @brief The angle or direction of the Thing in the horizontal plane
|
|
float horizontalDirection;
|
|
/// @brief The angle or direction of the Thing in the vertical plane
|
|
float verticalDirection;
|
|
};
|
|
|
|
} // namespace RoboidControl
|
|
} // namespace Passer
|
|
using namespace Passer::RoboidControl; |