Core: Format Placement::toString() and fix const correctness
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
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<double> _pos;
|
||||
|
||||
Reference in New Issue
Block a user