From 44065bfff434456c4780d8c4234331e3acbd3b2d Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 19 Dec 2024 11:13:28 +0100 Subject: [PATCH] Core: Format Placement::toString() and fix const correctness --- src/Base/Placement.cpp | 14 +++++--------- src/Base/Placement.h | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Base/Placement.cpp b/src/Base/Placement.cpp index f1cacf43a718..e9b66932e186 100644 --- a/src/Base/Placement.cpp +++ b/src/Base/Placement.cpp @@ -212,21 +212,17 @@ Placement Placement::sclerp(const Placement& p0, const Placement& p1, double t, return p0 * trf.pow(t, shorten); } -std::string Placement::toString() +std::string Placement::toString() const { Base::Vector3d pos = getPosition(); Base::Rotation rot = getRotation(); Base::Vector3d axis; - double angle; + double angle {}; rot.getRawValue(axis, angle); + // clang-format off return fmt::format("position ({:.1f}, {:.1f}, {:.1f}), axis ({:.1f}, {:.1f}, {:.1f}), angle {:.1f}\n", - pos.x, - pos.y, - pos.z, - axis.x, - axis.y, - axis.z, - angle); + pos.x, pos.y, pos.z, axis.x, axis.y, axis.z, angle); + // clang-format on } diff --git a/src/Base/Placement.h b/src/Base/Placement.h index ca4f47ce5fa4..41bafc4faab2 100644 --- a/src/Base/Placement.h +++ b/src/Base/Placement.h @@ -108,7 +108,7 @@ class BaseExport Placement sclerp(const Placement& p0, const Placement& p1, double t, bool shorten = true); /// Returns string representation of the placement, useful for debugging - std::string toString(); + std::string toString() const; private: Vector3 _pos;