Refactoring according to reviewable
This commit is contained in:
parent
b0984c5f0c
commit
4e341b2b9f
|
@ -8,14 +8,13 @@
|
|||
|
||||
#include "carla/MsgPack.h"
|
||||
#include "carla/geom/Location.h"
|
||||
#include "carla/geom/Rotation.h"
|
||||
#include "carla/geom/Math.h"
|
||||
#include "carla/geom/Rotation.h"
|
||||
|
||||
#ifdef LIBCARLA_INCLUDED_FROM_UE4
|
||||
#include "Math/Transform.h"
|
||||
#endif // LIBCARLA_INCLUDED_FROM_UE4
|
||||
|
||||
|
||||
namespace carla {
|
||||
namespace geom {
|
||||
|
||||
|
@ -26,30 +25,20 @@ namespace geom {
|
|||
|
||||
Transform(const Location &in_location, const Rotation &in_rotation)
|
||||
: location(in_location),
|
||||
rotation(in_rotation) {
|
||||
}
|
||||
rotation(in_rotation) {}
|
||||
|
||||
Location location;
|
||||
Rotation rotation;
|
||||
|
||||
bool operator==(const Transform &rhs) const {
|
||||
bool operator==(const Transform &rhs) const {
|
||||
return (location == rhs.location) && (rotation == rhs.rotation);
|
||||
}
|
||||
|
||||
bool operator!=(const Transform &rhs) const {
|
||||
bool operator!=(const Transform &rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
|
||||
Location GetLocation() const {
|
||||
return location;
|
||||
}
|
||||
|
||||
Rotation GetRotation() const {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
inline void TransformPoint (Vector3D &in_point) const {
|
||||
void TransformPoint(Vector3D &in_point) const {
|
||||
|
||||
// Rotate
|
||||
double cy = cos(Math::to_radians(rotation.yaw));
|
||||
|
@ -60,16 +49,16 @@ namespace geom {
|
|||
double sp = sin(Math::to_radians(rotation.pitch));
|
||||
|
||||
Vector3D out_point;
|
||||
out_point.x = in_point.x * ( cp * cy )
|
||||
+ in_point.y * ( cy * sp * sr - sy * cr)
|
||||
+ in_point.z * (-cy * sp * cr - sy * sr);
|
||||
out_point.y = in_point.x * ( cp * sy)
|
||||
+ in_point.y * ( sy * sp * sr + cy * cr)
|
||||
+ in_point.z * (-sy * sp * cr + cy * sr);
|
||||
out_point.x = in_point.x * (cp * cy) +
|
||||
in_point.y * (cy * sp * sr - sy * cr) +
|
||||
in_point.z * (-cy * sp * cr - sy * sr);
|
||||
out_point.y = in_point.x * (cp * sy) +
|
||||
in_point.y * (sy * sp * sr + cy * cr) +
|
||||
in_point.z * (-sy * sp * cr + cy * sr);
|
||||
|
||||
out_point.z = in_point.x * (sp)
|
||||
+ in_point.y * -(cp * sr)
|
||||
+ in_point.z * (cp * cr);
|
||||
out_point.z = in_point.x * (sp) +
|
||||
in_point.y * -(cp * sr) +
|
||||
in_point.z * (cp * cr);
|
||||
|
||||
// Translate
|
||||
out_point += location;
|
||||
|
|
Loading…
Reference in New Issue