Move Rotation class to its own header

This commit is contained in:
nsubiron 2018-10-16 20:24:53 +02:00
parent d7d4dd4e1e
commit 16f4996e71
2 changed files with 49 additions and 29 deletions

View File

@ -0,0 +1,47 @@
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
// de Barcelona (UAB).
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.
#pragma once
#include "carla/MsgPack.h"
#ifdef LIBCARLA_INCLUDED_FROM_UE4
# include "Math/Rotator.h"
#endif // LIBCARLA_INCLUDED_FROM_UE4
namespace carla {
namespace geom {
class Rotation {
public:
Rotation() = default;
Rotation(float p, float y, float r)
: pitch(p),
yaw(y),
roll(r) {}
float pitch = 0.0f;
float yaw = 0.0f;
float roll = 0.0f;
#ifdef LIBCARLA_INCLUDED_FROM_UE4
Rotation(const FRotator &rotator)
: Rotation(rotator.Pitch, rotator.Yaw, rotator.Roll) {}
operator FRotator() const {
return FRotator{pitch, yaw, roll};
}
#endif // LIBCARLA_INCLUDED_FROM_UE4
MSGPACK_DEFINE_ARRAY(pitch, yaw, roll);
};
} // namespace geom
} // namespace carla

View File

@ -8,42 +8,15 @@
#include "carla/MsgPack.h"
#include "carla/geom/Location.h"
#include "carla/geom/Rotation.h"
#ifdef LIBCARLA_INCLUDED_FROM_UE4
# include "Transform.h"
# include "Math/Transform.h"
#endif // LIBCARLA_INCLUDED_FROM_UE4
namespace carla {
namespace geom {
class Rotation {
public:
Rotation() = default;
Rotation(float p, float y, float r)
: pitch(p),
yaw(y),
roll(r) {}
float pitch = 0.0f;
float yaw = 0.0f;
float roll = 0.0f;
#ifdef LIBCARLA_INCLUDED_FROM_UE4
Rotation(const FRotator &rotator)
: Rotation(rotator.Pitch, rotator.Yaw, rotator.Roll) {}
operator FRotator() const {
return FRotator{pitch, yaw, roll};
}
#endif // LIBCARLA_INCLUDED_FROM_UE4
MSGPACK_DEFINE_ARRAY(pitch, yaw, roll);
};
class Transform {
public: